| OLD | NEW |
| 1 #!/usr/bin/python2.4 | 1 #!/usr/bin/python2.4 |
| 2 # Copyright 2008, Google Inc. | 2 # Copyright 2008, Google Inc. |
| 3 # All rights reserved. | 3 # All rights reserved. |
| 4 # | 4 # |
| 5 # Redistribution and use in source and binary forms, with or without | 5 # Redistribution and use in source and binary forms, with or without |
| 6 # modification, are permitted provided that the following conditions are | 6 # modification, are permitted provided that the following conditions are |
| 7 # met: | 7 # met: |
| 8 # | 8 # |
| 9 # * Redistributions of source code must retain the above copyright | 9 # * Redistributions of source code must retain the above copyright |
| 10 # notice, this list of conditions and the following disclaimer. | 10 # notice, this list of conditions and the following disclaimer. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 Since this modifies the C compiler strings, it must be specified after the | 33 Since this modifies the C compiler strings, it must be specified after the |
| 34 compiler tool in the tool list. | 34 compiler tool in the tool list. |
| 35 | 35 |
| 36 Distcc support can be enabled by specifying --distcc on the SCons command | 36 Distcc support can be enabled by specifying --distcc on the SCons command |
| 37 line. | 37 line. |
| 38 """ | 38 """ |
| 39 | 39 |
| 40 | 40 |
| 41 import optparse | 41 import optparse |
| 42 import os | 42 import os |
| 43 import sys |
| 43 from SCons.compat._scons_optparse import OptionConflictError | 44 from SCons.compat._scons_optparse import OptionConflictError |
| 44 import SCons.Script | 45 import SCons.Script |
| 45 | 46 |
| 46 | 47 |
| 47 def generate(env): | 48 def generate(env): |
| 48 # NOTE: SCons requires the use of this name, which fails gpylint. | 49 # NOTE: SCons requires the use of this name, which fails gpylint. |
| 49 """SCons entry point for this tool.""" | 50 """SCons entry point for this tool.""" |
| 50 if not env.Detect('distcc'): | 51 if not env.Detect('distcc'): |
| 51 return | 52 return |
| 52 | 53 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 77 env['ENV'][envvar] = value | 78 env['ENV'][envvar] = value |
| 78 | 79 |
| 79 # Set name of distcc tool | 80 # Set name of distcc tool |
| 80 env['DISTCC'] = 'distcc' | 81 env['DISTCC'] = 'distcc' |
| 81 | 82 |
| 82 # Modify compilers we support | 83 # Modify compilers we support |
| 83 distcc_compilers = env.get('DISTCC_COMPILERS', ['cc', 'gcc', 'c++', 'g++']) | 84 distcc_compilers = env.get('DISTCC_COMPILERS', ['cc', 'gcc', 'c++', 'g++']) |
| 84 for compiler_var in ('CC', 'CXX'): | 85 for compiler_var in ('CC', 'CXX'): |
| 85 compiler = env.get(compiler_var) | 86 compiler = env.get(compiler_var) |
| 86 if compiler in distcc_compilers: | 87 if compiler in distcc_compilers: |
| 88 if sys.platform == 'darwin': |
| 89 # On Mac, distcc requires the full path to the compiler |
| 90 compiler = env.WhereIs(compiler) |
| 87 env[compiler_var] = '$DISTCC ' + compiler | 91 env[compiler_var] = '$DISTCC ' + compiler |
| 88 | 92 |
| 89 | 93 |
| 90 def exists(env): | 94 def exists(env): |
| 91 """Returns true if tool exists.""" | 95 """Returns true if tool exists.""" |
| 92 # NOTE: SCons requires the use of this name, which fails gpylint. | 96 # NOTE: SCons requires the use of this name, which fails gpylint. |
| 93 return env.Detect('distcc') | 97 return env.Detect('distcc') |
| OLD | NEW |