How can I write setup.py
so that:
- The binary egg distribution (
bdist_egg
) includes a sample configuration file and
- Upon installation puts it into the
{prefix}/etc
directory?
A sample project source directory looks like this:
bin/
myapp
etc/
myapp.cfg
myapp/
__init__.py
[...]
setup.py
The setup.py looks like this:
from distutils.command.install_data import install_data
packages = ['myapp', ]
scripts = ['bin/myapp',]
cmdclasses = {'install_data': install_data}
data_files = [('etc', ['etc/myapp.cfg'])]
setup_args = {
'name': 'MyApp',
'version': '0.1',
'packages': packages,
'cmdclass': cmdclasses,
'data_files': data_files,
'scripts': scripts,
# 'include_package_data': True,
'test_suite': 'nose.collector'
}
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(**setup_args)
setuptools are installed in both the build environment and in the installation environment.
The 'include_package_data'
commented out or not does not help.
question from:
https://stackoverflow.com/questions/10456279/python-setuptools-how-to-include-a-config-file-for-distribution-into-prefix-e 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…