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

Alexandre Gauthier alex at underwares.org
Wed Oct 3 03:43:41 CEST 2007


Alexandre Gauthier a écrit :
> 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
>
>   
*snip*

Bad practice to reply to myself, but I think I just figured it out. the 
problem lies in the fact that I did not specify package_dir, which 
_magically makes any paths in package_data relative to that_. I didn't 
know that! :) I wish the build process would complain about wrongly 
referred files, though...

Thanks for your help :)


More information about the Distutils-SIG mailing list