1

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
4

1 回答 1

0

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

于 2012-06-27T14:09:41.887 回答