[Distutils] Distutils ignoring INSTALL_SCHEMES (or: How to put data files in PURELIB)

Alexandre Gauthier alex at underwares.org
Wed Oct 3 03:29:59 CEST 2007

Phillip J. Eby a écrit :
> At 01:53 PM 10/2/2007 -0400, Alexandre Gauthier wrote:
>> Phillip J. Eby a écrit :
>>> At 12:01 PM 10/2/2007 -0400, Alexandre Gauthier wrote:
>>>> Hello there. I'm currently trying to package python bindings for a
>>>> library. The bindings are currently compiled in an obscure way, so 
>>>> I end
>>>> up with the following
>>>> libmylib\__init__.py
>>>> libmylib\mylib.pyd
>>>> libmylib\dep.dll
>>>> mylib.py
>>>> Where mylib.py is the SWIG interface for mylib.pyd.
>>>> Since I cannot have distutils compile the bindings at all, I'd like to
>>>> just install the pyd and dll as "data files" along with the .py in
>>>> "site-packages". That can be accomplished with the following:
>>>> for scheme in INSTALL_SCHEMES.values():
>>>>     scheme['data'] = scheme['purelib']
>>> Don't do this.  If you are using Python 2.4 or above, use this 
>>> option in setup():
>>> setup(
>>>     package_data = {'mylib': ['mylib.pyd', 'dep.dll']},
>>>     ...
>>> )
>> Thanks, but I tried this as well, and it doesn't seem to work...
>> setup(
>>    .......
>>    py_modules = ['mylib'],
>>    packages = ['libmylib'],
>>    package_data = {'libmylib': ['_mylib.pyd', 'dep.dll']},
>> )
>> It only installs the package, the module but the two files I 
>> specified are nowhere to be found...
>> Perhaps I am doing something wrong....?
> Did you delete the build/ directory and re-build?
Yes I did, I also added a MANIFEST.in file including *.dll and *.pyd. It 
doesn't seem to work at all! The package_data section seems to have 
absolutely no effect! This is the output:

 >python setup.py bdist_wininst

running bdist_wininst
running build
running build_py
creating build
creating build\lib
copying mylib.py -> build\lib
creating build\lib\libmylib
copying libmylib\__init__.py -> build\lib\libmylib
installing to build\bdist.win32\wininst
running install_lib
creating build\bdist.win32
creating build\bdist.win32\wininst
creating build\bdist.win32\wininst\PURELIB
creating build\bdist.win32\wininst\PURELIB\libmylib
copying build\lib\libmylib\__init__.py -> 
copying build\lib\mylib.py -> build\bdist.win32\wininst\PURELIB
running install_egg_info
creating 'c:\docume~1\supern~1\locals~1\temp\2\tmpr379bd.zip' and adding 
'.' to
adding 'PURELIB\mylib.py'
adding 'PURELIB\mylib_python_bindings-1.0.3-py2.5.egg-info'
adding 'PURELIB\libmylib\__init__.py'
creating dist
removing 'build\bdist.win32\wininst' (and everything under it)

More information about the Distutils-SIG mailing list