Merged revisions 74024 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r74024 | tarek.ziade | 2009-07-16 17:35:45 +0200 (Thu, 16 Jul 2009) | 1 line

  #6466 refactored distutils duplicate get_versions() functions (used to get gcc/ld/dllwrap versions)
........
diff --git a/Lib/distutils/emxccompiler.py b/Lib/distutils/emxccompiler.py
index 62a4c5b..50634d6 100644
--- a/Lib/distutils/emxccompiler.py
+++ b/Lib/distutils/emxccompiler.py
@@ -21,12 +21,15 @@
 
 __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 @@
                 ("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) )
@@ -291,23 +294,11 @@
     """ 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
+    warn("'distutils.emxccompiler.get_versions' is deprecated "
+         "use 'distutils.util.get_compiler_versions' instead",
+         DeprecationWarning)
 
-    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, re.ASCII)
-        if result:
-            gcc_version = StrictVersion(result.group(1))
-        else:
-            gcc_version = None
-    else:
-        gcc_version = None
     # 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