本文整理汇总了Python中subprocess32.check_call函数的典型用法代码示例。如果您正苦于以下问题:Python check_call函数的具体用法?Python check_call怎么用?Python check_call使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了check_call函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: build
def build(self):
if "Makefile" in os.listdir(os.getcwd()):
subprocess.check_call(["make", "clean"])
subprocess.check_call(["autoreconf", "--install"])
subprocess.check_call(["automake"])
subprocess.check_call(["./configure", "CFLAGS=-g"])
subprocess.check_call(["make"], stderr=subprocess.STDOUT)
开发者ID:msaxena2,项目名称:evaluation,代码行数:7,代码来源:tsan.py
示例2: _autodetect_unzip_command
def _autodetect_unzip_command():
unzip_cmd = None
unzip_output = None
try:
unzip_output = subprocess.check_output(["unzip", "-v"])
unzip_cmd = "unzip -q $ARCHIVE"
except subprocess.CalledProcessError as e:
pass
# On MacOS Yosemite, unzip does not support Zip64, but ditto is available.
# See: https://github.com/vivlabs/instaclone/issues/1
if not unzip_cmd or not unzip_output or unzip_output.find("ZIP64_SUPPORT") < 0:
log.debug("did not find 'unzip' with Zip64 support; trying ditto")
try:
# ditto has no simple flag to check its version and exit with 0 status code.
subprocess.check_call(["ditto", "-c", "/dev/null", tempfile.mktemp()])
unzip_cmd = "ditto -x -k $ARCHIVE ."
except subprocess.CalledProcessError as e:
log.debug("did not find ditto")
if not unzip_cmd:
raise ArchiveError("Archive handling requires 'unzip' or 'ditto' in path")
log.debug("unzip command: %s", unzip_cmd)
return unzip_cmd
开发者ID:vivlabs,项目名称:instaclone,代码行数:25,代码来源:archives.py
示例3: init_implementations
def init_implementations():
sys.stdout.write("Initializing kcc -- ")
sys.stdout.flush
os.chdir(location)
subprocess.check_call(["kcc", "-c", "implementations.c", "-o", "implementations.o"])
sys.stdout.write("ok\n")
sys.stdout.flush()
开发者ID:msaxena2,项目名称:svcomp-runner,代码行数:7,代码来源:svcomp_runner.py
示例4: save_results
def save_results(vcs, signature, result_path, patterns):
"""Save results matching `patterns` at `result_path`.
Args:
vcs (easyci.vcs.base.Vcs) - the VCS object for the actual project
(not the disposable copy)
signature (str) - the project state signature
result_path (str) - the path containing the result, usually
a disposable copy of the project
patterns (str) - `rsync`-compatible patterns matching test results
to save.
"""
results_directory = _get_results_directory(vcs, signature)
if not os.path.exists(results_directory):
os.makedirs(results_directory)
with open(os.path.join(results_directory, 'patterns'), 'w') as f:
f.write('\n'.join(patterns))
if not os.path.exists(os.path.join(results_directory, 'results')):
os.mkdir(os.path.join(results_directory, 'results'))
includes = ['--include={}'.format(x)
for x in patterns]
cmd = ['rsync', '-r'] + includes + ['--exclude=*',
os.path.join(result_path, ''),
os.path.join(results_directory, 'results', '')]
subprocess.check_call(cmd)
开发者ID:naphatkrit,项目名称:easyci,代码行数:25,代码来源:results.py
示例5: _got_response
def _got_response(self, queue):
server_list, unsatisfiable_jobs = self._calculator.servers_for_queue(queue)
# Cancel any job/container with unsatisfiable requirements, emitting
# a log explaining why.
for job_uuid, reason in unsatisfiable_jobs.iteritems():
try:
self._client.logs().create(body={
'object_uuid': job_uuid,
'event_type': 'stderr',
'properties': {'text': reason},
}).execute()
# Cancel the job depending on its type
if arvados.util.container_uuid_pattern.match(job_uuid):
subprocess.check_call(['scancel', '--name='+job_uuid])
elif arvados.util.job_uuid_pattern.match(job_uuid):
self._client.jobs().cancel(uuid=job_uuid).execute()
else:
raise Exception('Unknown job type')
self._logger.debug("Cancelled unsatisfiable job '%s'", job_uuid)
except Exception as error:
self._logger.error("Trying to cancel job '%s': %s",
job_uuid,
error)
self._logger.debug("Calculated wishlist: %s",
', '.join(s.id for s in server_list) or "(empty)")
return super(JobQueueMonitorActor, self)._got_response(server_list)
开发者ID:chapmanb,项目名称:arvados,代码行数:26,代码来源:jobqueue.py
示例6: apply_migration_step
def apply_migration_step(
url, username, password, migration, step, instance, phase, engine, migrations_dir, show):
"""Apply migration step."""
print("-- Applying migration step: id={step[id]}, position={step[position]}".format(step=step))
report = ''
exc = None
try:
if step['type'] == engine.dialect.name:
if show:
print(step['code'])
else:
report = 'Executed SQL with rowcount: {0}'.format(engine.execute(step['code']).rowcount)
else:
path = os.path.join(migrations_dir, step['path'])
args = [path]
if step['type'] == 'python':
args.insert(0, sys.executable)
if show:
print('-- Script to be executed: {0}'.format(' '.join(args)))
else:
with CaptureOutput() as capturer:
subprocess.check_call(args)
report = capturer.get_text()
status = 'apl'
except Exception as exc:
report = traceback.format_exc()
status = 'err'
try:
if not show:
print('Applied migration step with status: {0}'.format(status))
print('Reporting status to deployment tool')
data = {
"report": {
"migration": {
"uid": migration['uid']
},
"instance": {
"name": instance,
}
},
"step": {
"id": step['id']
},
"status": status,
"log": report
}
response = requests.post(
'{url}/api/migration-step-reports/'.format(url=url),
auth=(username, password),
data=json.dumps(data, sort_keys=True),
headers={'content-type': 'application/json'}
)
try:
response.raise_for_status()
except Exception:
pprint.pprint(response.json())
raise
finally:
if exc:
six.reraise(exc, None, sys.exc_traceback)
开发者ID:paylogic,项目名称:pdt-client,代码行数:60,代码来源:commands.py
示例7: attach
def attach(self):
if self.attached:
raise Exception("Wrong usage. Ramdisk should not be attached")
if not check_is_same_device_as_root_fs(self.folder):
msg = ('Folder must be on / '
'(ROOT) and must not be a different device (possibly '
'already a RAMDISK)! Maybe try "umount {0}"?').format(self.folder)
raise argparse.ArgumentTypeError(msg)
create_ramdisk_stdout = subprocess.check_output(
['hdid','-nomount', 'ram://{0}'.format(self.size)])
ram_disk_device = create_ramdisk_stdout.strip().strip('\n')
check_is_not_normal_harddrive(ram_disk_device)
logger.info('Created RAM disk {0}'.format(ram_disk_device))
logger.info('Formatting RAM disk...')
format_stdout = subprocess.check_output(['newfs_hfs', ram_disk_device])
#Initialized /dev/rdisk13 as a 512 MB HFS Plus volume
assert format_stdout, format_stdout
old_ionode_nbr = os.stat(self.folder).st_ino
logger.info('Mounting RAM disk {0} as {1}'.format(ram_disk_device, self.folder))
subprocess.check_call(['mount','-t','hfs', ram_disk_device, self.folder])
assert old_ionode_nbr != os.stat(self.folder).st_ino
# TODO: probably remove this
assert not check_is_same_device_as_root_fs(self.folder)
self.ram_disk_device = ram_disk_device
self.attached = True
开发者ID:binarytemple,项目名称:ramdisk-mounter,代码行数:33,代码来源:ramdisk_mounter.py
示例8: _download_file
def _download_file(command_template, remote_loc, local_path):
with atomic_output_file(local_path, make_parents=True) as temp_target:
popenargs = shell_expand_to_popen(command_template,
dict_merge(os.environ, {"REMOTE": remote_loc, "LOCAL": temp_target}))
log.info("downloading: %s", " ".join(popenargs))
# TODO: Find a way to support force here.
subprocess.check_call(popenargs, stdout=SHELL_OUTPUT, stderr=SHELL_OUTPUT, stdin=DEV_NULL)
开发者ID:jlevy,项目名称:instaclone,代码行数:7,代码来源:instaclone.py
示例9: temp_copy
def temp_copy(self):
"""Yields a new Vcs object that represents a temporary, disposable
copy of the current repository. The copy is deleted at the end
of the context.
The following are not copied:
- ignored files
- easyci private directory (.git/eci for git)
Yields:
Vcs
"""
with contextmanagers.temp_dir() as temp_dir:
temp_root_path = os.path.join(temp_dir, "root")
path = os.path.join(self.path, "") # adds trailing slash
check_call(
[
"rsync",
"-r",
"--exclude={}".format(self.private_dir()),
"--filter=dir-merge,- {}".format(self.ignore_patterns_file()),
path,
temp_root_path,
]
)
copy = self.__class__(path=temp_root_path)
yield copy
开发者ID:naphatkrit,项目名称:easyci,代码行数:27,代码来源:base.py
示例10: test_exit_no_option
def test_exit_no_option():
# It's valid to run 'makeotfexe' without using any options,
# but if a default-named font file ('font.ps') is NOT found
# in the current directory, the tool exits with an error
with pytest.raises(subprocess.CalledProcessError) as err:
subprocess.check_call([TOOL])
assert err.value.returncode == 1
开发者ID:adobe-type-tools,项目名称:afdko,代码行数:7,代码来源:makeotfexe_test.py
示例11: run
def run( self, cmd, ignore_failure=False ):
fail_ch, success_ch = self.channel_ids
if ignore_failure:
cmd = '( %s ) ; tmux wait -S %s' % (cmd, success_ch)
else:
cmd = '( %s ) && tmux wait -S %s || tmux wait -S %s' % (cmd, success_ch, fail_ch)
check_call( [ 'tmux', 'send-keys', '-t', self.tmux_id, cmd, 'C-m' ] )
开发者ID:BD2KGenomics,项目名称:cgcloud,代码行数:7,代码来源:create_all_slaves.py
示例12: up_node1
def up_node1(request):
def fin():
subproc.call(['sudo', 'vagrant', 'destroy', '-f', 'node1'])
request.addfinalizer(fin)
subproc.check_call(['sudo', 'vagrant', 'destroy', '-f', 'node1'])
subproc.check_call(['sudo', 'vagrant', 'up', 'node1'])
开发者ID:Andrew8305,项目名称:lain,代码行数:7,代码来源:conftest.py
示例13: compile_native_invocation_handler
def compile_native_invocation_handler(*possible_homes):
'''Find javac and compile NativeInvocationHandler.java.'''
javac = find_javac(possible_homes)
subprocess.check_call([
javac, '-target', '1.6', '-source', '1.6',
join('jnius', 'src', 'org', 'jnius', 'NativeInvocationHandler.java')
])
开发者ID:kivy,项目名称:pyjnius,代码行数:7,代码来源:setup.py
示例14: guarded_join
def guarded_join(*sub_paths, **kwargs):
"""
Uses os.path.join to get path from given args.
checks if path directory is available by using check_call method of
backport from subprocess module from python 3.X (subprocess32) with given
timeout and returns path.
parameters:
[sub_dirs] (strings) - arguments for os.path.join
timeout (int) - Timeout for availablity check in sec. (default 1)
returns:
path (string)
possible Exeptions:
IOError
FileSystemNotAvailable
"""
timeout = kwargs.get("timeout", DEFAULT_TIMEOUT)
full_path = os.path.join(*sub_paths)
# Move this check here to allow check in runtime
if getattr(settings, "GUARDED_JOIN_TEST", False):
raise FileSystemNotAvailable("This is a test Exception. disable in settings")
try:
check_call(["test", "-e", full_path], timeout=timeout)
except CalledProcessError:
raise IOError("No such file or directory: %s" % full_path)
except TimeoutExpired:
raise FileSystemNotAvailable("Cannot access %s. Tried for %s seconds" % (full_path, timeout))
return full_path
开发者ID:STUDITEMPS,项目名称:studitools_storages,代码行数:32,代码来源:path.py
示例15: _mount_local
def _mount_local(self, file_name_no_extension):
"""
Mount a image-file to a class-defined folder.
Aborts if the mount command fails.
Args:
file_name_no_extension (str):
The file name of the image that will be flashed on the device
Returns:
None
"""
logger.info(
"Mounting the root partition for ssh-key and USB-networking " +
"service injection.")
try:
common.make_directory(self._LOCAL_MOUNT_DIR)
root_file_system_file = file_name_no_extension + "." + \
self._root_extension
# guestmount allows us to mount the image without root privileges
subprocess32.check_call(
["guestmount", "-a", root_file_system_file, "-m", "/dev/sda", self._LOCAL_MOUNT_DIR])
except subprocess32.CalledProcessError as err:
logger.info("Failed to mount.")
common.log_subprocess32_error_and_abort(err)
开发者ID:Valtis,项目名称:AFT,代码行数:28,代码来源:edisondevice.py
示例16: up_node3
def up_node3():
subproc.check_call(['vagrant', 'destroy', '-f', 'node3'])
subproc.check_call(['vagrant', 'up', 'node3'])
yield "node3 is ready"
print("Destroying node3...")
subproc.call(['vagrant', 'destroy', '-f', 'node3'])
print("Node3 is destroyed.")
开发者ID:laincloud,项目名称:lain,代码行数:8,代码来源:conftest.py
示例17: ensure_latest_version
def ensure_latest_version():
other_location = check_other_version()
if not other_location:
return
dropbox_exe = os.path.join(other_location, u'dropboxd').encode(sys.getfilesystemencoding())
cmd = [dropbox_exe, '/newerversion'] + sys.argv[1:]
subprocess.check_call(cmd, close_fds=True, cwd=u'/')
raise Exception('The newer version exited without killing us')
开发者ID:bizonix,项目名称:DropBoxLibrarySRC,代码行数:8,代码来源:startup.py
示例18: up_node1
def up_node1():
subproc.check_call(['vagrant', 'destroy', '-f', 'node1'])
subproc.check_call(['vagrant', 'up', 'node1', '--no-provision'])
yield "node1 is ready"
print("Destroying node1...")
subproc.call(['vagrant', 'destroy', '-f', 'node1'])
print("Node1 is destroyed.")
开发者ID:laincloud,项目名称:lain,代码行数:8,代码来源:conftest.py
示例19: compile_runner
def compile_runner():
# where is it?
cwd = os.path.dirname(os.path.realpath(__file__))
run_path = os.path.join(cwd, "benchmarks/run.rkt")
# compile it
print "compiling benchmark runner..."
subprocess.check_call(["raco", "make", run_path])
开发者ID:uwplse,项目名称:synapse,代码行数:8,代码来源:run.py
示例20: set_veth_mac
def set_veth_mac(veth_name_host, mac):
"""
Set the veth MAC address.
:param veth_name_host: The name of the veth.
:param mac: The MAC address.
:return: None. Raises CalledProcessError on error.
"""
# TODO MAC should be an EUI object.
check_call(["ip", "link", "set", "dev", veth_name_host, "address", mac], timeout=IP_CMD_TIMEOUT)
开发者ID:cheuschober,项目名称:libcalico,代码行数:9,代码来源:netns.py
注:本文中的subprocess32.check_call函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论