distutils: package data

Q

Qiangning Hong

I am writing a setup.py for my package. I have a pre-compiled
myextmod.pyd file in my package and I want the distutils to
automatically copy it to
C:\Python23\Lib\site-packages\mypackage\myextmod.pyd.

I try to add the following parameter to setup():

data_file = [('mypackage', ['mypackage/myextmod.pyd'])],

but it installs the pyd file to C:\Python23\mypackage\myextmod.pyd,
this is not what I want.

And I don't want to specify the path in data_file to the absolution
path 'C:\Python23\Lib\site-packages\mypackage', for portability, of
course.

Any hints?
 
Q

Qiangning Hong

ehh.. I did a little more reading and found that this function can be
easily done by the new distutils parameter "package_data" in 2.4.

However, I am using python2.3 :(

So, my question becomes: how to emulate the package_data function in
python 2.3?
 
S

Serge Orlov

Qiangning said:
ehh.. I did a little more reading and found that this function can
be easily done by the new distutils parameter "package_data" in 2.4.

However, I am using python2.3 :(

So, my question becomes: how to emulate the package_data function in
python 2.3?

There is distutils.sysconfig.get_python_lib() that works at least
since 2.2:
'/usr/lib/python2.2/site-packages'
'/usr/lib64/python2.3/site-packages'
'c:\\python24\\Lib\\site-packages'

Serge.
 
D

David Fraser

Qiangning said:
I am writing a setup.py for my package. I have a pre-compiled
myextmod.pyd file in my package and I want the distutils to
automatically copy it to
C:\Python23\Lib\site-packages\mypackage\myextmod.pyd.

I try to add the following parameter to setup():

data_file = [('mypackage', ['mypackage/myextmod.pyd'])],

but it installs the pyd file to C:\Python23\mypackage\myextmod.pyd,
this is not what I want.

And I don't want to specify the path in data_file to the absolution
path 'C:\Python23\Lib\site-packages\mypackage', for portability, of
course.

Any hints?
Actually you probably want to look at describing the .pyd as an
Extension. Then you can even give distutils the instructions to build
it, and as a side effect you can install it to the right location
This may not be what you want though

David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,968
Messages
2,570,154
Members
46,702
Latest member
LukasConde

Latest Threads

Top