diff options
| author | Tarek Ziadé <ziade.tarek@gmail.com> | 2009-07-16 15:35:45 (GMT) |
|---|---|---|
| committer | Tarek Ziadé <ziade.tarek@gmail.com> | 2009-07-16 15:35:45 (GMT) |
| commit | a99dedfce29536ec156466b6846ef90dda46f1e2 (patch) | |
| tree | bef1cfda505faaa694fbc0861ff809f59a67c967 /Lib/distutils/emxccompiler.py | |
| parent | 7530e47948446f03a79ad7dec4cc129ad3388418 (diff) | |
| download | cpython-a99dedfce29536ec156466b6846ef90dda46f1e2.zip cpython-a99dedfce29536ec156466b6846ef90dda46f1e2.tar.gz cpython-a99dedfce29536ec156466b6846ef90dda46f1e2.tar.bz2 | |
#6466 refactored distutils duplicate get_versions() functions (used to get gcc/ld/dllwrap versions)
Diffstat (limited to 'Lib/distutils/emxccompiler.py')
| -rw-r--r-- | Lib/distutils/emxccompiler.py | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/Lib/distutils/emxccompiler.py b/Lib/distutils/emxccompiler.py index f52e632..a5a2ef8 100644 --- a/Lib/distutils/emxccompiler.py +++ b/Lib/distutils/emxccompiler.py @@ -21,12 +21,15 @@ handles the EMX port of the GNU C compiler to OS/2. __revision__ = "$Id$" -import os,sys,copy +import os, sys, copy +from warnings import warn + from distutils.ccompiler import gen_preprocess_options, gen_lib_options from distutils.unixccompiler import UnixCCompiler from distutils.file_util import write_file from distutils.errors import DistutilsExecError, CompileError, UnknownFileError from distutils import log +from distutils.util import get_compiler_versions class EMXCCompiler (UnixCCompiler): @@ -55,8 +58,8 @@ class EMXCCompiler (UnixCCompiler): ("Reason: %s." % details) + "Compiling may fail because of undefined preprocessor macros.") - (self.gcc_version, self.ld_version) = \ - get_versions() + gcc_version, ld_version, dllwrap_version = get_compiler_versions() + self.gcc_version, self.ld_version = gcc_version, ld_version self.debug_print(self.compiler_type + ": gcc %s, ld %s\n" % (self.gcc_version, self.ld_version) ) @@ -293,23 +296,11 @@ def get_versions(): """ Try to find out the versions of gcc and ld. If not possible it returns None for it. """ - 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') - out_string = out.read() - out.close() - result = re.search('(\d+\.\d+\.\d+)',out_string) - if result: - gcc_version = StrictVersion(result.group(1)) - else: - gcc_version = None - else: - gcc_version = None + warn("'distutils.emxccompiler.get_versions' is deprecated " + "use 'distutils.util.get_compiler_versions' instead", + DeprecationWarning) + # EMX ld has no way of reporting version number, and we use GCC # anyway - so we can link OMF DLLs - ld_version = None - return (gcc_version, ld_version) + gcc_version, ld_version, dllwrap_version = get_compiler_versions() + return gcc_version, None |
