Python 自定义模块安装不会复制静态文件



嗨,我正在开发一个 python 模块,当我使用 python setup.py sdist bdist_egg 创建安装包时,所有文件都包含在 zip 文件中,但是当我运行python setup.py install时,除了静态文件外,所有文件都被复制。整个项目正在进行中:

https://github.com/efirvida/python-gearbox

我的 setup.py

from setuptools import setup, find_packages
version = '0.1.0a'
setup(
    name='python-gearbox',
    version=version,
    author='Eduardo M. Firvida Donestevez',
    packages=find_packages(),
    include_data_package=True,
    author_email='efirvida@gmail.com',
    description='Python library for gear transmission design',
    requires=['numpy', 'scipy'],
    url='https://github.com/efirvida/python-gearbox',
    download_url='https://github.com/efirvida/python-gearbox/archive/master.zip',
    keywords=['gearbox', 'gear', 'agma', 'iso', 'gear transmission', 'engineering'],
    platforms='any',
    license='MIT',
    zip_safe=False,
    classifiers=['Intended Audience :: Developers',
             'Intended Audience :: Manufacturing',
             'Intended Audience :: Science/Research',
             'Natural Language :: English',
             'Programming Language :: Python',
             'Programming Language :: Python :: 2.7',
             'Topic :: Scientific/Engineering',
             'Topic :: Scientific/Engineering :: Human Machine Interfaces',
             'Topic :: Software Development',
             'Topic :: Software Development :: Libraries',
             'Topic :: Software Development :: Libraries :: Application Frameworks'
             ]
)

我想我已经有了这个。在您的setup.py变化中

 include_data_package=True,

到:

 include_package_data=True

如果你在做python setup.py install时查看日志,你会发现线索:

/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: 
UserWarning: Unknown distribution option: 'include_data_package'

此外,我还对MANIFEST.in进行了一些修改,以使其更清晰:

include Makefile CHANGES LICENSE AUTHORS README 
recursive-include gearbox/doc/source *.rst
recursive-include gearbox/export/templates *
recursive-exclude gearbox *.pyc

最新更新