473,720 Members | 2,800 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Python 2.4, distutils, and pure python packages

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 will fail.

It's likely that nothing can be done about this (although for a pure
python package there's no reason not to use the 'source distribution'
and the setup.py). It does mean that I have to build my windows
installer on a machine with python 2.3.

Regards,

Fuzzy
http://www.voidspace.org.uk/python/index.shtml

Jul 18 '05 #1
5 2691
[CC to python-dev]
"Fuzzyman" <fu******@gmail .com> writes:
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.
Nitpicking - it's MSVC 7.1, aka MS Visual Studio .NET 2003, and it's
msvcr71.dll.
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 will fail.
Bummer.
It's likely that nothing can be done about this (although for a pure
python package there's no reason not to use the 'source distribution'
and the setup.py). It does mean that I have to build my windows
installer on a machine with python 2.3.


There's a workaround, although ugly.

bdist_wininst has a --target-version flag which allows to build an
installer for another Python version. It works both for pure Python
packages, and for (how are they called? non-pure?) packages containing
compiled extensions. The 2.4 distutils package has all that is needed
to create a installer running with python 2.3 or maybe even 2.2 (which
uses msvcrt.dll instead of msvcr71.dll). The result, of course, is that
the installer can only install for the version that you specified at
build time.

Because distutils cannot cross-compile extensions for other versions,
you must have build extensions (if there are any to include) with the
other Python version before - distutils will simply pick up the
extensions it finds in build subdirectories for the other version.

Anyway, whether you have extensions or not, you must also specify the
--skip-build command line flag, distutils will complain if you don't.
So, for a pure distribution you would typically run these commands to
build separate installers for 2.3 and 2.4:

\python24\pytho n setup.py --skip-build --target-version 2.3 bdist_wininst
\python24\pytho n setup.py --skip-build --target-version 2.4 bdist_wininst

and for non-pure packages you must compile with each version before
building the installer (if you want for some reason to use python 2.4
to build the installer for 2.3):

\python24\pytho n setup.py build_ext
\python23\pytho n setup.py build_ext

\python24\pytho n setup.py --skip-build --target-version 2.3 bdist_wininst
\python24\pytho n setup.py --skip-build --target-version 2.4 bdist_wininst

OTOH, it's no problem to install both python 2.3 and python 2.4 in
separate directories on the same machine and always make native builds.

--

To make this story even more complete, there have been also other
bugs caused by the different runtime dlls used in 2.3 and 2.4, most
only showing when you use the --install-script option. The installer
was using msvcrt.dll and msvcr71.dll at the same time, which led to
crashes when the install script was started - the PythonCard installer
suffered from that, at least. The bug only occurred with pure python
distributions, because then the dll problem occurred.

The bug is solved in Python 2.3.5, and also in the 2.4.1 release which
will be out soon, with one exception: if the install-script prints
something the output will be lost instead of displayed on the last
screen. At least that's better than crashing the process.
Thomas
Jul 18 '05 #2
Thomas Heller wrote:
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 will fail.

Bummer.

I wonder whether it would be better to continue linking wininst.exe with
mscvrt40.dll, and use that regardless of the version used to build Python.

Alternatively, we could try to get rid of the C library altogether for
wininst.exe. For install.c, this should be possible: it primarily uses
*printf, which can be replaced with FormatMessage. The challenge, of
course, is zlib. This could be replaced with lz32, but I doubt this
would improve anything. Alternatively, we could load zlib.pyd from the
target system, but that would be tedious, I guess. OTOH, it might to
replace extract.c largely with Python source code, and run this in
an interpreter...

Regards,
Martin
Jul 18 '05 #3

Thomas Heller wrote:
[CC to python-dev]
"Fuzzyman" <fu******@gmail .com> writes:
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.


Nitpicking - it's MSVC 7.1, aka MS Visual Studio .NET 2003, and it's
msvcr71.dll.


Sorry - my mistake !
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 will fail.


Bummer.
It's likely that nothing can be done about this (although for a pure python package there's no reason not to use the 'source distribution' and the setup.py). It does mean that I have to build my windows
installer on a machine with python 2.3.


There's a workaround, although ugly.


[snip..] Yuck ! Distributing different versions of a pure python
package :-) As I maintain a 2.3 machine as well, it's not too bad for
me. I posted this mainly for the reference of others.

Thanks for your reply Thomas.

Regards,

Fuzzyman
http://www.voidspace.org.uk/python/index.shtml

Jul 18 '05 #4
"Martin v. Löwis" <ma****@v.loewi s.de> writes:
Thomas Heller wrote:
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 will fail.

Bummer.

I wonder whether it would be better to continue linking wininst.exe with
mscvrt40.dll, and use that regardless of the version used to build Python.

Alternatively, we could try to get rid of the C library altogether for
wininst.exe. For install.c, this should be possible: it primarily uses
*printf, which can be replaced with FormatMessage. The challenge, of
course, is zlib. This could be replaced with lz32, but I doubt this
would improve anything. Alternatively, we could load zlib.pyd from the
target system, but that would be tedious, I guess. OTOH, it might to
replace extract.c largely with Python source code, and run this in
an interpreter...


I had something similar in my mind for quite some time. zlib.pyd would be
used automatically if the extraction is done in Python code - when
bdist_wininst was written, Python didn't have the zipfile module.

It would be for 2.5, anyway, and I have hoped that bdist_wininst would
be replaced by bdist_msi then ;-). What are your plans for that?

Although I'm wondering if it would be possible to run bdist_msi on linux
systems for pure Python distributions - some people are doing that with
bdist_wininst afaik.

Thomas
Jul 18 '05 #5
Thomas Heller wrote:
It would be for 2.5, anyway, and I have hoped that bdist_wininst would
be replaced by bdist_msi then ;-). What are your plans for that?


I still hope to write one by for 2.5.

One issue is that you cannot have multiple installations of an MSI
package. So if you want to support different Python installations
on the same machine, you have to clone the MSI file, and change the
product code - or provide multiple MSI files in the first place.

So I guess bdist_wininst would continue to provide a value to
certain users, as you can have as many installations of it as
you want (but then, it doesn't allow to select a target directory,
so you can have only as many installations as you find in the
registry).

Regards,
Martin
Jul 18 '05 #6

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

Similar topics

3
2061
by: Matt Shomphe | last post by:
Are there any guidelines for packaging a pure python module? Specifically, say I have a set of 10 functions, all of varying behaviors (no unifying theme to bind them together into clear subsets), that I would like to make available to others. What is the best structure for the distributed module? A single file called "functions.py" that people can put in "site-packages"? A subdirectory called "MyFunctions" with an "__init__.py" and the...
29
2459
by: Stephen Ferg | last post by:
I am a very satisfied user of Python and have been for number of years. I would never willing use another language. I wish all good things for Python, and that moves me to express some thoughts about Python's future prospects. I submit that the future expansion of Python usage is constrained by Python's lack of a CPAN-like facility, and I submit that without a CPyAN Python will never even get close to achieving the degree of...
8
2071
by: Georg Brandl | last post by:
Hello c.l.py, what features would you expect of a Python package manager, similar to CPAN or rubygems? I am currently planning to write such a thing, at first privately for myself, and if it's proving useful, I think about releasing it. I plan to model it after gentoo's portage, with less features of course. Would this be acceptable?
15
3222
by: kyosohma | last post by:
Hi, I am trying to get a small group of volunteers together to create Windows binaries for any Python extension developer that needs them, much like the package/extension builders who volunteer their time to create Linux RPMs. The main thing I need are people willing to test the binaries to make sure the extension is stable. This would require installing the binary and probably downloading the source too to get the developer's test
9
2096
by: pythonewbie | last post by:
Hi all, I am newbie in Python, my wish would be to create python applications for both Linux/Win32. I am stucked on creating a function to get the Python install directory (and site-packages directory) with a 100% reliable method... My goal is to verify if an/several extension(s) are installed and to automatically install the missing ones on Linux or Win32.
4
3379
by: Alia Khouri | last post by:
Can we open up the discussion here about how to improve setuptools which has become the de facto standard for distributing / installing python software. I've been playing around with ruby's gems which seems to be more more mature and usable. From my perspective, the relative immaturity of setuptools and its simultaneous widespread use is a clear python weakness and can make python less easy to absorb than it should be. A few...
0
8833
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9365
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...
1
9126
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9055
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
6661
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
5972
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4482
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
3186
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
2567
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.