Default
Google
 



 
  pyMinGW home
  News
  Requirements
  How to install
  FAQ
  Download
  Known issues
  To do
  Programming
  MinGW
  SWIG
  PyPy
  Religious Studies
  Qur'an
  The Blue Letter Bible
  Dr. Zakir Naik
  Contact me

Site Meter


 






pyMinGW
Copyright © 2004-2005 Khalid A. Bakr

About pyMinGW

pyMinGW is a patch to Python source that aims to get Python to compile under MinGW.

Compiling Python in MinGW is not supported in the official Python distribution. This is not an official patch. It is not made for everyone. If you do not want to compile Python yourself or use a Python so compiled then download the official Windows distribution at Python's site.

This project is for those who need support for compiling, using, or distributing a Python built with MinGW.



pyMinGW News
  • May 25th, 2006. Cleaned and updated pyMinGW. It now supports the SVN Python 2.4 branch, and trunk (currently 2.5aX). As the latter now includes ctypes, emphasis was put on trying to get the latter to build under MinGW. Almost all ctypes' tests now pass, except the callbacks which are still crashing the interpreter. (See the known issues document).

    Tix now compiles under MinGW, and is included as part of all versions of pyMinGW's binary extension packages.

    There is also experimental support for producing Python binaries and Python extensions that are compatible with the standard distribution (please read disclaimer in pyMinGW's license).

  • Sept 28th, 2005. Updated pyMinGW to support Python 2.4.2 final. Please refer to the changes documents in the Download section below. Also released extension binaries.

  • Aug 19th, 2005. Made a binary distribution of pyMinGW-Python 2.4.1 Build 0.0.6.5 for those who cannot build the extensions. This is just a binary packaging of the March pyMinGW-241 release. See the Download section below.

  • Apr 13th, 2005. Access to the download files should now be okay. Working on updating the FAQ.

  • Old news. Click here for access to pyMinGW's old news.

pyMinGW System Requirements

The patch was first tested on Windows 98, MSYS-1.0.10, and GCC 3.2 (MinGW special) with the latest versions being tested with GCC 3.4.2 (MinGW special). In general, I see no reason why it should not work on Win95 or better, MSYS-1.0.10 or better, and GCC 3.2 (MinGW special) or better. Be careful that the candidate releases of MinGW can be unstable. The current release of MinGW (3.4.2 as of this writing) works fine.

My system:
  • gcc-core-3.4.2-20040916-1.tar
  • gcc-g++-3.4.2-20040916-1.tar
  • mingw-runtime-3.3.tar
  • w32api-3.2.tar
  • binutils-2.15.91-20040904-1.tar, patched with
    • GNU assembler 2.13
    • GNU ld 2.13
  • GNU make 3.80

How To Apply The Patch

In source form. pyMinGW patches several Python source files, C code and Python code. These, and the same is true for pyMinGW's binary distributions, are all zipped up in a zip file which, when extracted to the root of Python, will overwrite some of the original Python files in their respective directories. So a word of advice: keep backups.

Figure 1. below shows how the directory tree should look like in Python 2.3.5 final from CVS with all the extensions mentioned in \PCBuild\readme.txt living side by side with the Python source.

Figure 1. Directory structure for Python 2.3.5 Final. Some of the extensions are updated in Python 2.4+. Do refer to the file \PCBuild\readme.txt (in the Python sources) for more information.

Note how the extensions reside in the \dist directory which also houses the Python sources (src).
Figure 1.


Compiling the various extensions requires that you build the sources of the libraries that are needed to be linked by the Python extensions. For example to build the bz2 Python extension, you need to:
  1. Download the bzip2 source (link is in \PCBuild\readme.txt of the Python source archieve or from CVS/SVN)
  2. Build the bzip2 link library as per the instructions found in the bzip2 source.
  3. Run make.exe from within the MSYS prompt and inside the \MinGW directory (see build tree below) in one of the following three possibilities:
    • make python24.mak bz2
    • make bz2.mak all
    • make python24.mak all
If you downloaded the sources of all the subprojects and built all their link libraries and placed them as shown in Figure 1. (hopefully building them there) and hence plan on compiling and building all the Python extensions then issuing the command: make python24.mak all or make python23.mak all should suffice to build all the extensions in one go, although the other forms of the make command as mentioned above will still work if you need finer control.


Figure 2. Note how the MinGW directory must be a child of the root of the Python source directory (src). 

And so when you install/apply pyMinGW you must unzip it in the src directory of the Python distribution you are patching. 

Do not forget that figures 1 and 2 are taken from the Python 2.3.4 Final directory tree. The case should be similar for Python 2.4 although you must expect that some of the extensions would be updated as per the \PCBuild\readme.txt file.
Figure 2.


Figure 2. above shows where the \MinGW directory (which is the heart of the pyMinGW distribution) goes. This placing will be automatically done by the unzipping procedure. You only need to specify that you want to unzip the pyMinGW package to the \src subdirectory of the Python source you are patching. The unzipping program will then create the \MinGW directory in the \src directory and will also patch all of the needed files to get Python to compile under MinGW.

Python source archieve vs. source from CVS/SVN. Please note that if you downloaded the Python source archieve (as opposed to the source from CVS/SVN) that your extracted Python source might not have a \src directory. If that is the case make sure that you extract the pyMinGW package where the \PCBuild, \PC, and \Include directories reside.

For more details, read the instructions in the readme file included in the pyMinGW source package (location: \MinGW\Readme.txt) on how to apply the patch, and how to build Python with MinGW.

Using binary distributions . If you are using the binary distributions then simply extract the packaged file to the root of your local Python directory, that is to where the \PCBuild, \PC, \Lib, and \Include directories reside.

This will create the \MinGW directory which will contain the Python binaries and at the same time patch several Python source files, all distutils related. To use your MinGW compiled Python, change directory to where the new MinGW directory is and type python at the prompt.


Upgrading from an earlier version. If you are upgrading from an earlier version of pyMinGW then you should not have a problem if you used the same directory tree structure as shown above. You can always of course delete the old MinGW directory and start fresh. Or you can simply extract the new pyMinGW version to the root of Python source- like you did before- and everything should be okay.

If you used earlier versions of pyMinGW which used a different directory structure than the one mentioned above, then apply pyMinGW first and then simply cut and paste the subprojects' directories until your local Python source tree looks like the one shown above. If, on the other hand, you were brave enough to play with other Python source files not modified by the patch, then (just to be safe) you should get a fresh copy of Python source to apply pyMinGW to. You should always keep that fresh copy handy in case you need a clean start to the Python build procedure.


Standalone pyMinGW Patches to Python Source

  1. The pyMinGW-250 source patch, version 0.0.6.8
    • Needs an update.
    • The pyMinGW-243 source patch, version 0.0.6.7
      • Needs an update.
      • The pyMinGW-235 source patch, version 0.1.7.7
        • Needs an update.

Binary Distributions of MinGW Compiled Python

  1. For Python 2.5a2:
  2. For Python 2.4.3:
  3. For Python 2.3.5:
Known Issues

You can read about the known issues here.


Contact me

If you find pyMinGW useful or even frustrating, drop me a line and tell me about it.









Back to top

Copyright © 2004-2006 Khalid A. Bakr. All Rights Reserved.


Acquiring image from ProHosting Banner Exchange