Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Side by Side Diff: build/compiler_version.py

Issue 208313002: Revert of Minor fix to regex inside compiler_version.py (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Compiler version checking tool for gcc 6 """Compiler version checking tool for gcc
7 7
8 Print gcc version as XY if you are running gcc X.Y.*. 8 Print gcc version as XY if you are running gcc X.Y.*.
9 This is used to tweak build flags for gcc 4.4. 9 This is used to tweak build flags for gcc 4.4.
10 """ 10 """
(...skipping 10 matching lines...) Expand all
21 # Note that compiler could be something tricky like "distcc g++". 21 # Note that compiler could be something tricky like "distcc g++".
22 if tool == "compiler": 22 if tool == "compiler":
23 compiler = compiler + " -dumpversion" 23 compiler = compiler + " -dumpversion"
24 # 4.6 24 # 4.6
25 version_re = re.compile(r"(\d+)\.(\d+)") 25 version_re = re.compile(r"(\d+)\.(\d+)")
26 elif tool == "assembler": 26 elif tool == "assembler":
27 compiler = compiler + " -Xassembler --version -x assembler -c /dev/null" 27 compiler = compiler + " -Xassembler --version -x assembler -c /dev/null"
28 # Unmodified: GNU assembler (GNU Binutils) 2.24 28 # Unmodified: GNU assembler (GNU Binutils) 2.24
29 # Ubuntu: GNU assembler (GNU Binutils for Ubuntu) 2.22 29 # Ubuntu: GNU assembler (GNU Binutils for Ubuntu) 2.22
30 # Fedora: GNU assembler version 2.23.2 30 # Fedora: GNU assembler version 2.23.2
31 version_re = re.compile(r"^GNU [^ ]+ .* (\d+)\.(\d+)\.*?$", re.M) 31 version_re = re.compile(r"^GNU [^ ]+ .* (\d+).(\d+).*?$", re.M)
32 elif tool == "linker": 32 elif tool == "linker":
33 compiler = compiler + " -Xlinker --version" 33 compiler = compiler + " -Xlinker --version"
34 # Using BFD linker 34 # Using BFD linker
35 # Unmodified: GNU ld (GNU Binutils) 2.24 35 # Unmodified: GNU ld (GNU Binutils) 2.24
36 # Ubuntu: GNU ld (GNU Binutils for Ubuntu) 2.22 36 # Ubuntu: GNU ld (GNU Binutils for Ubuntu) 2.22
37 # Fedora: GNU ld version 2.23.2 37 # Fedora: GNU ld version 2.23.2
38 # Using Gold linker 38 # Using Gold linker
39 # Unmodified: GNU gold (GNU Binutils 2.24) 1.11 39 # Unmodified: GNU gold (GNU Binutils 2.24) 1.11
40 # Ubuntu: GNU gold (GNU Binutils for Ubuntu 2.22) 1.11 40 # Ubuntu: GNU gold (GNU Binutils for Ubuntu 2.22) 1.11
41 # Fedora: GNU gold (version 2.23.2) 1.11 41 # Fedora: GNU gold (version 2.23.2) 1.11
42 version_re = re.compile(r"^GNU [^ ]+ .* (\d+)\.(\d+)\.*?$", re.M) 42 version_re = re.compile(r"^GNU [^ ]+ .* (\d+).(\d+).*?$", re.M)
43 else: 43 else:
44 raise Exception("Unknown tool %s" % tool) 44 raise Exception("Unknown tool %s" % tool)
45 45
46 pipe = subprocess.Popen(compiler, shell=True, 46 pipe = subprocess.Popen(compiler, shell=True,
47 stdout=subprocess.PIPE, stderr=subprocess.PIPE) 47 stdout=subprocess.PIPE, stderr=subprocess.PIPE)
48 tool_output, tool_error = pipe.communicate() 48 tool_output, tool_error = pipe.communicate()
49 if pipe.returncode: 49 if pipe.returncode:
50 raise subprocess.CalledProcessError(pipe.returncode, compiler) 50 raise subprocess.CalledProcessError(pipe.returncode, compiler)
51 51
52 result = version_re.match(tool_output) 52 result = version_re.match(tool_output)
(...skipping 26 matching lines...) Expand all
79 gccversion = GetVersion("g++", tool) 79 gccversion = GetVersion("g++", tool)
80 if gccversion != "": 80 if gccversion != "":
81 print gccversion 81 print gccversion
82 return 0 82 return 0
83 83
84 return 1 84 return 1
85 85
86 86
87 if __name__ == "__main__": 87 if __name__ == "__main__":
88 sys.exit(main(sys.argv[1:])) 88 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698