本文整理汇总了Python中SCons.Script.ARGUMENTS类的典型用法代码示例。如果您正苦于以下问题:Python ARGUMENTS类的具体用法?Python ARGUMENTS怎么用?Python ARGUMENTS使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ARGUMENTS类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup_environment
def setup_environment(tools):
env = None
if sys.platform.find('win') == 0:
system_root = os.environ['SystemRoot']
comspec = os.environ['ComSpec']
env = {
'PATH': [ os.path.dirname(comspec) ],
'SystemRoot': os.environ['SystemRoot'],
'ComSpec': comspec,
'TEMP': os.environ['TEMP'],
'TMP': os.environ['TMP']
}
else:
raise DGSConsException("Platform {} is not supported".
format(os.platform))
compiler = GetOption('compiler')
if compiler == 'mingw':
mingwbin = ARGUMENTS.get('mingwbin')
if not mingwbin or not os.path.isdir(mingwbin):
raise DGSConsException("Unable to determine "
"Mingw compiler location. "
"Provided 'mingwbin' value: {}".
format(mingwbin))
env['PATH'].append(mingwbin)
tools.append('mingw')
else:
raise DGSConsException("Compiler type {} is not supported".
format(compiler))
compile_mode = ''
variant = GetOption('variant')
if variant == 'Debug':
compile_mode = '-g'
elif variant == 'Release':
compile_mode = '-O2'
else:
raise DGSConsException("Variant {} is not supported".format(variant))
default_environment = DefaultEnvironment(
ENV = env,
tools = tools,
VARIANT = variant,
CCFLAGS = compile_mode,
CXXFLAGS = compile_mode,
LINKFLAGS = compile_mode,
QTDIR = ARGUMENTS.get('qtroot', None),
DGDINC = ARGUMENTS.get('dgdinc', None)
)
if GetOption('dumpenv'):
print default_environment.Dump()
default_environment.Exit(0)
return default_environment
示例2: checkForLockPrefix
def checkForLockPrefix(conf):
"""Check for user-supplied lock prefix."""
conf.Message("Checking for user supplied lockprefix... ")
lp = ARGUMENTS.get('lockprefix', 0) or ARGUMENTS.get("with-lockprefix",0)
if lp:
conf.Result(1)
conf.env.Append(CPPFLAGS = '-DFSP_KEY_PREFIX=\\"'+lp+'\\"')
else:
conf.Result(0)
示例3: __init__
def __init__(self):
LanguageBuilder.__init__(self)
cpplint._cpplint_state.ResetErrorCounts()
self._build_mode = ARGUMENTS.get('c', 'dbg')
self._distcc_log = ARGUMENTS.get('distcc_log',
'%s/distcc_log' % Flags.SNAKE_OUT)
self._use_distcc = ARGUMENTS.get('use_distcc', 'on')
self._lib_name_map = {}
self._source_files = set()
self._checked_dir = set()
示例4: generate
def generate(env):
# initialize environment globals that other tools rely on
env['OFT_SCONS_TOOLS'] = os.path.dirname(os.path.abspath(__file__))
env['OFT_ROOT'] = os.path.abspath(os.path.join(env['OFT_SCONS_TOOLS'], '..'))
env['OFT_VM_INCLUDE'] = os.path.abspath(os.path.join(env['OFT_ROOT'], 'vm', 'src'))
# import terminal type to enable gcc/clang to print colored output
# http://stackoverflow.com/questions/9922521/why-doesnt-clang-show-color-output-under-scons
env['ENV']['TERM'] = os.environ['TERM']
# copy path from os environment
env['ENV']['PATH'] = os.environ['PATH']
# initialize logger
env.Tool('logger')
log_level = ARGUMENTS.get('log-level', None)
if log_level == None:
log_level = ARGUMENTS.get('ll', None)
if log_level == None:
log_level = 'warn'
env.SetLogLevel(log_level)
# load other tools
env.Tool('find_files')
env.Tool('oft_java')
env.Tool('infuser')
env.Tool('c_array')
env.Tool('target')
env.Tool('oft_runtime')
# helper functions
env.AddMethod(run_program, 'Run')
env['OFT_SHOW_SIZE_COMSTR'] = "Size:"
env.AddMethod(show_size, 'ShowSize')
# determine build directory
# this is inspired by the code in `scons/site_tools/xpcc.py`
# from the `xpcc` microcontroller library project
if not 'OFT_BUILDPATH' in env:
env['OFT_BUILDPATH'] = os.path.join(Dir('.').abspath, 'build')
# start list of ostfiresentee libraries
env['OFT_LIBS'] = []
示例5: checkForBuildingSharedLibrary
def checkForBuildingSharedLibrary(conf):
"""check if building shared library was requested"""
conf.Message("checking whether to build shared library... ")
makeshared=ARGUMENTS.get('enable-shared', 0)
if makeshared == 0 or makeshared == 'no':
conf.Result(0)
return False
else:
conf.Result(1)
return True
示例6: checkForUserPrefix
def checkForUserPrefix(conf,oldprefix=None):
"""Returns prefix specified on command line or oldprefix if none is found."""
conf.Message("Checking for user supplied prefix... ")
lp = ARGUMENTS.get('prefix', 0)
if lp:
conf.Result(1)
return lp
else:
conf.Result(0)
return oldprefix
示例7: print_deps_tree
def print_deps_tree(root, level=0):
margin = "| " * (level)
for lb in root.depbuilders:
title = "<%s>" % lb.name
if lb.version:
title += " v%s" % lb.version
if int(ARGUMENTS.get("PIOVERBOSE", 0)):
title += " (%s)" % lb.path
print "%s|-- %s" % (margin, title)
if lb.depbuilders:
print_deps_tree(lb, level + 1)
示例8: checkForMaintainerMode
def checkForMaintainerMode(conf,force=False):
"""Check if user wants to enable maintainer compilation mode.
If force is true than maintainer mode is forced"""
conf.Message("Checking whether to enable maintainer mode... ")
maint=ARGUMENTS.get('maintainer-mode', 0) or \
ARGUMENTS.get('enable-maintainer-mode', 0)
try:
maint2=int(maint)
except ValueError:
maint2=None
if force: maint2 = 1
if maint2 > 0 or str(maint).lower() == 'yes':
conf.Result(1)
conf.env.Append(CCFLAGS = '-O0')
conf.env.Append(CPPFLAGS = '-DMAINTAINER_MODE')
return True
else:
conf.Result(0)
return False
示例9: checkForLockingType
def checkForLockingType(check,conf):
"""check for available locking methods"""
fun_lockf=conf.CheckFunc("lockf")
fun_semop=conf.CheckFunc("semop")
fun_shmget=conf.CheckFunc("shmget")
fun_flock=conf.CheckFunc("flock")
# select locking type
check.Message("Checking for FSP locking type... ")
lt=ARGUMENTS.get('locking', 0) or ARGUMENTS.get("with-locking",0) or ARGUMENTS.get("lock",0) or ARGUMENTS.get("with-lock",0)
if lt == "none":
conf.env.Append(CPPFLAGS = '-DFSP_NOLOCKING')
check.Result("none")
elif lt == "lockf" and fun_lockf:
conf.env.Append(CPPFLAGS = '-DFSP_USE_LOCKF')
check.Result("lockf")
elif lt == "semop" and fun_semop and fun_shmget:
conf.env.Append(CPPFLAGS = '-DFSP_USE_SHAREMEM_AND_SEMOP')
check.Result("semop and shmget")
elif lt == "shmget" and fun_shmget and fun_lockf:
conf.env.Append(CPPFLAGS = '-DFSP_USE_SHAREMEM_AND_LOCKF')
check.Result("lockf and shmget")
elif lt == "flock" and fun_flock:
conf.env.Append(CPPFLAGS = '-DFSP_USE_FLOCK')
check.Result("flock")
# AUTODETECT best available locking type
elif fun_semop and fun_shmget:
conf.env.Append(CPPFLAGS = '-DFSP_USE_SHAREMEM_AND_SEMOP')
check.Result("semop and shmget")
elif fun_shmget and fun_lockf:
conf.env.Append(CPPFLAGS = '-DFSP_USE_SHAREMEM_AND_LOCKF')
check.Result("lockf and shmget")
elif fun_lockf:
conf.env.Append(CPPFLAGS = '-DFSP_USE_LOCKF')
check.Result("lockf")
elif fun_flock:
conf.env.Append(CPPFLAGS = '-DFSP_USE_FLOCK')
check.Result("flock")
else:
conf.env.Append(CPPFLAGS = '-DFSP_NOLOCKING')
check.Result("none")
示例10: PrepareEnv
def PrepareEnv(env):
log = ARGUMENTS.get('log', 'vs')
if log == 'q':
env['CMD_LOGFILE'] = os.path.join(Flags.SNAKE_OUT, 'build.log')
env['PRINT_CMD_LINE_FUNC'] = QuietBuild
print('%s %s' %
(Highlight('Build log:', 1, False), env['CMD_LOGFILE']))
if os.path.exists(env['CMD_LOGFILE']):
os.remove(env['CMD_LOGFILE'])
elif log == 's':
ColorfulBuild(env, False)
elif log == 'vs':
ColorfulBuild(env, True)
示例11: GetArg
def GetArg( name, helpmsg, default, allowed_values = None, caseless = True ):
"""Utility for adding help information and retrieving argument"""
if allowed_values is not None:
VARS.Add( EnumVariable( name, helpmsg, default,
allowed_values = allowed_values,
ignorecase = 2 ) )
else:
VARS.Add( name, helpmsg, default )
value = ARGUMENTS.get( name, default )
if value is not None and caseless:
value = value.lower()
return value
示例12: check_env
def check_env():
import racy.renv.configs.commandline
racy.renv.configs.commandline.check_opts(ARGUMENTS)
for opt, val in ARGUMENTS.items():
racy.renv.configs.allowedvalues.check_value_with_msg(
opt,
val,
'commandline argument'
)
for target in TARGETS.values():
racy.renv.configs.commandline.check_prj_opts(target.opts)
racy.renv.configs.allowedvalues.check_dict_with_msg(
target.opts, "commandline project's argument"
)
示例13: GenerateEnv
def GenerateEnv(self, env):
env['ENV']['PATH'] += ':%s' % Flags.CUDA_BIN_DIR
env['NVCC'] = Flags.CUDA_NVCC_BIN
env['CUDA_INC'] = Flags.CUDA_INC
env['CUDA_SDK_COMMON_INC'] = Flags.CUDA_SDK_COMMON_INC
env['CUDA_SDK_SHARED_INC'] = Flags.CUDA_SDK_SHARED_INC
env['CUDACOM'] = ('$NVCC $NVCC_FLAGS -I. -I $CUDA_INC -I $CUDA_SDK_COMMON_INC '
'-I $CUDA_SDK_SHARED_INC -c -o $CUDAOUTOBJ ${SOURCES}')
env['CUDAOUTOBJ'] = ""
build_strategy = ARGUMENTS.get('c', 'dbg')
if build_strategy == 'dbg':
env['NVCC_FLAGS'] = ' ';
elif build_strategy == 'opt':
env['NVCC_FLAGS'] = '-O2 -DNDEBUG';
示例14: __init__
def __init__(self):
LanguageBuilder.__init__(self)
self._is_svn_client = Path.IsSVNClient()
self._is_git_client = Path.IsGITClient()
cpplint._cpplint_state.ResetErrorCounts()
self._opend_files = set()
self._checked_dir = set()
self._always_test = ARGUMENTS.get('always_test', 'on')
self._build_mode = ARGUMENTS.get('c', 'dbg')
# self._check_lib_dep = ARGUMENTS.get('check_dep', 'on')
self._check_style = ARGUMENTS.get('check_cpp_style', 'on')
self._test_suffix = 'passed'
self._access_checker = AccessChecker()
self._lib_name_map = {}
self._binaries = set()
p = 'libs/gtest/lib%s.a'
lib_base = self._GetStaticLib('//base:base', abort = False)
if not lib_base:
lib_base = self._GetLibName('//base:base')
self._gtest_lib_source = [Path.GetAbsPath(x, abort = False) for x in
(p % 'gtest_main', p % 'gmock', p % 'gtest')] + [lib_base]
self._benchmark_lib_source = [Path.GetAbsPath(x, abort = False) for x in
(p % 'benchmark_main', p % 'gtest')] + [lib_base]
self._main_lib = [Path.GetAbsPath(Flags.MAIN_LIB, abort = False)]
示例15: print_deps_tree
def print_deps_tree(root, level=0):
margin = "| " * (level)
for lb in root.depbuilders:
title = "<%s>" % lb.name
vcs_info = lb.vcs_info
if lb.version:
title += " %s" % lb.version
if vcs_info and vcs_info.get("version"):
title += " #%s" % vcs_info.get("version")
sys.stdout.write("%s|-- %s" % (margin, title))
if int(ARGUMENTS.get("PIOVERBOSE", 0)):
if vcs_info:
sys.stdout.write(" [%s]" % vcs_info.get("url"))
sys.stdout.write(" (")
sys.stdout.write(lb.path)
sys.stdout.write(")")
sys.stdout.write("\n")
if lb.depbuilders:
print_deps_tree(lb, level + 1)