473,756 Members | 3,973 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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\mypack age\myextmod.py d.

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

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

but it installs the pyd file to C:\Python23\myp ackage\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\Li b\site-packages\mypack age', for portability, of
course.

Any hints?

Jul 18 '05 #1
3 1913
ehh.. I did a little more reading and found that this function can be
easily done by the new distutils parameter "package_da ta" 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_da ta" 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.sysco nfig.get_python _lib() that works at least
since 2.2:
from distutils import sysconfig
sysconfig.get_p ython_lib() '/usr/lib/python2.2/site-packages'
from distutils import sysconfig
sysconfig.get_p ython_lib() '/usr/lib64/python2.3/site-packages'
from distutils import sysconfig
sysconfig.get_p ython_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\mypack age\myextmod.py d.

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

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

but it installs the pyd file to C:\Python23\myp ackage\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\Li b\site-packages\mypack age', 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
1977
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 system for "3rd party" Haskell libraries (those not distributed with the compilers). Python's Distutils has come up a few times. The Haskell Library Infrastructure Project's web page is just a wiki page which can be found here:...
1
1241
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 using Linux. Where should I install the python source files and bin scripts and data in my /usr directory? Should the python (.py) files go into /usr/lib/pythonXX/site-packages or /usr/lib/myapp or /usr/share/myapp ?
8
1745
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 was installed? -- Johan Svedberg, johan@svedberg.pp.se, http://johan.svedberg.pp.se/
5
1879
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 a heterogeneous mix of multiple packages and modules, and so I've currently got people launching three installers in the proper sequence in order to get software installed, which seems needlessly complicated and confusing. There must be a better...
15
4123
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: * Distutils-1.0.2.tar.gz (source distribution) (233k) * Distutils-1.0.2.zip (source distribution) (274k) * Distutils-1.0.2.win32.exe (Windows installer) (187k)
0
1447
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 windows and Linux and for pure Python packages. Windows: distinstall.py Photronics.zip Linux: python distinstall.py Photronics.zip Hopefully somebody else will find it useful. #======================== distinstall.py =====================
1
1718
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 this for me, and so far, it works very well, so I'm trying to make it easier to use and available to more developers. There is a brief (and somewhat dated) tutorial explaining what BuildImage itself does at:
7
2305
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: /usr/local/lib/python2.4/lib/site-packages/foo/bar.txt How do I figure out the rest, if I know foo/bar.txt? sys.prefix doesn't get me far. I've googled, and looked in the python reference. I must be blind if the
5
2693
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 using distutils - it *requires* msvcr7.dll in order to run. This is true even if your package is a pure python package. This means that when someone tries to use a windows installer created with Python 2.4, on a machine with only python 2.3 - it...
7
1541
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 things can go horribly wrong if the user forgets. I would like to create a new default setting for this commandline option as well as a couple of other such as the data default directory. --- eric
0
9271
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10031
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9869
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9708
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7242
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5140
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3805
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3354
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2665
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.