[Distutils] problem with sdist for nested packages

Doug Hellmann doug.hellmann at gmail.com
Wed Sep 8 13:34:41 CEST 2010


I'm having some problems creating an sdist for a nested package where some of the levels only include __init__.py and the subdirectories.  The full list of files is fairly long, but here's a snippet to give you an idea of the layout for the inputs:

PyMOTW/xml
PyMOTW/xml/__init__.py
PyMOTW/xml/etree
PyMOTW/xml/etree/__init__.py
PyMOTW/xml/etree/ElementTree
PyMOTW/xml/etree/ElementTree/__init__.py
PyMOTW/xml/etree/ElementTree/ElementTree_create.py
PyMOTW/xml/etree/ElementTree/...

When I build the sdist, I get:

build/lib/PyMOTW/xml
build/lib/PyMOTW/xml/etree
build/lib/PyMOTW/xml/etree/ElementTree
build/lib/PyMOTW/xml/etree/ElementTree/__init__.py
build/lib/PyMOTW/xml/etree/ElementTree/ElementTree_create.py
build/lib/PyMOTW/xml/etree/ElementTree/...

The __init__.py at the "xml" and "xml/etree" levels are not included.  As a result, the sdist won't install because it wants to populate a PyMOTW.ElementTree package but the directory doesn't exist.  I also tried adding other .py files at those levels in the directory structure (in case an "empty" directory was being ignored), but that had no effect.

The traceback I get trying to install the sdist is:

Traceback (most recent call last):
  File "setup.py", line 7, in <module>
    paver.tasks.main()
  File "paver-minilib.zip/paver/tasks.py", line 621, in main
  File "paver-minilib.zip/paver/tasks.py", line 604, in _launch_pavement
  File "paver-minilib.zip/paver/tasks.py", line 569, in _process_commands
  File "paver-minilib.zip/paver/setuputils.py", line 146, in __call__
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/Users/dhellmann/.virtualenvs/pymotwtest/lib/python2.7/site-packages/distribute-0.6.10-py2.7.egg/setuptools/command/install.py", line 71, in run
    _install.run(self)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/install.py", line 563, in run
    self.run_command('build')
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/build.py", line 127, in run
    self.run_command(cmd_name)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/Users/dhellmann/.virtualenvs/pymotwtest/lib/python2.7/site-packages/distribute-0.6.10-py2.7.egg/setuptools/command/build_py.py", line 77, in run
    self.build_packages()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/build_py.py", line 366, in build_packages
    modules = self.find_package_modules(package, package_dir)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/build_py.py", line 218, in find_package_modules
    self.check_package(package, package_dir)
  File "/Users/dhellmann/.virtualenvs/pymotwtest/lib/python2.7/site-packages/distribute-0.6.10-py2.7.egg/setuptools/command/build_py.py", line 192, in check_package
    init_py = _build_py.check_package(self, package, package_dir)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/build_py.py", line 191, in check_package
    "package directory '%s' does not exist" % package_dir)
distutils.errors.DistutilsFileError: package directory 'PyMOTW/ElementTree' does not exist

Has anyone seen this problem before?

Thanks,
Doug



More information about the Distutils-SIG mailing list