Install Bash completion along with distutils / pip

I created a simple Python module and want to distribute using pip. I also want to install the Bash completion file along with the module. I am installing the module using Python 2.7.1+ and pip 0.8.2.

I have setup.py:

setup(
    name='jenkinsmon',
    version='0.0.1',
    description='Jenkins Job Monitor',
    long_description=open('README.txt').read(),
    scripts=['bin/jenkinsmon'],
    data_files=[
        ('/etc/bash_completion.d', ['extras/jenkinsmon.completion']),
    ],
    install_requires = [
        'autojenkins',
        'argparse'
    ],
)

      

Now if I try to install a package with pip install -e .

, the Bash completion file is never installed with the package. I have also tried workarounds by specifying MANIFEST.in as described here :

MANIFEST.in:

include extras/jenkinsmon.completion

      

But that doesn't help either - the completion files won't be installed. What can be done to install Bash completion files?

+3


source to share


2 answers


My mistake (besides not reading the pip documentation at all) was only to add -e

to the options pip install

, which means set to "editable" mode. Quote documentation

Using the --editable or -e option, pip can install directly from the source control repository (it currently supports Subversion, Mercurial, Git, and Bazaar):

pip install -e svn+http://svn.colorstudy.com/INITools/trunk#egg=initools-dev

This is the shells option for the command line client for each corresponding VCS, so you must have VCS installed on your system. The repo url should start with svn + (or hg +, git +, or bzr +) and end with C # egg = packagename; otherwise, pip supports the same URL formats and wire protocols supported by VCS itself.

Pip will checkout the original repo against the src / directory inside virtualenv (i.e. pip_test_env / src / initools-dev) and then run python setup.py on that original repo. This "links" the code directly from the repo to the virtual sites directory (by adding the repo directory to easy-install.pth), so the changes you made to the original checkout take effect immediately.

If you already have a local VCS checkout that you want to keep using, you can simply use pip install -e path / to / repo to install it "editable" in the same way.



So, to install a package permanently on the system, I need to uninstall -r, then the Bash -completion files are installed as expected.

0


source


MANIFEST.in only describes additional files that should be included in source distributions; it has nothing to do with installation.



Is the file installed if you run python setup.py install

? pip relies on setuptools, so it's possible that pip inherits its installation behavior in just one directory / zip file "egg".

+1


source







All Articles