473,396 Members | 1,775 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,396 software developers and data experts.

Creating an RPM which works with multiple Python versions?


Hi,

I'm developing an application which is primarily in Python but has
some C-coded extension modules. These modules aren't really useful to
anyone other than the main application. The app works fine with Python
2.2 or 2.3, so ideally I'd like to create one install package which
works with both.

I have installation largely working using distutils to create a source
tarfile and an RPM package. However I've noticed that the RPM installs
the extension libraries to /usr/lib/python2.2/site-packages, even if
python2.3 is the only version installed on the target machine - in the
latter case, my app won't work. If I move the files to the python2.3
lib dir, it all seems to work, except that I get a RuntimeWarning at
startup, indicating that the C libs were compiled against a different
Python API version.

What's recommended here? I can see 3 options:

1) Somehow convince RPM to install the extensions to the directory for
the version of Python that's installed. Any clues how?

2) Produce separate 2.2 and 2.3 packages. This is kind of a pain for
users, so I'd rather not if possible.

3) Install the modules somewhere unrelated to the python tree (eg
/usr/lib/appname-appver/ and change the python library path in the
app to find them.

Any suggestions?

Also, how can I tell if the RuntimeWarning is important? (and eliminate
it, if not?) I make fairly minimal use of the API and everything
*looks* like it works, but I don't want to risk memory corruption.

Thanks,
--
Edwin

Jul 18 '05 #1
3 1559
Edwin Young wrote:
2) Produce separate 2.2 and 2.3 packages. This is kind of a pain for
users, so I'd rather not if possible.
That is standard practise for distributing binary Python modules. Look
at wxPython, win32all etc
Any suggestions?


You could distribute your app as a whole without relying on an installed
Python or any other libraries.

If you want an example, have a look at dotamatic.sourceforge.net which
ships Windows, Linux and Mac "binaries". In the source, makedist.py
is the script that produces the right thing on each platform and
the help lists the components used.

Roger
Jul 18 '05 #2
Edwin Young wrote:
What's recommended here?


There is a fourth one: Install to /usr/lib/site-python. This
is a location that is shared across different Python releases.

Be careful not to put bytecode files into this location, since
bytecode files may become invalid across Python releases.

Regards,
Martin

Jul 18 '05 #3
"Martin v. Löwis" <ma****@v.loewis.de> writes:
[You can] Install to /usr/lib/site-python. This
is a location that is shared across different Python releases.

Be careful not to put bytecode files into this location, since
bytecode files may become invalid across Python releases.


It seems like "setup.py bdist_rpm" by default creates an archive
containing .pyc files, so the RPMs it creates are effectively bound to
a specific Python version, even if no C-coded extensions are involved.

However I believe that if the .pyc is for the wrong interpreter
version, Python will ignore it and use the .py instead, so the only
effect will be longer startup time.Can anyone confirm or deny?

--
Edwin

Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Tim Williams | last post by:
Hi. I'm using Python 2.3 and trying to use tkFileDialog to get a list of files. I get a message about the '-multiple' option is not a valid option in the call to Open. Python 2.3 (#1, Aug ...
12
by: Philip Smith | last post by:
Call this a C++ programmers hang-up if you like. I don't seem to be able to define multiple versions of __init__ in my matrix class (ie to initialise either from a list of values or from 2...
0
by: DPhelps | last post by:
I have a multithreaded Python shell server (base on the sample code 'pysvr.py') that uses a C-based extension class. The trouble I'm having is that I cannot figure out a way to create a Python...
4
by: Altramagnus | last post by:
I have 30 - 40 type of different window. For each type I need about 20 instances of the window. When I try to create them, I get "Error creating window handle" My guess is there is a maximum...
6
by: Adam Tilghman | last post by:
Hi all, I have found that IE doesn't seem to respect the <SELECT> "multiple" attribute when set using DOM methods, although the attribute/property seems to exist and is updated properly. Those...
5
by: David C. Ullrich | last post by:
Would there be issues (registry settings, environment variables, whatever) if a person tried to install versions 1.x and 2.x simultaneously on one Windows system? Windows 98, if it matters. (I...
5
by: Greg Corradini | last post by:
Hello All, I'm attempting to create multiple dictionaries at once, each with unique variable names. The number of dictionaries i need to create depends on the length of a list, which was returned...
3
by: Marcin Kalicinski | last post by:
How do I use multiple Python interpreters within the same process? I know there's a function Py_NewInterpreter. However, how do I use functions like Py_RunString etc. with it? They don't take any...
0
by: Steve Holden | last post by:
Glenn Linderman wrote: They are automatically rebuilt if they are from a different version of Python. This is why it isn't a good idea to share library modules between different versions. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.