setuptools: data files included with `bdist` but not with `sdist`

爱⌒轻易说出口 提交于 2019-12-21 09:14:34

问题


I've got a setup.py file which looks like this:

#!/usr/bin/env python
from setuptools import setup, find_packages

setup(
    name="foo",
    version="1.0",
    packages=find_packages(),
    include_package_data=True,
    package_data={
        "": ["*"],
    },
)

And a package foo which looks like this:

foo/__init__.py
foo/bar.txt

When I run setup.py bdist, the bar.txt file is (correctly) included in the distribution… But when I use setup.py sdist it isn't.

What's up with that? Am I misunderstanding the meaning of package_data? Or is this a quirk of setuptools?


回答1:


There are different sources for selecting those files. The package_data is used for installing from the source tree. The build a source package you also need a MANIFEST.in file. It should contain something like recursive-include *.txt, or whatever you need.



来源:https://stackoverflow.com/questions/6714145/setuptools-data-files-included-with-bdist-but-not-with-sdist

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!