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

时间:2015-04-25 01:50:17

标签: python-2.7 setuptools python-module pypi

嗨我正在开发一个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'
             ]
)

1 个答案:

答案 0 :(得分:1)

我想我已经有了这个。在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