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.

classification
Title: cygwinccompiler.py fails for latest MinGW releases.
Type: behavior Stage:
Components: Distutils Versions: Python 2.5
process
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.

Files
File name Uploaded Description Edit
cygwinccompiler.patch kermode, 2008-03-04 18:43 unified patch for file cygwinccompiler.py
Messages (16)
msg63257 - (view) Author: Lenard Lindstrom (kermode) Date: 2008-03-04 18:43
The cygwinccompiler.py 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 "setup.py", line 224, in <module>
    setup(**PACKAGEDATA)
  File "C:\PRG\PYTHON25\lib\distutils\core.py", line 151, in setup
    dist.run_commands()
  File "C:\PRG\PYTHON25\lib\distutils\dist.py", line 974, in run_commands
    self.run_command(cmd)
  File "C:\PRG\PYTHON25\lib\distutils\dist.py", line 994, in run_command
    cmd_obj.run()
  File "C:\PRG\PYTHON25\lib\distutils\command\build.py", line 112, in run
    self.run_command(cmd_name)
  File "C:\PRG\PYTHON25\lib\distutils\cmd.py", line 333, in run_command
    self.distribution.run_command(command)
  File "C:\PRG\PYTHON25\lib\distutils\dist.py", line 994, in run_command
    cmd_obj.run()
  File "setup.py", line 186, in run
    build_ext.run(self)
  File "C:\PRG\PYTHON25\lib\distutils\command\build_ext.py", line 264,
in run
    force=self.force)
  File "C:\prg\pygame\trunk_\mingw32distutils.py", line 31, in new_compiler
    return Mingw32DefaultCCompiler (None, dry_run, force)
  File "C:\PRG\PYTHON25\lib\distutils\cygwinccompiler.py", line 292, in
__init__

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

For instance "ld -v" now returns "GNU ld (GNU Binutils)
2.18.50.20080109", 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
cygwinccompiler.get_versions().

This enclosed patch to cygwinccompiler.py 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 version.py, 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.

Will

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

> -----Original Message-----
> From: Benjamin Peterson [mailto:report@bugs.python.org] 
> Sent: Tuesday, June 10, 2008 2:25 PM
> To: Brown, William J
> Subject: [issue2234] cygwinccompiler.py fails for latest 
> MinGW releases.
> 
> 
> Benjamin Peterson <musiccomposition@gmail.com> added the comment:
> 
> This seems to be the same as #3013.
> 
> ----------
> nosy: +benjamin.peterson
> 
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue2234>
> _______________________________________
>
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:

1. http://bugs.python.org/issue2234
2. http://bugs.python.org/issue3013
3. http://cygwin.com/ml/cygwin/2008-05/msg00622.html

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 '2.18.50.20080523' & '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:

(\d+\.\d+(\.(\d+))?([ab](\d+))?)

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

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

2.18.50a.20080523
2.18.50a 20080523
2.18.50 20080523
1.2.3

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 = re.search('(\d+\.\d+(\.(\d+))?([ab](\d+))?)', out_string)
    print '--- msg00622 ---'
    print result.group(1)
    print result.group(2)
    print result.group(3)
    print result.group(4)
    print

if __name__ == '__main__':    
    out_string = '2.18.50.20080523'
    test_re(out_string)

    out_string = '1.2.3a'
    test_re(out_string)

    out_string = '2.18.50a.20080523'
    test_re(out_string)

Results...
--- msg00622 ---
2.18.50
.50
50
None

--- msg00622 ---
1.2.3
.3
3
None

--- msg00622 ---
2.18.50
.50
50
None
--------------------

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
packages... 

http://publib.boulder.ibm.com/tividd/td/ITCM/SC23-4712-01/en_US/HTML/cmm
st19.htm
http://java.sun.com/j2se/versioning_naming.html
http://www.osgi.org/javadoc/r4/org/osgi/framework/Version.html

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

$ fgrep group cygwinccompiler.py
            gcc_version = StrictVersion(result.group(1))
            ld_version = StrictVersion(result.group(1))
            dllwrap_version = StrictVersion(result.group(1))

So, I would like to move forward with the regular expression from 
http://cygwin.com/ml/cygwin/2008-05/msg00622.html:

    (\d+\.\d+(\.(\d+))?([ab](\d+))?)

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
Thanks!
History
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