2015-04-25 42 views
0

您好我正在開發一個python模塊,當我使用python setup.py sdist bdist_egg創建安裝包時,所有文件都包含在zip文件中,但是當我運行python setup.py install時,所有文件都被複制靜態文件。 整個項目是:Python自定義模塊安裝不會複製靜態文件

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='[email protected]', 
    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' 
      ] 
) 
+0

什麼是你正在談論的靜態文件? – skyline75489

+0

該模塊在該文件夾上有一個文件夾'gearbox \ export \ templates',在運行安裝時有3個文件xxx.template,這個文件不會被複制到模塊'site-package/<模塊文件夾>'甚至是生成文件夾,但是他們在'python setup.py sdist' – efirvida

回答

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 
+0

謝謝!很多!!這是我第一次發蟒蛇包 – efirvida

+0

樂意幫忙。查看日誌始終是調試的好方法。 – skyline75489

+0

即時學習:) – efirvida