[Distutils] Help to create a setup.py (subdirectories aren't working)
John Posner
jjposner at optimum.net
Thu Mar 25 20:54:49 CET 2010
On 3/25/2010 7:21 AM, Tarek Ziadé wrote:
I'm a packaging newbie, but a long-time Python hobbyist programmer and a
longer-time tech writer. I'm planning to help with the cleanup of the
Hitchhiker's Guide.
>
>>> 1. Omit the package_dir option altogether
>>> 2. set packages = ['MyProject', 'MyProject.output', 'MyProject.modules']
>>> 3. Add an __init__.py in the MyProject directory, to make it the parent
>>> package
>>>
>>>
All of the above works for me, and now I'm proceeding to include PNG
image files in my project. Here's the project's directory structure:
setup.py
hibye
hibye\__init__.py
hibye\goodbye.py
hibye\hello.py
hibye\png
hibye\png\left_arrow.png
hibye\png\right_arrow.png
hibye\french
hibye\french\__init__.py
hibye\french\aurevoir.py
hibye\french\bonjour.py
hibye\french\french.jpg
And here's my setup.py:
from setuptools import setup
###from distutils.core import setup
###import distribute_setup; distribute_setup.use_setuptools()
setup(name = "hibye",
version = "6.7",
packages = ["hibye", "hibye.french"],
package_data = {
"hibye": ['png/left_arrow.png', 'png/right_arrow.png'],
"hibye.french": ['french.jpg'],
},
)
With this setup, it seems that "python setup.py bdist_egg" includes the
PNG files in the distribution, but "python setup.py sdist" does not. I
need to include a MANIFEST file to have the PNG files included in a
source distribution. Is that the correct functionality? If so, why the
difference?
Note: I'm doing my testing inside a virtualenv, on Win/XP SP3.
Tx,
John
More information about the Distutils-SIG
mailing list