I've got a couple packages in PyPI, and I'd like to include autocompletion features w开发者_如何学JAVAith both of them. How would you check that Bash autocompletion should be installed at all (check for /etc/bash_completion
, maybe?), and how would you install it with setup.py (preferably using setuptools)?
If you're going to require OS-level packages (i.e. bash-completion
), then you should distribute your library as an OS-level package. That is, in .deb
, .rpm
, etc. Some tips here:
- Debian New Maintainer's Guide
- Fedora Packaging Guidelines
As part of the package generation, you can call your setuptools
script to install the Python code. To ensure bash-completion
is installed, you can specify it is a required package.
You can use data_files
options:
from setuptools import setup
setup(
...
data_files=[
('/etc/bash_completion.d/', ['extra/some_completion_script']),
]
)
精彩评论