对于我的distutils包,不会复制yaml文件以及python文件
setup.py
from distutils.core import setup
files = ["*.yaml", "package/*"]
setup(name = "mypackage",
version = "0.1",
description = "description",
author = "Ciasto",
author_email = "[email protected]",
packages = ['package'],
package_data = {'package' : files },
scripts = ["scripts/runner"],
)
这是项目目录结构:
$ tree package/
|____
| |______init__.py
| |____command.py
| |____constants.py
| |____controller.py
| |____utils.py
| |____model.py
| |____products.yaml
package_data
用于将包装的数据添加到鸡蛋(不推荐使用)和车轮(不包含distutils
)中。您可能正在生成源代码分发(sdist)。
对于sdist,您需要文件MANIFEST.in
(在setup.py
之外创建它)。在您的情况下,在其中一行就足够了:
include package/*.yaml
请参阅https://docs.python.org/3/distutils/sourcedist.html#specifying-the-files-to-distribute处的文档
和
https://packaging.python.org/guides/using-manifest-in/#using-manifest-in
如果您不打算创建轮子,则可以从files
中安全地删除package_data
和setup.py
。