Git Product home page Git Product logo

pipman's Introduction

Description

Pipman generates PKGBUILD from pip packages. You can use the generated PKGBUILD as a base to submit a new python package to AUR or just install it on you machine.

Installation

You can install:

Install the colorama module if you want to colorize the output

Usage

The following generates PKGBUILDs for MechanicalSoup and pyrasite packages from pip:

pipman MechanicalSoup pyrasite

Then you should see the directories python-MechanicalSoup and python-pyrasite in the current directory, each containing its PKGBUILD.

You can also specify where you want the PKGBUILDs to be generated:

pipman MechanicalSoup pyrasite --target-dir=/tmp/

You can search for pip packages with the argument -Ss:

pipman -Ss sympy

You can install the generated PKGBUILD automatically with the argument -S:

pipman -S sympy

Pipman keeps track of the packages installed using the -S option. You can update these packages with the following command:

pipman -Su

Check pipman --help for more features.

Credits

  • Thanks to n3f4s for the auto-install feature.

pipman's People

Contributors

n3f4s avatar opeeba avatar sollidsnake avatar tyilo avatar urjeetpatel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

n3f4s tyilo m-wells

pipman's Issues

PKGBUILD.tpl (template) is not bundled into package.

[oystein@jupiter xlsxwriter]$ pipman --no-install install xlsxwriter [...] write_pkgbuild(package) File "/usr/lib/python3.5/site-packages/pipman/printer.py", line 70, in write_pkgbuild file_.write(generate_pkgbuild(package)) File "/usr/lib/python3.5/site-packages/pipman/printer.py", line 31, in generate_pkgbuild with open(TPL_FILE) as file_: FileNotFoundError: [Errno 2] No such file or directory: '/usr/lib/python3.5/site-packages/pipman/PKGBUILD.tpl'

(I solved this by copying in the file manually in pkgdir and repack.)

Can't generate PKGBUILD from a git repository

I use pipman git+https://github.com/amezin/powerplay-table-editor.git and I get the following:

pipman: Preparing virtualenv
pipman: checking for pip upgrade
Collecting pip
  Using cached https://files.pythonhosted.org/packages/62/ca/94d32a6516ed197a491d17d46595ce58a83cbb2fca280414e57cd86b84dc/pip-19.2.1-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 19.0.3
    Uninstalling pip-19.0.3:
      Successfully uninstalled pip-19.0.3
Successfully installed pip-19.2.1
pipman: Installing 'git+https://github.com/amezin/powerplay-table-editor.git' in virtualenv
Collecting git+https://github.com/amezin/powerplay-table-editor.git
  Cloning https://github.com/amezin/powerplay-table-editor.git to /tmp/pip-req-build-htiu91uw
  Running command git clone -q https://github.com/amezin/powerplay-table-editor.git /tmp/pip-req-build-htiu91uw
Collecting PyQt5 (from amdgpu-pptable==0.1.dev18+g3e568fc)
  Using cached https://files.pythonhosted.org/packages/85/bd/8a0c863802449f35ad9ca21a1b73190639c206758b4b5e2425617fc99ce9/PyQt5-5.13.0-5.13.0-cp35.cp36.cp37.cp38-abi3-manylinux1_x86_64.whl
Collecting PyQt5_sip<13,>=4.19.14 (from PyQt5->amdgpu-pptable==0.1.dev18+g3e568fc)
  Using cached https://files.pythonhosted.org/packages/ec/7d/c8d2326c405cfed1858af83915fa02ba9e9722ae3e0343df0950fd900039/PyQt5_sip-4.19.18-cp37-cp37m-manylinux1_x86_64.whl
Installing collected packages: PyQt5-sip, PyQt5, amdgpu-pptable
  Running setup.py install for amdgpu-pptable ... done
Successfully installed PyQt5-5.13.0 PyQt5-sip-4.19.18 amdgpu-pptable-0.1.dev18+g3e568fc
Traceback (most recent call last):
  File "/usr/bin/pipman", line 109, in <module>
    action(args, quiet)
  File "/usr/bin/pipman", line 41, in generate
    Pip2Pkgbuild(packages, quiet=quiet).generate_all(dir)
  File "/usr/lib/python3.7/site-packages/pipman/pip2pkgbuild.py", line 90, in __init__
    self.setup_packages(packages, quiet)
  File "/usr/lib/python3.7/site-packages/pipman/pip2pkgbuild.py", line 116, in setup_packages
    self.install_in_venv(pack)
  File "/usr/lib/python3.7/site-packages/pipman/pip2pkgbuild.py", line 229, in install_in_venv
    dependencies = subprocess.check_output([VENV_PIP, 'show', package])
  File "/usr/lib/python3.7/subprocess.py", line 395, in check_output
    **kwargs).stdout
  File "/usr/lib/python3.7/subprocess.py", line 487, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/tmp/pipman/pipman-venv/bin/pip', 'show', 'git+https://github.com/amezin/powerplay-table-editor.git']' returned non-zero exit status 1.

Is there a way to remove packages with pipman?

When I run pipman -Su, it tries to update packages I've removed with pacman. I don't want to update these packages.

Example:

❯ pipman -Su
pipman: Checking package info
Traceback (most recent call last):
  File "/usr/bin/pipman", line 79, in <module>
    action(args, quiet)
  File "/usr/bin/pipman", line 60, in update
    InstallData().check_updates(quiet)
  File "/usr/lib/python3.7/site-packages/pipman/pip2pkgbuild.py", line 47, in check_updates
    info = Pip2Pkgbuild.compile_package_info(pack[1]['name'])
  File "/usr/lib/python3.7/site-packages/pipman/pip2pkgbuild.py", line 251, in compile_package_info
    stderr=DEVNULL)
  File "/usr/lib/python3.7/subprocess.py", line 395, in check_output
    **kwargs).stdout
  File "/usr/lib/python3.7/subprocess.py", line 487, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/tmp/pipman/pipman-venv/bin/pip', 'show', 'trypackage']' returned non-zero exit status 1.

ENCODING can be None

$ LC_ALL=C LANG=en_US python -i ./pipman wal-e
pipman: Preparing virtualenv
pipman: Installing 'wal-e' in virutalenv
Requirement already satisfied: wal-e in /tmp/pipman/pipman-venv/lib/python3.4/site-packages
Requirement already satisfied: gevent>=1.1.1 in /tmp/pipman/pipman-venv/lib/python3.4/site-packages (from wal-e)
Requirement already satisfied: greenlet>=0.4.10 in /tmp/pipman/pipman-venv/lib/python3.4/site-packages (from gevent>=1.1.1->wal-e)
Traceback (most recent call last):
  File "./pipman", line 73, in <module>
    action(args, quiet)
  File "./pipman", line 39, in generate
    Pip2Pkgbuild(packages, quiet=quiet).generate_all(dir)
  File "/data/build/VC/pipman/src/pipman/pip2pkgbuild.py", line 31, in __init__
    self.install_in_venv(pack)
  File "/data/build/VC/pipman/src/pipman/pip2pkgbuild.py", line 135, in install_in_venv
    dependencies = dependencies.decode(ENCODING)
TypeError: decode() argument 1 must be str, not None
>>> import locale
>>> locale.getdefaultlocale()
(None, None)
>>>

merge (my fork) into upstream

Hi,
some times ago, I forked your repository to correct an error in the generated PKGBUILD.
Since the fork, I made other modifications and improvement:

  • I refactor part of the code:
    • removed the class to use "free" functions (I found the class too rigid for adding features)
    • split function into separate file/module
    • extract PKGBUILD template in it's own file
  • I changed the (normal) output format to be like pacman output
  • I switch command line argument parsing from python standard lib to docopt
  • I intend to change the command line argument to look like pacman command line argument
  • I added a search function
  • I add auto-installation (Work In Progress)
    (that should be every modification I have made)

I was thinking that it may be better to merge my fork into your repository.
What do you think of it ? Would it be OK ?

Pip error when trying to install any package with pipman

pipman: Preparing virtualenv
pipman: Installing 'plotly' in virutalenv
Traceback (most recent call last):
File "/usr/bin/pipman", line 79, in
action(args, quiet)
File "/usr/bin/pipman", line 52, in install
Pip2Pkgbuild(packages, quiet=quiet).install_all(dir)
File "/usr/lib/python3.7/site-packages/pipman/pip2pkgbuild.py", line 80, in init
self.install_in_venv(pack)
File "/usr/lib/python3.7/site-packages/pipman/pip2pkgbuild.py", line 188, in install_in_venv
'--disable-pip-version-check', package])
File "/usr/lib/python3.7/site-packages/pipman/pip2pkgbuild.py", line 92, in _exec
func(command)
File "/usr/lib/python3.7/subprocess.py", line 342, in check_call
retcode = call(*popenargs, **kwargs)
File "/usr/lib/python3.7/subprocess.py", line 323, in call
with Popen(*popenargs, **kwargs) as p:
File "/usr/lib/python3.7/subprocess.py", line 775, in init
restore_signals, start_new_session)
File "/usr/lib/python3.7/subprocess.py", line 1522, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pipman/pipman-venv/bin/pip': '/tmp/pipman/pipman-venv/bin/pip'

AUR package missing dependency

The AUR package for this project is missing a dependency. Maybe this is overlooked by people living in the python ecosystem anyway, but it doesn't seem to run without python-virtualenv installed.

Install binaries to /usr/bin?

I noticed when executing

$ pipman -S python-hdl-checker
$ pacman -Ql python-hdl-checker | grep /bin/
python-hdl-checker /usr/lib/python3.8/site-packages/bin/
python-hdl-checker /usr/lib/python3.8/site-packages/bin/hdl_checker

that binaries seem to be installed to /usr/lib/python3.8/site-packages/bin, which is not on my $PATH by default. Why not install to /usr/bin instead?

Updating installed packages

Hi,
It would be nice to have an option to update all the packages installed by pipman.

I did a bit of research about how to implement an update command.

From what I found, there is no way, in the PKGBUILD, to tell pacman what to do to update the packages (not installed by pacman).

I tried to have a look at pyalpm (which is a python binding to alpm, the library to interact with arch package database), but I found little to no documentation (except for a python re-implementation of pacman) and I'm not even sure that it will be useful.

An other solution is to have a database for pipman (SQL, noSQL or a text file). To update the installed packages, pipman would re-install (like yaourt and pacaur are doing for AUR) all of the packages in the database.

What do you think is the best option for implementing the update command ?

Formatting bug during search

Searching for lxml break the formatting:

> pip search lxml
# ...
webio (0.1)                    - Make sure to have libxml2 devel for lxml  sudo yum install libxml2-devel libxslt-devel  From root:     sudo python setup.py install --record setup/setup.txt      To uninstall:
                                 sudo cat setup/setup.txt | xargs rm -rf

> pipman -Ss lxml
# ...
webio 0.1
    Make sure to have libxml2 devel for lxml

sudo yum install libxml2-devel libxslt-devel

From root:
    sudo python setup.py install --record setup/setup.txt
    
To uninstall:
    sudo cat setup/setup.txt | xargs rm -rf

This may be due to the presence of multiple spaces in the description of webio.

KryPy cannot be built because it doesn't see dependencies

Hi,
I want to install KryPy package, it requires NumPy, which is installed as python-numpy:

local/python-numpy 1.12.1-1
Scientific tools for Python

However, pipman cannot build the package:

pipman krypy --target-dir=/home/user
pipman: Preparing virtualenv
pipman: Installing 'krypy' in virutalenv
Collecting krypy
  Using cached krypy-2.1.5.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-af1gg6ml/krypy/setup.py", line 18, in <module>
        from krypy import __version__
      File "/tmp/pip-build-af1gg6ml/krypy/krypy/__init__.py", line 1, in <module>
        from . import linsys, deflation, recycling, utils
      File "/tmp/pip-build-af1gg6ml/krypy/krypy/linsys.py", line 2, in <module>
        import numpy
    ModuleNotFoundError: No module named 'numpy'
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-af1gg6ml/krypy/
Traceback (most recent call last):
  File "/usr/bin/pipman", line 73, in <module>
    action(args, quiet)
  File "/usr/bin/pipman", line 39, in generate
    Pip2Pkgbuild(packages, quiet=quiet).generate_all(dir)
  File "/usr/lib/python3.6/site-packages/pipman/pip2pkgbuild.py", line 31, in __init__
    self.install_in_venv(pack)
  File "/usr/lib/python3.6/site-packages/pipman/pip2pkgbuild.py", line 132, in install_in_venv
    '--disable-pip-version-check', package])
  File "/usr/lib/python3.6/site-packages/pipman/pip2pkgbuild.py", line 43, in _exec
    func(command)
  File "/usr/lib/python3.6/subprocess.py", line 291, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/tmp/pipman/pipman-venv/bin/pip', 'install', '--disable-pip-version-check', 'krypy']' returned non-zero exit status 1.

KryPy package itself works fine:

pip install --user krypy
Collecting krypy
  Using cached krypy-2.1.5.tar.gz
Installing collected packages: krypy
  Running setup.py install for krypy ... done
Successfully installed krypy-2.1.5

Doesn't seem to install dependencies correctly

I tried running

% pipman -S python-hdl-checker

but unfortunately the generated PKGBUILD was as follows

# PKGBUILD generated by pipman
# Python package author: Andre Souto <[email protected]>
pkgname=python-hdl-checker
pkgver=0.6.13
pkgrel=1
pkgdesc="HDL code checker"
arch=(any)
url="https://github.com/suoto/hdl_checker"
license=(GPLv3)
makedepends=("python" "python-pip")
build() {
  pip install --no-deps --target="hdl-checker" hdl-checker==0.6.13
}
package() {
  sitepackages=$(python -c "import site; print(site.getsitepackages()[0])")
  mkdir -p $pkgdir/"$sitepackages"
  cp -r $srcdir/hdl-checker/* $pkgdir/"$sitepackages"
}

which does not include any of the numerous required dependencies for the package, such as

argcomplete-1.11.1 argparse-1.4.0 bottle-0.12.18 certifi-2019.11.28 chardet-3.0.4 future-0.18.2 hdl-checker-0.6.13 idna-2.7 jedi-0.15.2 parso-0.6.1 pluggy-0.13.1 prettytable-0.7.2 python-jsonrpc-server-0.3.4 python-language-server-0.31.8 requests-2.20.0 tabulate-0.8.6 typing-3.7.4.1 ujson-1.35 urllib3-1.24.3 waitress-1.4.3

which show up in the output of Pipman while building the package, so of course the hdl_checker utility that was installed is completely nonfunctional. My understanding of Pipman was that I could use it to install arbitrary packages from PyPI as Pacman packages, but this doesn't seem to be the case -- have I misunderstood something? If so, what is the use case for this tool?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.