Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 791
David Wolever Avatar asked Jul 15 '11 23:07

David Wolever


1 Answers

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.

like image 127
Keith Avatar answered Sep 28 '22 06:09

Keith