473,326 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

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 1896
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Isaac Jones | last post by:
Hello Python Community. I bring greetings from the Haskell community (http://www.haskell.org) ;) There has been a lot of discussion of late about creating a grand-unified build & distribution...
1
by: Sridhar R | last post by:
I learnt that distutils can be used to package python modules and packages. Fine it does that well. Suppose I am writing an python application (not package or module), and suppose that I am...
8
by: Johan Svedberg | last post by:
Hi! I just started playing around with Distutils and there is one thing I could use some help with. I'm wondering if there is some convenient way to access the directories where the data_files...
5
by: Lonnie Princehouse | last post by:
I'm in a situation where I need to distribute several interdependent Python packages. There are good reasons not to combine them all into one package. Distutils doesn't seem to be able to bundle...
15
by: Colin J. Williams | last post by:
The distutils download page has: -------------------------------------------------------- Current stable release The current stable release is Distutils 1.0.2; you can download it as: *...
0
by: Craig D | last post by:
I got really tired of unpacking a distutils package, installing then cleaning up. So I wrote distinstall.py - it reads a zip file, unpacks it, installs the bits and cleans up. I've only used it on...
1
by: Terry Hancock | last post by:
Some time ago, I got the idea that I wanted to build image resources from vector graphic originals, instead of marshalling hundreds of tiny little icon images by hand. I wrote "BuildImage" to do...
7
by: Frans Englich | last post by:
This is silly. How do I access data files I've installed with distutils? In a portable, generic way, I want to find out what is the following path on most systems: ...
5
by: Fuzzyman | last post by:
Python 2.4 is built with Microsoft Visiual C++ 7. This means that it uses msvcr7.dll, which *isn't* a standard part of the windows operating system. This means that if you build a windows installer...
7
by: Eric S. Johansson | last post by:
is there anyway I can, in a setup.py file, set and internal equivalent to the '--install-scripts' commandline option? script installation directory but I don't want on the command line where...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.