Bug 1264482 - Use the EnumString type for the compiler type. r=ted
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 06 Apr 2016 09:35:58 +0900
changeset 331688 177380345f2fc53853aa53e0aceca74a022a8e2f
parent 331687 bb77bbe1fbd702545e71867dec66651d30b69526
child 331689 4e3809b7b919db8ed2ba458b8514bda62c9917ef
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs1264482
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1264482 - Use the EnumString type for the compiler type. r=ted
build/moz.configure/toolchain.configure
python/mozbuild/mozbuild/configure/constants.py
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -145,16 +145,17 @@ def toolchain_prefix(value, target, host
 set_config('TOOLCHAIN_PREFIX', toolchain_prefix)
 add_old_configure_assignment('TOOLCHAIN_PREFIX', toolchain_prefix)
 
 
 # Compilers
 # ==============================================================
 @imports('os')
 @imports('subprocess')
+@imports(_from='mozbuild.configure.constants', _import='CompilerType')
 @imports(_from='mozbuild.configure.util', _import='LineIO')
 @imports(_from='mozbuild.shellutil', _import='quote')
 @imports(_from='tempfile', _import='mkstemp')
 @imports(_from='textwrap', _import='dedent')
 def check_compiler(compiler, language):
     check = dedent('''\
         #if defined(_MSC_VER)
         #if defined(__clang__)
@@ -191,17 +192,17 @@ def check_compiler(compiler, language):
                                 stderr=subprocess.PIPE)
         stdout, stderr = proc.communicate()
         retcode = proc.wait()
         if retcode == 0:
             for line in stdout.splitlines():
                 if line.startswith('COMPILER '):
                     _, type, version = line.split(None, 2)
                     version = version.replace(' ', '')
-                    return type, version
+                    return CompilerType(type), version
             return
 
         log.debug('The command returned non-zero exit status %d.', retcode)
         for out, desc in ((stdout, 'output'), (stderr, 'error output')):
             if out:
                 log.debug('Its %s was:', desc)
                 with LineIO(lambda l: log.debug('| %s', l)) as o:
                     o.write(out)
new file mode 100644
--- /dev/null
+++ b/python/mozbuild/mozbuild/configure/constants.py
@@ -0,0 +1,15 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+from __future__ import absolute_import, print_function, unicode_literals
+
+from mozbuild.util import EnumString
+
+
+CompilerType = EnumString.subclass(
+    'clang',
+    'clang-cl',
+    'gcc',
+    'msvc',
+)