This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: fails for latest MinGW releases.
Type: behavior Stage:
Components: Distutils Versions: Python 2.5
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: jlt63 Nosy List: amaury.forgeotdarc, benjamin.peterson, jafo, jamartinh, jlt63, kermode, wmbrown
Priority: normal Keywords: easy, patch

Created on 2008-03-04 18:43 by kermode, last changed 2022-04-11 14:56 by admin. This issue is now closed.

File name Uploaded Description Edit
cygwinccompiler.patch kermode, 2008-03-04 18:43 unified patch for file
Messages (16)
msg63257 - (view) Author: Lenard Lindstrom (kermode) Date: 2008-03-04 18:43
The module for distutils on Pythons 2.5 and 2.4 fails
with an exception for the latest MinGW tools.

running build_ext
Traceback (most recent call last):
  File "", line 224, in <module>
  File "C:\PRG\PYTHON25\lib\distutils\", line 151, in setup
  File "C:\PRG\PYTHON25\lib\distutils\", line 974, in run_commands
  File "C:\PRG\PYTHON25\lib\distutils\", line 994, in run_command
  File "C:\PRG\PYTHON25\lib\distutils\command\", line 112, in run
  File "C:\PRG\PYTHON25\lib\distutils\", line 333, in run_command
  File "C:\PRG\PYTHON25\lib\distutils\", line 994, in run_command
  File "", line 186, in run
  File "C:\PRG\PYTHON25\lib\distutils\command\", line 264,
in run
  File "C:\prg\pygame\trunk_\", line 31, in new_compiler
    return Mingw32DefaultCCompiler (None, dry_run, force)
  File "C:\PRG\PYTHON25\lib\distutils\", line 292, in

    CygwinCCompiler.__init__ (self, verbose, dry_run, force)
  File "C:\PRG\PYTHON25\lib\distutils\", line 84, in
  File "C:\PRG\PYTHON25\lib\distutils\", line 424, in
    ld_version = StrictVersion(
  File "C:\PRG\PYTHON25\lib\distutils\", line 40, in __init__
  File "C:\PRG\PYTHON25\lib\distutils\", line 107, in parse
    raise ValueError, "invalid version number '%s'" % vstring
ValueError: invalid version number ''

For instance "ld -v" now returns "GNU ld (GNU Binutils)", not "GNU ld version 2.17.50 20060824". The extra
period between the version number and date causes class StrictVersion to
raise a ValueError. A fix is to alter the regular expressions in

This enclosed patch to has been tested with the
current and previous linker as well as gcc 4.2.1 and gcc 3.4.5.
msg64176 - (view) Author: Sean Reifschneider (jafo) * (Python committer) Date: 2008-03-20 16:19
This patch looks ok to me, but I'd like jlt63 to review it since they
were the last to touch these regexes.
msg64806 - (view) Author: Jason Tishler (jlt63) * (Python triager) Date: 2008-04-01 12:42
If the version is guaranteed to be x.y or x.y.z, then the patch seems 
correct.  Note I am not set up to test this patch and it has been 
years since I have looked at this part of the code base.  Sorry, that 
I can't be more helpful.
msg64815 - (view) Author: Lenard Lindstrom (kermode) Date: 2008-04-01 18:20
distutils.version.StrictVersion.parse does not handle x.y.z.n . That is
why there is an exception. I have tested the patch both with
binutils-2.18.50-20080109 (*), the latest version (a "Technology
Preview"), and its predecessor binutils-2.18.50-20071123, which also
works without the proposed patch. I use MinGW to build Pygame. Finally,
there should be no reason to use earlier versions of binutils with
Python 2.4 and up as msvcr71 support was introduced only a couple of
years ago.

(*) The MinGW binutils bundle contains both ld and dllwrap
msg67916 - (view) Author: Will Brown (wmbrown) Date: 2008-06-10 20:27
Same problem in, line 100 (StrictVersion)
msg67926 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008-06-10 21:25
This seems to be the same as #3013.
msg67931 - (view) Author: Will Brown (wmbrown) Date: 2008-06-10 22:29
Yes, same problem. Multiple files.

I should have read the discussion more carefully. My note was redundant.


------------------ William Brown ------------------
------ Boeing Networked Systems Technology ------
           Kent:253.657.5586 Blvu:425.373.2738

> -----Original Message-----
> From: Benjamin Peterson [] 
> Sent: Tuesday, June 10, 2008 2:25 PM
> To: Brown, William J
> Subject: [issue2234] fails for latest 
> MinGW releases.
> Benjamin Peterson <> added the comment:
> This seems to be the same as #3013.
> ----------
> nosy: +benjamin.peterson
> _______________________________________
> Python tracker <>
> <>
> _______________________________________
msg67960 - (view) Author: Jason Tishler (jlt63) * (Python triager) Date: 2008-06-11 12:48
There have been three different regular expressions proposed to 
resolve this issue:


Does anyone know which one is best?

I would like to release a patched Cygwin Python 2.5.2 that resolves 
this issue, but I feel we should reach consensus on what regular 
expression to use before I do so.
msg67997 - (view) Author: Will Brown (wmbrown) Date: 2008-06-11 17:03
None of the above will work on both '' & '1.2.3a'

------------------ William Brown ------------------
------ Boeing Networked Systems Technology ------
           Kent:253.657.5586 Blvu:425.373.2738
msg68073 - (view) Author: Jason Tishler (jlt63) * (Python triager) Date: 2008-06-12 19:06
I tested the regular expression in #3:


and it worked for both '' & '1.2.3a'.

Additionally, it worked for the following test cases that I tried:

2.18.50a 20080523
2.18.50 20080523

Unfortunately, I don't know what is the set of all possible version 
formats that "ld -v" can return.  So, I don't know how to devise a 
regular expression guaranteed to work for all ld versions including 
future ones.

AFAICT, we have only two options to resolve this issue:

1. Improve the regular expression as best we can and continue to 
change it as necessary in the future.

2. Remove the fragile version checking all together and make an 
explicit decision to only support modern binutils.

Any opinions?
msg68085 - (view) Author: Will Brown (wmbrown) Date: 2008-06-12 20:49
Maybe I have a problem with my test code...
import re

def test_re(out_string):
    result ='(\d+\.\d+(\.(\d+))?([ab](\d+))?)', out_string)
    print '--- msg00622 ---'

if __name__ == '__main__':    
    out_string = ''

    out_string = '1.2.3a'

    out_string = '2.18.50a.20080523'

--- msg00622 ---

--- msg00622 ---

--- msg00622 ---

I would expect GNU to have a standard for version strings so this
doesn't happen to EVERYONE when they deviate from the expected. 

A quick check in Google returned the following links for other

Given that, I think I prefer 1 to 2.
msg68144 - (view) Author: Jason Tishler (jlt63) * (Python triager) Date: 2008-06-13 11:04 only uses the first group:

$ fgrep group
            gcc_version = StrictVersion(
            ld_version = StrictVersion(
            dllwrap_version = StrictVersion(

So, I would like to move forward with the regular expression from


Can we get a consensus?
msg69916 - (view) Author: Jose Antonio Martin H (jamartinh) Date: 2008-07-17 22:01
I have the same problem, i have patched the file and now it works ok.
msg71364 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-08-18 19:26
Fixed by r65834, thanks to the patch provided in issue3496.
Will backport.
msg71365 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-08-18 19:34
committed r65835 in the release25-maint branch.
msg71374 - (view) Author: Jason Tishler (jlt63) * (Python triager) Date: 2008-08-18 20:17
Date User Action Args
2022-04-11 14:56:31adminsetgithub: 46487
2008-10-22 16:48:27amaury.forgeotdarclinkissue900977 superseder
2008-10-22 16:40:07amaury.forgeotdarclinkissue4172 superseder
2008-08-18 20:17:49jlt63setmessages: + msg71374
2008-08-18 19:34:26amaury.forgeotdarcsetmessages: + msg71365
2008-08-18 19:26:50amaury.forgeotdarcsetstatus: open -> closed
nosy: + amaury.forgeotdarc
resolution: fixed
messages: + msg71364
2008-07-17 22:01:41jamartinhsetnosy: + jamartinh
messages: + msg69916
2008-06-13 11:04:09jlt63setmessages: + msg68144
2008-06-12 20:49:16wmbrownsetmessages: + msg68085
2008-06-12 19:06:32jlt63setmessages: + msg68073
2008-06-11 17:03:16wmbrownsetmessages: + msg67997
2008-06-11 12:48:47jlt63setmessages: + msg67960
2008-06-10 22:29:18wmbrownsetmessages: + msg67931
2008-06-10 21:26:11benjamin.petersonlinkissue3013 superseder
2008-06-10 21:25:21benjamin.petersonsetnosy: + benjamin.peterson
messages: + msg67926
2008-06-10 20:27:20wmbrownsetnosy: + wmbrown
messages: + msg67916
2008-04-01 18:20:36kermodesetmessages: + msg64815
2008-04-01 12:42:24jlt63setmessages: + msg64806
2008-03-20 16:19:18jafosetnosy: + jafo, jlt63
messages: + msg64176
priority: normal
assignee: jlt63
keywords: + easy
type: behavior
2008-03-04 18:43:39kermodecreate