本文整理汇总了Python中common_py.system.filesystem.FileSystem.chdir方法的典型用法代码示例。如果您正苦于以下问题:Python FileSystem.chdir方法的具体用法?Python FileSystem.chdir怎么用?Python FileSystem.chdir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common_py.system.filesystem.FileSystem
的用法示例。
在下文中一共展示了FileSystem.chdir方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run_checktest
# 需要导入模块: from common_py.system.filesystem import FileSystem [as 别名]
# 或者: from common_py.system.filesystem.FileSystem import chdir [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')
示例2: configure_trizenrt
# 需要导入模块: from common_py.system.filesystem import FileSystem [as 别名]
# 或者: from common_py.system.filesystem.FileSystem import chdir [as 别名]
def configure_trizenrt(tizenrt_root, buildtype):
# TODO: handle buildtype (build vs release) for tizenrt build
tizenrt_tools = fs.join(tizenrt_root, 'os/tools')
fs.chdir(tizenrt_tools)
ex.check_run_cmd('./configure.sh', ['artik053/iotjs'])
fs.chdir('..')
ex.check_run_cmd('make', ['context'])
示例3: run_checktest
# 需要导入模块: from common_py.system.filesystem import FileSystem [as 别名]
# 或者: from common_py.system.filesystem.FileSystem import chdir [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
示例4: build_nuttx
# 需要导入模块: from common_py.system.filesystem import FileSystem [as 别名]
# 或者: from common_py.system.filesystem.FileSystem import chdir [as 别名]
def build_nuttx(nuttx_root, buildtype, maketarget):
fs.chdir(fs.join(nuttx_root, 'nuttx'))
if buildtype == "release":
rflag = 'R=1'
else:
rflag = 'R=0'
ex.check_run_cmd('make',
[maketarget, 'IOTJS_ROOT_DIR=' + path.PROJECT_ROOT, rflag])
示例5: setup_tizen_root
# 需要导入模块: from common_py.system.filesystem import FileSystem [as 别名]
# 或者: from common_py.system.filesystem.FileSystem import chdir [as 别名]
def setup_tizen_root(tizen_root):
if fs.exists(tizen_root):
fs.chdir(tizen_root)
ex.check_run_cmd('git', ['pull'])
fs.chdir(path.PROJECT_ROOT)
else:
ex.check_run_cmd('git', ['clone',
'https://github.com/pmarcinkiew/tizen3.0_rootstrap.git',
tizen_root])
示例6: setup_tizenrt_repo
# 需要导入模块: from common_py.system.filesystem import FileSystem [as 别名]
# 或者: from common_py.system.filesystem.FileSystem import chdir [as 别名]
def setup_tizenrt_repo(tizenrt_root):
if fs.exists(tizenrt_root):
fs.chdir(tizenrt_root)
ex.check_run_cmd('git', ['fetch', 'origin'])
fs.chdir(path.PROJECT_ROOT)
else:
ex.check_run_cmd('git', ['clone',
'https://github.com/Samsung/TizenRT.git',
tizenrt_root])
ex.check_run_cmd('git', ['--git-dir', tizenrt_root + '/.git/',
'--work-tree', tizenrt_root,
'checkout', TIZENRT_COMMIT])
copy_tiznert_stuff(tizenrt_root, path.PROJECT_ROOT)
示例7: build_tuv
# 需要导入模块: from common_py.system.filesystem import FileSystem [as 别名]
# 或者: from common_py.system.filesystem.FileSystem import chdir [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
示例8: build_jerry
# 需要导入模块: from common_py.system.filesystem import FileSystem [as 别名]
# 或者: from common_py.system.filesystem.FileSystem import chdir [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
示例9: build_libhttpparser
# 需要导入模块: from common_py.system.filesystem import FileSystem [as 别名]
# 或者: from common_py.system.filesystem.FileSystem import chdir [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
示例10: build_nuttx
# 需要导入模块: from common_py.system.filesystem import FileSystem [as 别名]
# 或者: from common_py.system.filesystem.FileSystem import chdir [as 别名]
def build_nuttx(nuttx_root, buildtype):
fs.chdir(fs.join(nuttx_root, 'nuttx'))
try:
code = 0
if buildtype == "release":
code = ex.run_cmd('make',
['IOTJS_ROOT_DIR=' + path.PROJECT_ROOT, 'R=1'])
else:
code = ex.run_cmd('make',
['IOTJS_ROOT_DIR=' + path.PROJECT_ROOT, 'R=0'])
if code == 0:
return True
else:
print 'Failed to build nuttx'
return False
except OSError as err:
print 'Failed to build nuttx: %s' % err
return False
示例11: run_checktest
# 需要导入模块: from common_py.system.filesystem import FileSystem [as 别名]
# 或者: from common_py.system.filesystem.FileSystem import chdir [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')
示例12: run_checktest
# 需要导入模块: from common_py.system.filesystem import FileSystem [as 别名]
# 或者: from common_py.system.filesystem.FileSystem import chdir [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')
示例13: setup_nuttx_root
# 需要导入模块: from common_py.system.filesystem import FileSystem [as 别名]
# 或者: from common_py.system.filesystem.FileSystem import chdir [as 别名]
def setup_nuttx_root(nuttx_root):
# Step 1
fs.maybe_make_directory(nuttx_root)
fs.chdir(nuttx_root)
if not fs.exists('nuttx'):
ex.check_run_cmd('git', ['clone',
'https://bitbucket.org/nuttx/nuttx.git'])
fs.chdir('nuttx')
ex.check_run_cmd('git', ['checkout', NUTTXTAG])
fs.chdir('..')
if not fs.exists('apps'):
ex.check_run_cmd('git', ['clone',
'https://bitbucket.org/nuttx/apps.git'])
fs.chdir('apps')
ex.check_run_cmd('git', ['checkout', NUTTXTAG])
fs.chdir('..')
# Step 2
fs.maybe_make_directory(fs.join(nuttx_root, 'apps', 'system', 'iotjs'))
for file in fs.listdir(fs.join(path.PROJECT_ROOT,
'config', 'nuttx', 'stm32f4dis','app')):
fs.copy(fs.join(path.PROJECT_ROOT, 'config',
'nuttx', 'stm32f4dis', 'app', file),
fs.join(nuttx_root, 'apps', 'system', 'iotjs'))
# Step 3
fs.chdir(fs.join(nuttx_root, 'nuttx', 'tools'))
ex.check_run_cmd('./configure.sh', ['stm32f4discovery/usbnsh'])
fs.chdir('..')
fs.copy(fs.join(path.PROJECT_ROOT,
'config',
'nuttx',
'stm32f4dis',
'.config.travis'),
'.config')
示例14: build_iotjs
# 需要导入模块: from common_py.system.filesystem import FileSystem [as 别名]
# 或者: from common_py.system.filesystem.FileSystem import chdir [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
示例15: build_tizenrt
# 需要导入模块: from common_py.system.filesystem import FileSystem [as 别名]
# 或者: from common_py.system.filesystem.FileSystem import chdir [as 别名]
build_tizenrt(tizenrt_root, path.PROJECT_ROOT, buildtype)
elif test == "nuttx":
current_dir = os.getcwd()
for buildtype in option.buildtype:
nuttx_root=fs.join(path.PROJECT_ROOT, 'deps', 'nuttx')
setup_nuttx_root(nuttx_root)
build_nuttx(nuttx_root, buildtype, 'context')
build(buildtype, ['--target-arch=arm',
'--target-os=nuttx',
'--nuttx-home=' + fs.join(nuttx_root, 'nuttx'),
'--target-board=stm32f4dis',
'--jerry-heaplimit=78']
+ os_dependency_module['nuttx'] + build_args)
build_nuttx(nuttx_root, buildtype, 'all')
fs.chdir(current_dir)
elif test == "misc":
args = []
if os.getenv('TRAVIS') != None:
args = ['--travis']
ex.check_run_cmd('tools/check_signed_off.sh', args)
if not check_tidy(path.PROJECT_ROOT):
ex.fail("Failed tidy check")
build("debug", build_args)
build("debug", ['--iotjs-minimal-profile'] + build_args)
elif test == "no-snapshot":
args = []