diff options
author | Fred Drake <fdrake@acm.org> | 2001-12-06 20:51:35 +0000 |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2001-12-06 20:51:35 +0000 |
commit | b94b849d65af71b4b432a74fdaef8ccd88209cc0 (patch) | |
tree | d32dd5d053192834153d90685ca56361f5ecc62a /Lib/distutils/cygwinccompiler.py | |
parent | bcd8975740da47e7d1c8a5d2839ad4bf214fe34b (diff) | |
download | cpython-git-b94b849d65af71b4b432a74fdaef8ccd88209cc0.tar.gz |
Whitespace normalization.
Diffstat (limited to 'Lib/distutils/cygwinccompiler.py')
-rw-r--r-- | Lib/distutils/cygwinccompiler.py | 97 |
1 files changed, 48 insertions, 49 deletions
diff --git a/Lib/distutils/cygwinccompiler.py b/Lib/distutils/cygwinccompiler.py index 07e16655b0..1d97282322 100644 --- a/Lib/distutils/cygwinccompiler.py +++ b/Lib/distutils/cygwinccompiler.py @@ -18,28 +18,28 @@ cygwin in no-cygwin mode). # # see also http://starship.python.net/crew/kernr/mingw32/Notes.html # -# * We put export_symbols in a def-file, and don't use +# * We put export_symbols in a def-file, and don't use # --export-all-symbols because it doesn't worked reliable in some # tested configurations. And because other windows compilers also # need their symbols specified this no serious problem. # # tested configurations: -# -# * cygwin gcc 2.91.57/ld 2.9.4/dllwrap 0.2.4 works +# +# * cygwin gcc 2.91.57/ld 2.9.4/dllwrap 0.2.4 works # (after patching python's config.h and for C++ some other include files) # see also http://starship.python.net/crew/kernr/mingw32/Notes.html -# * mingw32 gcc 2.95.2/ld 2.9.4/dllwrap 0.2.4 works -# (ld doesn't support -shared, so we use dllwrap) +# * mingw32 gcc 2.95.2/ld 2.9.4/dllwrap 0.2.4 works +# (ld doesn't support -shared, so we use dllwrap) # * cygwin gcc 2.95.2/ld 2.10.90/dllwrap 2.10.90 works now # - its dllwrap doesn't work, there is a bug in binutils 2.10.90 # see also http://sources.redhat.com/ml/cygwin/2000-06/msg01274.html -# - using gcc -mdll instead dllwrap doesn't work without -static because +# - using gcc -mdll instead dllwrap doesn't work without -static because # it tries to link against dlls instead their import libraries. (If # it finds the dll first.) -# By specifying -static we force ld to link against the import libraries, -# this is windows standard and there are normally not the necessary symbols +# By specifying -static we force ld to link against the import libraries, +# this is windows standard and there are normally not the necessary symbols # in the dlls. -# *** only the version of June 2000 shows these problems +# *** only the version of June 2000 shows these problems # created 2000/05/05, Rene Liebscher @@ -60,7 +60,7 @@ class CygwinCCompiler (UnixCCompiler): static_lib_format = "lib%s%s" shared_lib_format = "%s%s" exe_extension = ".exe" - + def __init__ (self, verbose=0, dry_run=0, @@ -76,20 +76,20 @@ class CygwinCCompiler (UnixCCompiler): "Python's pyconfig.h doesn't seem to support your compiler. " + ("Reason: %s." % details) + "Compiling may fail because of undefined preprocessor macros.") - + (self.gcc_version, self.ld_version, self.dllwrap_version) = \ get_versions() self.debug_print(self.compiler_type + ": gcc %s, ld %s, dllwrap %s\n" % - (self.gcc_version, - self.ld_version, + (self.gcc_version, + self.ld_version, self.dllwrap_version) ) - # ld_version >= "2.10.90" should also be able to use + # ld_version >= "2.10.90" should also be able to use # gcc -mdll instead of dllwrap - # Older dllwraps had own version numbers, newer ones use the + # Older dllwraps had own version numbers, newer ones use the # same as the rest of binutils ( also ld ) # dllwrap 2.10.90 is buggy - if self.ld_version >= "2.10.90": + if self.ld_version >= "2.10.90": self.linker_dll = "gcc" else: self.linker_dll = "dllwrap" @@ -102,22 +102,22 @@ class CygwinCCompiler (UnixCCompiler): linker_so=('%s -mcygwin -mdll -static' % self.linker_dll)) - # cygwin and mingw32 need different sets of libraries + # cygwin and mingw32 need different sets of libraries if self.gcc_version == "2.91.57": # cygwin shouldn't need msvcrt, but without the dlls will crash # (gcc version 2.91.57) -- perhaps something about initialization self.dll_libraries=["msvcrt"] - self.warn( + self.warn( "Consider upgrading to a newer version of gcc") else: self.dll_libraries=[] - + # __init__ () # not much different of the compile method in UnixCCompiler, # but we have to insert some lines in the middle of it, so # we put here a adapted version of it. - # (If we would call compile() in the base class, it would do some + # (If we would call compile() in the base class, it would do some # initializations a second time, this is why all is done here.) def compile (self, sources, @@ -143,7 +143,7 @@ class CygwinCCompiler (UnixCCompiler): extra_postargs = [] # Compile all source files that weren't eliminated by - # '_prep_compile()'. + # '_prep_compile()'. for i in range (len (sources)): src = sources[i] ; obj = objects[i] ext = (os.path.splitext (src))[1] @@ -157,7 +157,7 @@ class CygwinCCompiler (UnixCCompiler): self.spawn (["windres","-i",src,"-o",obj]) except DistutilsExecError, msg: raise CompileError, msg - else: # for other files use the C-compiler + else: # for other files use the C-compiler try: self.spawn (self.compiler_so + cc_args + [src, '-o', obj] + @@ -184,12 +184,12 @@ class CygwinCCompiler (UnixCCompiler): extra_preargs=None, extra_postargs=None, build_temp=None): - + # use separate copies, so we can modify the lists extra_preargs = copy.copy(extra_preargs or []) libraries = copy.copy(libraries or []) objects = copy.copy(objects or []) - + # Additional libraries libraries.extend(self.dll_libraries) @@ -199,10 +199,10 @@ class CygwinCCompiler (UnixCCompiler): (target_desc != self.EXECUTABLE or self.linker_dll == "gcc")): # (The linker doesn't do anything if output is up-to-date. # So it would probably better to check if we really need this, - # but for this we had to insert some unchanged parts of - # UnixCCompiler, and this is not what we want.) + # but for this we had to insert some unchanged parts of + # UnixCCompiler, and this is not what we want.) - # we want to put some files in the same directory as the + # we want to put some files in the same directory as the # object files are, build_temp doesn't help much # where are the object files temp_dir = os.path.dirname(objects[0]) @@ -214,7 +214,7 @@ class CygwinCCompiler (UnixCCompiler): def_file = os.path.join(temp_dir, dll_name + ".def") exp_file = os.path.join(temp_dir, dll_name + ".exp") lib_file = os.path.join(temp_dir, 'lib' + dll_name + ".a") - + # Generate .def file contents = [ "LIBRARY %s" % os.path.basename(output_filename), @@ -237,21 +237,21 @@ class CygwinCCompiler (UnixCCompiler): else: # doesn't work: bfd_close build\...\libfoo.a: Invalid operation #extra_preargs.extend(["-Wl,--out-implib,%s" % lib_file]) - # for gcc/ld the def-file is specified as any other object files + # for gcc/ld the def-file is specified as any other object files objects.append(def_file) #end: if ((export_symbols is not None) and # (target_desc != self.EXECUTABLE or self.linker_dll == "gcc")): - + # who wants symbols and a many times larger output file - # should explicitly switch the debug mode on + # should explicitly switch the debug mode on # otherwise we let dllwrap/ld strip the output file - # (On my machine: 10KB < stripped_file < ??100KB + # (On my machine: 10KB < stripped_file < ??100KB # unstripped_file = stripped_file + XXX KB - # ( XXX=254 for a typical python extension)) - if not debug: - extra_preargs.append("-s") - + # ( XXX=254 for a typical python extension)) + if not debug: + extra_preargs.append("-s") + UnixCCompiler.link(self, target_desc, objects, @@ -265,7 +265,7 @@ class CygwinCCompiler (UnixCCompiler): extra_preargs, extra_postargs, build_temp) - + # link () # -- Miscellaneous methods ----------------------------------------- @@ -288,7 +288,7 @@ class CygwinCCompiler (UnixCCompiler): base = os.path.basename (base) if ext == '.res' or ext == '.rc': # these need to be compiled to object files - obj_names.append (os.path.join (output_dir, + obj_names.append (os.path.join (output_dir, base + ext + self.obj_extension)) else: obj_names.append (os.path.join (output_dir, @@ -311,7 +311,7 @@ class Mingw32CCompiler (CygwinCCompiler): force=0): CygwinCCompiler.__init__ (self, verbose, dry_run, force) - + # A real mingw32 doesn't need to specify a different entry point, # but cygwin 2.91.57 in no-cygwin-mode needs it. if self.gcc_version <= "2.91.57": @@ -322,15 +322,15 @@ class Mingw32CCompiler (CygwinCCompiler): self.set_executables(compiler='gcc -mno-cygwin -O -Wall', compiler_so='gcc -mno-cygwin -mdll -O -Wall', linker_exe='gcc -mno-cygwin', - linker_so='%s -mno-cygwin -mdll -static %s' + linker_so='%s -mno-cygwin -mdll -static %s' % (self.linker_dll, entry_point)) # Maybe we should also append -mthreads, but then the finished # dlls need another dll (mingwm10.dll see Mingw32 docs) - # (-mthreads: Support thread-safe exception handling on `Mingw32') - - # no additional libraries needed + # (-mthreads: Support thread-safe exception handling on `Mingw32') + + # no additional libraries needed self.dll_libraries=[] - + # __init__ () # class Mingw32CCompiler @@ -370,15 +370,15 @@ def check_config_h(): # GCC, and the pyconfig.h file should be OK if string.find(sys.version,"GCC") >= 0: return (CONFIG_H_OK, "sys.version mentions 'GCC'") - + fn = sysconfig.get_config_h_filename() try: # It would probably better to read single lines to search. - # But we do this only once, and it is fast enough + # But we do this only once, and it is fast enough f = open(fn) s = f.read() f.close() - + except IOError, exc: # if we can't read this file, we cannot say it is wrong # the compiler will complain later about this file as missing @@ -401,7 +401,7 @@ def get_versions(): from distutils.version import StrictVersion from distutils.spawn import find_executable import re - + gcc_exe = find_executable('gcc') if gcc_exe: out = os.popen(gcc_exe + ' -dumpversion','r') @@ -439,4 +439,3 @@ def get_versions(): else: dllwrap_version = None return (gcc_version, ld_version, dllwrap_version) - |