本文整理汇总了Python中common_py.system.executor.Executor.fail方法的典型用法代码示例。如果您正苦于以下问题:Python Executor.fail方法的具体用法?Python Executor.fail怎么用?Python Executor.fail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common_py.system.executor.Executor
的用法示例。
在下文中一共展示了Executor.fail方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: resolve_modules
# 需要导入模块: from common_py.system.executor import Executor [as 别名]
# 或者: from common_py.system.executor.Executor import fail [as 别名]
def resolve_modules(options):
""" Resolve include/exclude module lists based on command line arguments
and build config.
"""
# Load all the supported modules
supported = options.config['module']['supported']
core_modules = set(supported['core'])
basic_modules = set(supported['basic'])
# By default the target included modules are:
# - 'core' module set from the build config
# - modules specified by the command line argument
include_modules = set() | core_modules
include_modules |= options.iotjs_include_module
if not options.iotjs_minimal_profile:
# Add 'basic' module to the target include modules
include_modules |= basic_modules
# Start to check exclude modules
exclude_modules = options.iotjs_exclude_module
# Check if there are any modules which are not allowed to be excluded
impossible_to_exclude = exclude_modules & core_modules
if impossible_to_exclude:
ex.fail('Can not exclude modules which are in `core` modules: %s' %
', '.join(impossible_to_exclude))
# Finally remove the excluded modules from the included modules set
include_modules -= exclude_modules
return include_modules, exclude_modules
示例2: resolve_modules
# 需要导入模块: from common_py.system.executor import Executor [as 别名]
# 或者: from common_py.system.executor.Executor import fail [as 别名]
def resolve_modules(options):
""" Resolve include/exclude module lists based on command line arguments
and build config.
"""
# Load the modules which are always enabled and the include/exclude sets
build_modules_always = set(options.config['module']['always'])
build_modules_includes = set(options.config['module']['include'])
build_modules_excludes = set(options.config['module']['exclude']['all'])
if options.target_os:
system_os = options.target_os
if system_os == 'tizen':
system_os = 'linux'
build_modules_excludes |= set(
options.config['module']['exclude'][system_os])
# By default the target included modules are:
# - always module set from the build config
# - modules specified by the command line argument
include_modules = set()
include_modules |= build_modules_always
include_modules |= options.iotjs_include_module
if not options.iotjs_minimal_profile:
# In case of normal build (not minimal profile):
# Check if there is any overlap between the included and excluded
# module sets which are from the build config
problem_modules = build_modules_includes & build_modules_excludes
if problem_modules:
print('Detected module(s) both in include and exclude list.',
end=' ')
print('Module name(s): %s' % ', '.join(problem_modules))
ex.fail('Inconsistency in build config file!')
# Add the include set from the build config to
# the target include modules set
include_modules |= build_modules_includes
# Check if there is any modules which are not allowed to be excluded
impossible_to_exclude = options.iotjs_exclude_module & build_modules_always
if impossible_to_exclude:
ex.fail('Cannot exclude modules which are always enabled: %s' %
', '.join(impossible_to_exclude))
# Remove any excluded modules (defined by the command line argument) from
# the target include set
include_modules -= options.iotjs_exclude_module
# Finally build up the excluded module set:
# - use the command line exclude set
# - use the exclude set from the build config
exclude_modules = options.iotjs_exclude_module | build_modules_excludes
# Remove the included modules set from the excluded modules
exclude_modules -= include_modules
assert len(include_modules & exclude_modules) == 0, \
'Module can NOT be both in include and exclude list'
return include_modules, exclude_modules
示例3: adjust_options
# 需要导入模块: from common_py.system.executor import Executor [as 别名]
# 或者: from common_py.system.executor.Executor import fail [as 别名]
def adjust_options(options):
# First fix some option inconsistencies
if options.target_os in ['nuttx', 'tizenrt']:
options.buildlib = True
if not options.sysroot:
ex.fail('--sysroot needed for nuttx target')
options.sysroot = fs.abspath(options.sysroot)
if not fs.exists(options.sysroot):
ex.fail('Nuttx sysroot %s does not exist' % options.sysroot)
if options.target_arch == 'x86':
options.target_arch = 'i686'
if options.target_arch == 'x64':
options.target_arch = 'x86_64'
if options.target_os == 'darwin':
options.no_check_valgrind = True
if options.target_board in ['rpi2', 'artik10', 'artik05x']:
options.no_check_valgrind = True
elif options.target_board == 'none':
options.target_board = None
if options.iotjs_minimal_profile:
options.no_check_test = True
# Then add calculated options
options.host_tuple = '%s-%s' % (platform.arch(), platform.os())
options.target_tuple = '%s-%s' % (options.target_arch, options.target_os)
options.host_build_root = fs.join(path.PROJECT_ROOT,
options.builddir,
'host',
options.host_tuple,
options.buildtype)
options.host_build_bins = fs.join(options.host_build_root, 'bin')
options.build_root = fs.join(path.PROJECT_ROOT,
options.builddir,
options.target_tuple,
options.buildtype)
options.build_bins = fs.join(options.build_root, 'bin')
options.build_libs = fs.join(options.build_root, 'lib')
cmake_path = fs.join(path.PROJECT_ROOT, 'cmake', 'config', '%s.cmake')
options.cmake_toolchain_file = cmake_path % options.target_tuple
options.host_cmake_toolchain_file = cmake_path % options.host_tuple
# Specify the file of JerryScript profile
options.jerry_profile = fs.join(path.JERRY_PROFILE_ROOT,
options.jerry_profile + '.profile')
示例4: build_tuv
# 需要导入模块: from common_py.system.executor import Executor [as 别名]
# 或者: from common_py.system.executor.Executor import fail [as 别名]
def build_tuv(option):
# Check if libtuv submodule exists.
if not fs.exists(path.TUV_ROOT):
ex.fail('libtuv submodule not exists!')
# Move working directory to libtuv build directory.
build_home = fs.join(build_root, 'deps', 'libtuv')
fs.maybe_make_directory(build_home)
fs.chdir(build_home)
# Set tuv cmake option.
cmake_opt = [path.TUV_ROOT]
cmake_opt.append('-DCMAKE_TOOLCHAIN_FILE=' +
fs.join(path.TUV_ROOT,
'cmake', 'config',
'config_' + target_tuple + '.cmake'))
cmake_opt.append('-DCMAKE_BUILD_TYPE=' + option.buildtype)
cmake_opt.append('-DTARGET_PLATFORM=' + target_tuple)
cmake_opt.append('-DLIBTUV_CUSTOM_LIB_OUT=' + build_home)
cmake_opt.append('-DBUILDTESTER=no')
cmake_opt.append('-DBUILDAPIEMULTESTER=no')
if option.target_os == 'nuttx':
cmake_opt.append('-DTARGET_SYSTEMROOT=' + option.nuttx_home)
if option.target_board:
cmake_opt.append('-DTARGET_BOARD=' + option.target_board)
# inflate cmake option.
inflate_cmake_option(cmake_opt, option)
# Run cmake
ex.check_run_cmd('cmake', cmake_opt)
# Run make
make_opt = []
if not option.no_parallel_build:
make_opt.append('-j')
ex.check_run_cmd('make', make_opt)
# libtuv output
output = fs.join(build_home, 'libtuv.a')
if not fs.exists(output):
ex.fail('libtuv build failed - target not produced.')
# copy output to libs directory
fs.maybe_make_directory(build_libs)
fs.copy(output, libtuv_output_path)
return True
示例5: build_jerry
# 需要导入模块: from common_py.system.executor import Executor [as 别名]
# 或者: from common_py.system.executor.Executor import fail [as 别名]
def build_jerry(option):
# Check if JerryScript submodule exists.
if not fs.exists(path.JERRY_ROOT):
ex.fail('JerryScript submodule not exists!')
# Move working directory to JerryScript build directory.
build_home = fs.join(host_build_root, 'deps', 'jerry')
fs.maybe_make_directory(build_home)
fs.chdir(build_home)
# Set JerryScript cmake option.
cmake_opt = [path.JERRY_ROOT]
cmake_opt.append('-DCMAKE_TOOLCHAIN_FILE=' + host_cmake_toolchain_file)
if option.buildtype == 'debug':
cmake_opt.append('-DCMAKE_BUILD_TYPE=Debug')
# Turn off LTO for jerry bin to save build time.
cmake_opt.append('-DENABLE_LTO=OFF')
# Turn on snapshot
if not option.no_snapshot:
cmake_opt.append('-DFEATURE_SNAPSHOT_SAVE=ON')
# Run cmake.
ex.check_run_cmd('cmake', cmake_opt)
target_jerry = {
'target_name': 'jerry',
'output_path': fs.join(build_home, 'bin/jerry')
}
# Make option.
make_opt = ['-C', build_home]
if not option.no_parallel_build:
make_opt.append('-j')
# Run make for a target.
ex.check_run_cmd('make', make_opt)
# Check output
output = target_jerry['output_path']
if not fs.exists(output):
print output
ex.fail('JerryScript build failed - target not produced.')
# copy
fs.copy(output, jerry_output_path)
return True
示例6: build_libhttpparser
# 需要导入模块: from common_py.system.executor import Executor [as 别名]
# 或者: from common_py.system.executor.Executor import fail [as 别名]
def build_libhttpparser(option):
# Check if JerryScript submodule exists.
if not fs.exists(path.HTTPPARSER_ROOT):
ex.fail('libhttpparser submodule not exists!')
return False
# Move working directory to JerryScript build directory.
build_home = fs.join(build_root, 'deps', 'httpparser')
fs.maybe_make_directory(build_home)
fs.chdir(build_home)
# Set JerryScript cmake option.
cmake_opt = [path.HTTPPARSER_ROOT]
cmake_opt.append('-DCMAKE_TOOLCHAIN_FILE=' + cmake_toolchain_file)
cmake_opt.append('-DBUILDTYPE=' + option.buildtype.capitalize())
if option.target_os == 'nuttx':
cmake_opt.append('-DNUTTX_HOME=' + option.nuttx_home)
cmake_opt.append('-DOS=NUTTX')
if option.target_os == 'linux':
cmake_opt.append('-DOS=LINUX')
# inflate cmake option.
inflate_cmake_option(cmake_opt, option)
# Run cmake.
ex.check_run_cmd('cmake', cmake_opt)
# Set make option.
make_opt = []
if not option.no_parallel_build:
make_opt.append('-j')
# Run make
ex.check_run_cmd('make', make_opt)
# Output
output = fs.join(build_home, 'libhttpparser.a')
if not fs.exists(output):
ex.fail('libhttpparser build failed - target not produced.')
# copy
fs.copy(output, libhttpparser_output_path)
return True
示例7: adjust_options
# 需要导入模块: from common_py.system.executor import Executor [as 别名]
# 或者: from common_py.system.executor.Executor import fail [as 别名]
def adjust_options(options):
# First fix some option inconsistencies.
if options.target_os in ['nuttx', 'tizenrt']:
options.buildlib = True
if not options.sysroot:
ex.fail('--sysroot needed for %s target' % options.target_os)
options.sysroot = fs.abspath(options.sysroot)
if not fs.exists(options.sysroot):
ex.fail('NuttX sysroot %s does not exist' % options.sysroot)
if options.target_arch == 'x86':
options.target_arch = 'i686'
if options.target_arch == 'x64':
options.target_arch = 'x86_64'
if options.target_os == 'darwin':
options.no_check_valgrind = True
if options.target_board in ['rpi2', 'rpi3', 'artik10', 'artik05x']:
options.no_check_valgrind = True
# Then add calculated options.
options.host_tuple = '%s-%s' % (platform.arch(), platform.os())
options.target_tuple = '%s-%s' % (options.target_arch, options.target_os)
# Normalize the path of build directory.
options.builddir = fs.normpath(options.builddir)
options.build_root = fs.join(path.PROJECT_ROOT,
options.builddir,
options.target_tuple,
options.buildtype)
cmake_path = fs.join(path.PROJECT_ROOT, 'cmake', 'config', '%s.cmake')
options.cmake_toolchain_file = cmake_path % options.target_tuple
# Set the default value of '--js-backtrace' if it is not defined.
if not options.js_backtrace:
if options.buildtype == 'debug':
options.js_backtrace = "ON"
else:
options.js_backtrace = "OFF"
示例8: analyze_module_dependency
# 需要导入模块: from common_py.system.executor import Executor [as 别名]
# 或者: from common_py.system.executor.Executor import fail [as 别名]
def analyze_module_dependency(include_modules, exclude_modules):
analyze_queue = set(include_modules) # copy the set
analyze_queue.add('iotjs')
js_modules = { 'native' }
native_modules = { 'process' }
while analyze_queue:
item = analyze_queue.pop()
js_modules.add(item)
js_module_path = fs.join(path.PROJECT_ROOT,
'src', 'js', item + '.js')
if not fs.exists(js_module_path):
ex.fail('Cannot read file "%s"' % js_module_path)
with open(js_module_path) as module:
content = module.read()
# Pretend to ignore comments in JavaScript
re_js_comments = "\/\/.*|\/\*.*\*\/";
content = re.sub(re_js_comments, "", content)
# Get all required modules
re_js_module = 'require\([\'\"](.*?)[\'\"]\)'
required_modules = set(re.findall(re_js_module, content))
# Check if there is any required modules in the exclude set
problem_modules = required_modules & exclude_modules
if problem_modules:
ex.fail('Cannot exclude module(s) "%s" since "%s" requires them' %
(', '.join(problem_modules), item))
# Add all modules to analytze queue which are not yet analyzed
analyze_queue |= required_modules - js_modules
# Get all native modules
re_native_module = 'process.binding\(process.binding.(.*?)\)'
native_modules |= set(re.findall(re_native_module, content))
js_modules.remove('native')
modules = {'js': sorted(js_modules), 'native': sorted(native_modules)}
return modules
示例9: run_checktest
# 需要导入模块: from common_py.system.executor import Executor [as 别名]
# 或者: from common_py.system.executor.Executor import fail [as 别名]
def run_checktest(options):
checktest_quiet = 'yes'
if os.getenv('TRAVIS') == "true":
checktest_quiet = 'no'
# iot.js executable
iotjs = fs.join(options.build_root, 'bin', 'iotjs')
build_args = ['--', 'quiet=' + checktest_quiet]
if options.iotjs_exclude_module:
skip_module = ','.join(options.iotjs_exclude_module)
build_args.append('skip-module=' + skip_module)
# experimental
if options.experimental:
build_args.append('experimental=' + 'yes');
fs.chdir(path.PROJECT_ROOT)
code = ex.run_cmd(iotjs, [path.CHECKTEST_PATH] + build_args)
if code != 0:
ex.fail('Failed to pass unit tests')
if not options.no_check_valgrind:
code = ex.run_cmd('valgrind', ['--leak-check=full',
'--error-exitcode=5',
'--undef-value-errors=no',
iotjs,
path.CHECKTEST_PATH] + build_args)
if code == 5:
ex.fail('Failed to pass valgrind test')
if code != 0:
ex.fail('Failed to pass unit tests in valgrind environment')
示例10: run_checktest
# 需要导入模块: from common_py.system.executor import Executor [as 别名]
# 或者: from common_py.system.executor.Executor import fail [as 别名]
def run_checktest(option):
checktest_quiet = 'yes'
if os.getenv('TRAVIS') == "true":
checktest_quiet = 'no'
# iot.js executable
iotjs = fs.join(build_root, 'iotjs', 'iotjs')
fs.chdir(path.PROJECT_ROOT)
code = ex.run_cmd(iotjs, [path.CHECKTEST_PATH,
'--',
'quiet='+checktest_quiet])
if code != 0:
ex.fail('Failed to pass unit tests')
if not option.no_check_valgrind:
code = ex.run_cmd('valgrind', ['--leak-check=full',
'--error-exitcode=5',
'--undef-value-errors=no',
iotjs,
path.CHECKTEST_PATH,
'--',
'quiet='+checktest_quiet])
if code == 5:
ex.fail('Failed to pass valgrind test')
if code != 0:
ex.fail('Failed to pass unit tests in valgrind environment')
return True
示例11: run_checktest
# 需要导入模块: from common_py.system.executor import Executor [as 别名]
# 或者: from common_py.system.executor.Executor import fail [as 别名]
def run_checktest(options):
# IoT.js executable
iotjs = fs.join(options.build_root, 'bin', 'iotjs')
cmd = fs.join(path.TOOLS_ROOT, 'testrunner.py')
args = [iotjs, "--platform=%s" % options.target_os]
if options.run_test == "quiet":
args.append('--quiet')
if options.n_api:
args.append('--n-api')
fs.chdir(path.PROJECT_ROOT)
code = ex.run_cmd(cmd, args)
if code != 0:
ex.fail('Failed to pass unit tests')
if not options.no_check_valgrind:
code = ex.run_cmd(cmd, ['--valgrind'] + args)
if code != 0:
ex.fail('Failed to pass unit tests in valgrind environment')
示例12: adjust_option
# 需要导入模块: from common_py.system.executor import Executor [as 别名]
# 或者: from common_py.system.executor.Executor import fail [as 别名]
def adjust_option(option):
if option.target_os.lower() == 'nuttx':
option.buildlib = True
if option.nuttx_home == '':
ex.fail('--nuttx-home needed for nuttx target')
else:
option.nuttx_home = fs.abspath(option.nuttx_home)
if not fs.exists(option.nuttx_home):
ex.fail('--nuttx-home %s not exists' % option.nuttx_home)
if option.target_arch == 'x86':
option.target_arch = 'i686'
if option.target_arch == 'x64':
option.target_arch = 'x86_64'
if option.target_board == 'rpi2':
option.no_check_valgrind = True
if option.cmake_param is None:
option.cmake_param = []
if option.compile_flag is None:
option.compile_flag = []
if option.link_flag is None:
option.link_flag = []
if option.external_include_dir is None:
option.external_include_dir = []
if option.external_static_lib is None:
option.external_static_lib = []
if option.external_shared_lib is None:
option.external_shared_lib = []
if option.iotjs_include_module is None:
option.iotjs_include_module = []
if option.iotjs_exclude_module is None:
option.iotjs_exclude_module = []
if option.iotjs_minimal_profile:
option.no_check_test = True
if option.jerry_cmake_param is None:
option.jerry_cmake_param = []
if option.jerry_compile_flag is None:
option.jerry_compile_flag = []
if option.jerry_link_flag is None:
option.jerry_link_flag = []
示例13: run_checktest
# 需要导入模块: from common_py.system.executor import Executor [as 别名]
# 或者: from common_py.system.executor.Executor import fail [as 别名]
def run_checktest(options):
# IoT.js executable
iotjs = fs.join(options.build_root, 'bin', 'iotjs')
cmd = []
args = []
if options.test_driver == "js":
cmd = iotjs
args = [path.CHECKTEST_PATH]
if options.run_test == "quiet":
args.append('quiet=yes')
# experimental
if options.experimental:
args.append('experimental=yes');
else:
cmd = fs.join(path.TOOLS_ROOT, 'testrunner.py')
args = [iotjs]
if options.run_test == "quiet":
args.append('--quiet')
fs.chdir(path.PROJECT_ROOT)
code = ex.run_cmd(cmd, args)
if code != 0:
ex.fail('Failed to pass unit tests')
if not options.no_check_valgrind:
if options.test_driver == "js":
code = ex.run_cmd('valgrind', ['--leak-check=full',
'--error-exitcode=5',
'--undef-value-errors=no',
cmd] + args)
if code == 5:
ex.fail('Failed to pass valgrind test')
if code != 0:
ex.fail('Failed to pass unit tests in valgrind environment')
else:
code = ex.run_cmd(cmd, ['--valgrind'] + args)
if code != 0:
ex.fail('Failed to pass unit tests in valgrind environment')
示例14: git_remove_remote
# 需要导入模块: from common_py.system.executor import Executor [as 别名]
# 或者: from common_py.system.executor.Executor import fail [as 别名]
def git_remove_remote(fork_name, branch_name):
remote_name = get_merge_remote_name(fork_name, branch_name)
return ex.run_cmd('git remote remove %s' % remote_name)
def check_build():
return (ex.run_cmd(BUILD_SCRIPT_DEBUG) or
ex.run_cmd(BUILD_SCRIPT_RELEASE))
def git_push():
return ex.run_cmd('git push origin master')
if len(sys.argv) < 3:
ex.fail(
'usage: <merge.py> <fork_name> <branch_name> [<id>]')
fork_name = sys.argv[1]
branch_name = sys.argv[2]
git_id = ""
git_passwd = ""
if len(sys.argv) >= 4:
git_id = sys.argv[3]
git_passwd = getpass.getpass()
merge_branch = get_merge_branch_name(fork_name, branch_name)
# check if current branch is master.
示例15: build_iotjs
# 需要导入模块: from common_py.system.executor import Executor [as 别名]
# 或者: from common_py.system.executor.Executor import fail [as 别名]
def build_iotjs(option):
# Run js2c
fs.chdir(path.TOOLS_ROOT)
js2c(option.buildtype, option.no_snapshot, option.js_modules,
jerry_output_path)
# Move working directory to IoT.js build directory.
build_home = fs.join(build_root, 'iotjs')
fs.maybe_make_directory(build_home)
fs.chdir(build_home)
# Set JerryScript cmake option.
cmake_opt = [path.PROJECT_ROOT]
cmake_opt.append('-DCMAKE_TOOLCHAIN_FILE=' + cmake_toolchain_file)
cmake_opt.append('-DCMAKE_BUILD_TYPE=' + option.buildtype.capitalize())
cmake_opt.append('-DTARGET_OS=' + option.target_os)
cmake_opt.append('-DPLATFORM_DESCRIPT=' + platform_descriptor)
# IoT.js module list
cmake_opt.append('-DIOTJS_MODULES=' + (' ').join(option.native_modules))
if not option.no_snapshot:
option.compile_flag.append('-DENABLE_SNAPSHOT')
if option.target_os == 'nuttx':
cmake_opt.append('-DNUTTX_HOME=' + option.nuttx_home)
option.buildlib = True
# --build-lib
if option.buildlib:
cmake_opt.append('-DBUILD_TO_LIB=YES')
# --cmake-param
cmake_opt += option.cmake_param
# --external_static_lib
cmake_opt.append('-DEXTERNAL_STATIC_LIB=' +
' '.join(option.external_static_lib))
# --external_shared_lib
config_shared_libs = option.config['shared_libs']
option.external_shared_lib += config_shared_libs['os'][option.target_os]
cmake_opt.append('-DEXTERNAL_SHARED_LIB=' +
' '.join(option.external_shared_lib))
# inflate cmake option
inflate_cmake_option(cmake_opt, option)
# Run cmake.
ex.check_run_cmd('cmake', cmake_opt)
# Set make option.
make_opt = []
if not option.no_parallel_build:
make_opt.append('-j')
# Run make
ex.check_run_cmd('make', make_opt)
# Output
output = fs.join(build_home,
'liblibiotjs.a' if option.buildlib else 'iotjs')
if not fs.exists(output):
ex.fail('IoT.js build failed - target not produced.')
# copy
dest_path = libiotjs_output_path if option.buildlib else iotjs_output_path
fs.copy(output, dest_path)
return True