distutils不会在windows上安装package_data

时间:2012-06-26 22:35:45

标签: python windows distutils

我的setup.py为我的一个项目提供了以下一行(完整版) 问题底部的脚本):

import os
from distutils.core import setup

# ...

setup(
    # ...
    package_data={
        'mesh.binding': ['templates/*'],
        'mesh.documentation': ['templates/*'],
    },
    # ...
)

这会将mesh/binding/templates的内容安装到 Linux和OS X上的site-packages/mesh/binding/templates目录,但确实如此 在Windows上没有成功。 如何让它在Windows上运行?

我是distutils的新手,所以请原谅我,如果我忘了重要的事情。 我正在使用setuptools 0.6python 2.7

相关文件

setup.py

import os
from distutils.core import setup

version = '1.0.0'
try:
    revision = os.environ['REVISION']
except Exception:
    pass
else:
    version = revision

packages = []
for root, dirs, files in os.walk('mesh'):
    if '__init__.py' in files:
        packages.append(root.replace('/', '.'))

setup(
    name='mesh',
    version=version,
    description='A declarative RESTful API framework.',
    author='Jordan McCoy',
    author_email='mccoy.jordan@gmail.com',
    license='BSD',
    url='http://github.com/siq/mesh',
    packages=packages,
    package_data={
        'mesh.binding': ['templates/*'],
        'mesh.documentation': ['templates/*'],
    },
    classifiers=[
        'Development Status :: 3 - Alpha',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: BSD License',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Topic :: Software Development :: Code Generators',
        'Topic :: Software Development :: Libraries :: Application Frameworks',
        'Topic :: Software Development :: Libraries :: Python Modules',
    ]
)

MANIFEST.in

recursive-include mesh/binding/templates *.tmpl
recursive-include mesh/documentation/templates *.tmpl
include LICENSE
include requirements.txt
include *.rst
recursive-include tests *.py
recursive-include examples *.rst *.py
include docs/conf.py docs/Makefile
recursive-include docs *.rst
recursive-include docs/_static *.css
recursive-include docs/_templates *.html

1 个答案:

答案 0 :(得分:0)

我发现的最佳解决方案就是在我的构建中添加一个额外的步骤....这是一个无赖,但我不知道另一种方式。