This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: distutils package_dir/package_data failure
Type: behavior Stage:
Components: Distutils Versions: Python 3.0, Python 3.1, Python 2.7, Python 2.6
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: tarek Nosy List: fma, tarek
Priority: normal Keywords:

Created on 2008-06-03 13:06 by fma, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg67659 - (view) Author: (fma) Date: 2008-06-03 13:06
For python2.4:
Python 2.4.4 (#2, Apr 15 2008, 23:43:20)
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2

The distutils documentation says to use an empty string in the 
setup() 'package_dir' param. for current dir. It works fine for python 
modules, but it fails when using 'package_data' param. For example:

.
|-- __init__.py
|-- module1.py
|-- module2.py
|-- setup.py
`-- view
    |-- __init__.py
    |-- module3.glade
    |-- module3.py
    |-- module4.glade
    `-- module4.py

setup.py:

from distutils.core import setup
setup(name='my_package',
      package_dir={'my_package': ''},
      packages=['my_package', 'my_package.view'],
      package_data={'my_package': ['view/*.glade']}
)

$ python setup.py build
running build
running build_py
creating build
creating build/lib
creating build/lib/my_package
copying module1.py -> build/lib/my_package
copying module2.py -> build/lib/my_package
copying __init__.py -> build/lib/my_package
creating build/lib/my_package/view
copying view/module3.py -> build/lib/my_package/view
copying view/module4.py -> build/lib/my_package/view
copying view/__init__.py -> build/lib/my_package/view
creating build/lib/my_package/iew
error: can't copy 'iew/module3.glade': doesn't exist or not a regular 
file

To correct this, '.' should be used instead of the empty string:

from distutils.core import setup
setup(name='my_package',
      package_dir={'my_package': '.'},
      packages=['my_package', 'my_package.view'],
      package_data={'my_package': ['view/*.glade']}
)

Note that the empty string works fine on python2.5:
Python 2.5.2 (r252:60911, Apr 17 2008, 13:15:05)
[GCC 4.2.3 (Debian 4.2.3-3)] on linux2
msg81246 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2009-02-06 01:36
will test it on 2.6 (no more fixed for 2.4/2.5)
msg81249 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2009-02-06 08:17
works, and even tested in test_build_py.test_empty_package_dir
History
Date User Action Args
2022-04-11 14:56:35adminsetgithub: 47281
2009-02-06 08:17:28tareksetstatus: open -> closed
messages: + msg81249
2009-02-06 01:36:09tareksetassignee: tarek
resolution: wont fix
messages: + msg81246
nosy: + tarek
versions: + Python 2.6, Python 3.0, Python 3.1, Python 2.7, - Python 2.4
2008-06-03 13:06:07fmacreate