2424# 3. Force windows to use g77
2525
2626import distutils .cygwinccompiler
27- from distutils .version import StrictVersion
2827from distutils .unixccompiler import UnixCCompiler
2928from distutils .msvccompiler import get_build_version as get_build_msvc_version
3029from distutils .errors import UnknownFileError
@@ -62,35 +61,6 @@ def __init__ (self,
6261 distutils .cygwinccompiler .CygwinCCompiler .__init__ (self , verbose ,
6362 dry_run , force )
6463
65- # we need to support 3.2 which doesn't match the standard
66- # get_versions methods regex
67- if self .gcc_version is None :
68- try :
69- out_string = subprocess .check_output (['gcc' , '-dumpversion' ])
70- except (OSError , CalledProcessError ):
71- out_string = "" # ignore failures to match old behavior
72- result = re .search (r'(\d+\.\d+)' , out_string )
73- if result :
74- self .gcc_version = StrictVersion (result .group (1 ))
75-
76- # A real mingw32 doesn't need to specify a different entry point,
77- # but cygwin 2.91.57 in no-cygwin-mode needs it.
78- if self .gcc_version <= "2.91.57" :
79- entry_point = '--entry _DllMain@12'
80- else :
81- entry_point = ''
82-
83- if self .linker_dll == 'dllwrap' :
84- # Commented out '--driver-name g++' part that fixes weird
85- # g++.exe: g++: No such file or directory
86- # error (mingw 1.0 in Enthon24 tree, gcc-3.4.5).
87- # If the --driver-name part is required for some environment
88- # then make the inclusion of this part specific to that
89- # environment.
90- self .linker = 'dllwrap' # --driver-name g++'
91- elif self .linker_dll == 'gcc' :
92- self .linker = 'g++'
93-
9464 # **changes: eric jones 4/11/01
9565 # 1. Check for import library on Windows. Build if it doesn't exist.
9666
@@ -113,42 +83,18 @@ def __init__ (self,
11383 # kind of bad consequences, like using Py_ModuleInit4 instead of
11484 # Py_ModuleInit4_64, etc... So we add it here
11585 if get_build_architecture () == 'AMD64' :
116- if self .gcc_version < "4.0" :
117- self .set_executables (
118- compiler = 'gcc -g -DDEBUG -DMS_WIN64 -mno-cygwin -O0 -Wall' ,
119- compiler_so = 'gcc -g -DDEBUG -DMS_WIN64 -mno-cygwin -O0'
120- ' -Wall -Wstrict-prototypes' ,
121- linker_exe = 'gcc -g -mno-cygwin' ,
122- linker_so = 'gcc -g -mno-cygwin -shared' )
123- else :
124- # gcc-4 series releases do not support -mno-cygwin option
125- self .set_executables (
126- compiler = 'gcc -g -DDEBUG -DMS_WIN64 -O0 -Wall' ,
127- compiler_so = 'gcc -g -DDEBUG -DMS_WIN64 -O0 -Wall -Wstrict-prototypes' ,
128- linker_exe = 'gcc -g' ,
129- linker_so = 'gcc -g -shared' )
86+ self .set_executables (
87+ compiler = 'gcc -g -DDEBUG -DMS_WIN64 -O0 -Wall' ,
88+ compiler_so = 'gcc -g -DDEBUG -DMS_WIN64 -O0 -Wall '
89+ '-Wstrict-prototypes' ,
90+ linker_exe = 'gcc -g' ,
91+ linker_so = 'gcc -g -shared' )
13092 else :
131- if self .gcc_version <= "3.0.0" :
132- self .set_executables (
133- compiler = 'gcc -mno-cygwin -O2 -w' ,
134- compiler_so = 'gcc -mno-cygwin -mdll -O2 -w'
135- ' -Wstrict-prototypes' ,
136- linker_exe = 'g++ -mno-cygwin' ,
137- linker_so = '%s -mno-cygwin -mdll -static %s' %
138- (self .linker , entry_point ))
139- elif self .gcc_version < "4.0" :
140- self .set_executables (
141- compiler = 'gcc -mno-cygwin -O2 -Wall' ,
142- compiler_so = 'gcc -mno-cygwin -O2 -Wall'
143- ' -Wstrict-prototypes' ,
144- linker_exe = 'g++ -mno-cygwin' ,
145- linker_so = 'g++ -mno-cygwin -shared' )
146- else :
147- # gcc-4 series releases do not support -mno-cygwin option
148- self .set_executables (compiler = 'gcc -O2 -Wall' ,
149- compiler_so = 'gcc -O2 -Wall -Wstrict-prototypes' ,
150- linker_exe = 'g++ ' ,
151- linker_so = 'g++ -shared' )
93+ self .set_executables (
94+ compiler = 'gcc -O2 -Wall' ,
95+ compiler_so = 'gcc -O2 -Wall -Wstrict-prototypes' ,
96+ linker_exe = 'g++ ' ,
97+ linker_so = 'g++ -shared' )
15298 # added for python2.3 support
15399 # we can't pass it through set_executables because pre 2.2 would fail
154100 self .compiler_cxx = ['g++' ]
@@ -198,10 +144,7 @@ def link(self,
198144 extra_postargs ,
199145 build_temp ,
200146 target_lang )
201- if self .gcc_version < "3.0.0" :
202- func = distutils .cygwinccompiler .CygwinCCompiler .link
203- else :
204- func = UnixCCompiler .link
147+ func = UnixCCompiler .link
205148 func (* args [:func .__code__ .co_argcount ])
206149 return
207150
0 commit comments