Merge remote-tracking branch 'base/master'
This commit is contained in:
commit
8574dabf74
3 changed files with 13 additions and 46 deletions
|
|
@ -1,30 +0,0 @@
|
|||
# paths.py
|
||||
# Eryn Wells <eryn@erynwells.me>
|
||||
|
||||
import os
|
||||
import os.path
|
||||
|
||||
|
||||
def is_executable(path):
|
||||
return os.path.exists(path) and os.access(path, os.X_OK)
|
||||
|
||||
|
||||
def which(program):
|
||||
'''
|
||||
Look for `program` in system path and return the full path to that binary if
|
||||
it is found. Otherwise, return `None`.
|
||||
'''
|
||||
path, name = os.path.split(program)
|
||||
if path:
|
||||
if is_executable(program):
|
||||
return program
|
||||
else:
|
||||
pathext = [''] + os.environ.get('PATHEXT', '').split(os.pathsep)
|
||||
for path in os.environ.get('PATH', '').split(os.pathsep):
|
||||
exe = os.path.join(path, program)
|
||||
for ext in pathext:
|
||||
candidate = exe + ext
|
||||
if is_executable(candidate):
|
||||
return candidate
|
||||
return None
|
||||
|
||||
|
|
@ -3,12 +3,9 @@
|
|||
|
||||
import logging
|
||||
import sys
|
||||
|
||||
import SCons.Environment
|
||||
import SCons.Errors
|
||||
|
||||
import paths
|
||||
|
||||
|
||||
def setup_logging(level=logging.DEBUG):
|
||||
'''Configure global logging for the SCons system.'''
|
||||
|
|
@ -105,6 +102,9 @@ class Environment(SCons.Environment.Environment):
|
|||
if colorful and sys.stdout.isatty():
|
||||
if 'clang' in self['CC'] or 'clang' in self['CXX']:
|
||||
self.AppendUnique(CCFLAGS=['-fcolor-diagnostics'])
|
||||
elif 'gcc' in self['CC'] or 'g++' in self['CXX']:
|
||||
# TODO: Also set a GCC_COLORS variable in the system environment?
|
||||
self.AppendUnique(CCFLAGS=['-fdiagnostics-color=always'])
|
||||
|
||||
# Pretty printing
|
||||
self.SetDefault(ARCOMSTR=Environment._comstr('Archiving', succinct))
|
||||
|
|
@ -135,8 +135,6 @@ class Environment(SCons.Environment.Environment):
|
|||
|
||||
def process_src(self):
|
||||
out_dir = self.build_root.Dir('src')
|
||||
# TODO: Do the thing.
|
||||
# do_sconscript(env, env.source_root, src_out_dir)
|
||||
self.SConscript(self.src_root.File('SConscript'),
|
||||
variant_dir=out_dir)
|
||||
self.Append(CPPPATH=[self.src_root])
|
||||
|
|
|
|||
|
|
@ -11,19 +11,18 @@ def _do_sconscript(env):
|
|||
original_sconscript = env.SConscript
|
||||
|
||||
def sconscript(env, sconscript, clone=False, *args, **kwargs):
|
||||
exports = {'Library': env.Library,
|
||||
'StaticLibrary': env.StaticLibrary,
|
||||
'SharedLibrary': env.SharedLibrary,
|
||||
'Program': env.Program,
|
||||
|
||||
'Append': env.Append,
|
||||
'Replace': env.Replace}
|
||||
exports = {
|
||||
'Library': env.Library,
|
||||
'Object': env.Object,
|
||||
'SharedObject': env.SharedObject,
|
||||
'StaticLibrary': env.StaticLibrary,
|
||||
'SharedLibrary': env.SharedLibrary,
|
||||
'Program': env.Program,
|
||||
'env': env.Clone() if clone else env,
|
||||
}
|
||||
SCons.Script._SConscript.GlobalDict.update(exports)
|
||||
env.log('Reading {}'.format(sconscript))
|
||||
return original_sconscript(sconscript,
|
||||
{'env': env.Clone() if clone else env},
|
||||
*args,
|
||||
**kwargs)
|
||||
return original_sconscript(sconscript, {}, *args, **kwargs)
|
||||
|
||||
return sconscript
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue