469,593 Members | 1,984 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,593 developers. It's quick & easy.

distutils: package data

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?

Jul 18 '05 #1
3 1808
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?

Jul 18 '05 #2
Qiangning Hong wrote:
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:
from distutils import sysconfig
sysconfig.get_python_lib() '/usr/lib/python2.2/site-packages'
from distutils import sysconfig
sysconfig.get_python_lib() '/usr/lib64/python2.3/site-packages'
from distutils import sysconfig
sysconfig.get_python_lib()

'c:\\python24\\Lib\\site-packages'

Serge.

Jul 18 '05 #3
Qiangning Hong wrote:
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
Jul 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Isaac Jones | last post: by
1 post views Thread by Sridhar R | last post: by
8 posts views Thread by Johan Svedberg | last post: by
5 posts views Thread by Lonnie Princehouse | last post: by
15 posts views Thread by Colin J. Williams | last post: by
reply views Thread by Craig D | last post: by
1 post views Thread by Terry Hancock | last post: by
7 posts views Thread by Frans Englich | last post: by
5 posts views Thread by Fuzzyman | last post: by
7 posts views Thread by Eric S. Johansson | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.