summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/emxccompiler.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/distutils/emxccompiler.py')
-rw-r--r--Lib/distutils/emxccompiler.py35
1 files changed, 23 insertions, 12 deletions
diff --git a/Lib/distutils/emxccompiler.py b/Lib/distutils/emxccompiler.py
index fd79aec..62a4c5b 100644
--- a/Lib/distutils/emxccompiler.py
+++ b/Lib/distutils/emxccompiler.py
@@ -21,13 +21,12 @@ handles the EMX port of the GNU C compiler to OS/2.
__revision__ = "$Id$"
-import os, sys, copy
-from warnings import warn
-
+import os,sys,copy
+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.util import get_compiler_versions
+from distutils import log
class EMXCCompiler (UnixCCompiler):
@@ -56,8 +55,8 @@ class EMXCCompiler (UnixCCompiler):
("Reason: %s." % details) +
"Compiling may fail because of undefined preprocessor macros.")
- gcc_version, ld_version, dllwrap_version = get_compiler_versions()
- self.gcc_version, self.ld_version = gcc_version, ld_version
+ (self.gcc_version, self.ld_version) = \
+ get_versions()
self.debug_print(self.compiler_type + ": gcc %s, ld %s\n" %
(self.gcc_version,
self.ld_version) )
@@ -292,11 +291,23 @@ def get_versions():
""" Try to find out the versions of gcc and ld.
If not possible it returns None for it.
"""
- warn("'distutils.emxccompiler.get_versions' is deprecated "
- "use 'distutils.util.get_compiler_versions' instead",
- DeprecationWarning)
-
+ 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, 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
- gcc_version, ld_version, dllwrap_version = get_compiler_versions()
- return gcc_version, None
+ ld_version = None
+ return (gcc_version, ld_version)