Error if package_dir has empty string as value

Issue #180 open
Anonymous created an issue

Hello everybody,

I have tons of old code which have the following (example) structure
joki@chimera /tmp/bug $ tree bug_package
|-- data
| |-- data1
| -- data2 |-- |--

1 directory, 5 files

My looks like this


from setuptools import setup
package_dir={'library' : ''},

If I execute this for example "python bdist_egg" the following error occurs.

python bdist_egg
running bdist_egg
running egg_info
creating library.egg-info
writing library.egg-info/PKG-INFO
writing top-level names to library.egg-info/top_level.txt
writing dependency_links to library.egg-info/dependency_links.txt
writing manifest file 'library.egg-info/SOURCES.txt'
writing manifest file 'library.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-i686/egg
running install_lib
running build_py
creating build
creating build/lib
creating build/lib/library
copying -> build/lib/library
copying -> build/lib/library
creating build/lib/library/ata
error: can't copy 'ata/data1': doesn't exist or not a regular file

I hunt the failure down to '_get_data_files' in commands/ After getting all files it cuts of the appropriate src_dir, because the src_dir is used separately

For my particular case where src_dir is empty the 'plen' is 1, BUT the files returned from find_data_files look like this



=> After stripping this list is 'broken'



Currently I have locally patched distribute which solves the issue.



diff -ur distribute_orginal/setuptools/command/ distribute/setuptools/command/
--- distribute_orginal/setuptools/command/ 2010-07-15 02:01:09.000000000 +0200
+++ distribute/setuptools/command/ 2010-09-17 12:19:29.000000000 +0200
@@ -108,7 +108,10 @@
build_dir = os.path.join(*([self.build_lib] + package.split('.')))

         # Length of path to strip from found files
  • plen = len(src_dir)+1
  • if src_dir == '':
  • plen = 0
  • else:
  • plen = len(src_dir)+1

         # Strip directory from globbed filenames
         filenames = [


I'm not sure if this is the best solution. Unfortunately I cannot change the layout of the packages :(

Comments (4)

  1. Leila Pearson

    Just a note to mention that I ran into this today too with distribute 0.6.14 (testing in a virtualenv). It looks like it was a but in distutils too a while back, but fixed there.

    When you only have a single package to install, it's nice to use this kind of package structure - with right in your package directory instead of one directory above - but that means you need to specify

    package_dir = {'mypackage' : ''}

    and this doesn't work currently

    - Leila

  2. Anonymous
  3. Log in to comment