本文整理汇总了Python中shell.execute函数的典型用法代码示例。如果您正苦于以下问题:Python execute函数的具体用法?Python execute怎么用?Python execute使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了execute函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: configure
def configure(args = "", preexec= "", debug='disable', shared='shared', deptrack = '', hosttarget = 'both'):
if not shared:
shared = ''
else:
shared = '--disable-shared --enable-static' if environ.static else '--enable-shared --disable-static'
if not debug:
debug = ''
else:
debug = '--enable-debug' if environ.debug else '--disable-debug'
if deptrack == 'disable':
deptrack = '--disable-dependency-tracking'
else:
deptrack = ''
# XXXXXXXXXXXS STOOOPID
# x86_64-apple-darwin11.2.0
host = ''
if hosttarget == 'both':
build = sh('echo `uname -m`-apple-darwin`uname -r`', output = False)
if environ.get('MONADE_HOST') != build.strip():
host = '--host=%s --build=%s' % (environ.get('MONADE_HOST'), build.strip())
act = fs.join(environ.src, technicolor.local, 'configure')
command = '%s %s --with-pic --prefix="%s" %s %s %s %s' % (act, deptrack, environ.prefix, shared, debug, host, args)
shell.execute(environ.flush(), command, environ.pwd, preexec)
开发者ID:webitup,项目名称:technicolor-yawn,代码行数:25,代码来源:__init__.py
示例2: setup_config
def setup_config(self, config):
"""
Assume `project_name` is a directory in the current folder
(This is justified by __init__)
Check that a benchmark/ folder exists with the right variation.
If not, create it.
"""
benchmark_dir = "%s/benchmark" % self.project_name
variation_dir = "%s/variation%s" % (benchmark_dir, config)
both_dir = "%s/both" % self.project_name
ty_dir = "%s/typed" % self.project_name
un_dir = "%s/untyped" % self.project_name
if not os.path.exists(benchmark_dir):
print("INFO: creating directory '%s'" % benchmark_dir)
os.mkdir(benchmark_dir)
if not os.path.exists(variation_dir):
print("INFO: creating and filling directory '%s'" % variation_dir)
os.mkdir(variation_dir)
if os.path.exists(both_dir):
shell.execute("cp %s/* %s" % (both_dir, variation_dir))
for i in range(len(config)):
char = config[i]
fname = self.module_names[i].rsplit("/", 1)[-1]
home = ty_dir if char == "1" else un_dir
shell.execute("cp %s/%s %s" % (home, fname, variation_dir))
return
开发者ID:bennn,项目名称:gradual-typing-performance,代码行数:26,代码来源:SrsSummary.py
示例3: stop_p2p_persistent_network
def stop_p2p_persistent_network(control_socket_dir, control_iface, iface):
try:
shell.execute(
'%s -p %s -i %s p2p_group_remove %s' %
(P2P_CLI_PATH, control_socket_dir, control_iface, iface))
except:
LOGGER.error('failed to stop p2p persistent network')
开发者ID:catoc,项目名称:fqrouter,代码行数:7,代码来源:wifi.py
示例4: setnewflowtargets
def setnewflowtargets(self, streamuuid):
shouter.shout("Set new Flowtargets")
if not self.hasflowtarget(streamuuid):
shell.execute("%s add flowtarget -r %s %s %s" % (self.scmcommand, self.repo, self.workspace, streamuuid))
command = "%s set flowtarget -r %s %s --default --current %s" % (self.scmcommand, self.repo, self.workspace, streamuuid)
shell.execute(command)
开发者ID:cwill747,项目名称:rtc2git,代码行数:7,代码来源:rtcFunctions.py
示例5: simulateCreationAndRenameInGitRepo
def simulateCreationAndRenameInGitRepo(self, originalfilename, newfilename):
open(originalfilename, 'a').close() # create file
Initializer.initialcommit()
Commiter.pushmaster()
os.rename(originalfilename, newfilename) # change capitalization
shell.execute("git add -A")
Commiter.handle_captitalization_filename_changes()
开发者ID:ohumbel,项目名称:rtc2git,代码行数:7,代码来源:test_gitFunctions.py
示例6: pushbranch
def pushbranch(branchname, force=False):
if branchname:
shouter.shout("Push of branch " + branchname)
if force:
return shell.execute("git push -f origin " + branchname)
else:
return shell.execute("git push origin " + branchname)
开发者ID:ohumbel,项目名称:rtc2git,代码行数:7,代码来源:gitFunctions.py
示例7: build_object
def build_object(self, target_name, out_filename, in_filename, include_dirs,
compiler_flags):
abs_source = os.path.join(os.getcwd(), in_filename)
ui.debug("building object " + out_filename)
with ui.ident:
prerequisites = self.__fetch_includes(target_name, abs_source,
include_dirs, compiler_flags)
prerequisites.append(in_filename)
ui.debug("appending prerequisites from pake modules: {!s}"
.format(fsutils.pake_files))
prerequisites.extend(fsutils.pake_files)
ui.debug("prerequisites: {!r}".format(prerequisites))
if fsutils.is_any_newer_than(prerequisites, out_filename):
fsutils.mkdir_recursive(os.path.dirname(out_filename));
cmd = configurations.compiler() + " " + self.__prepare_compiler_flags(include_dirs, compiler_flags) + " -c -o " + out_filename + " " + abs_source
if command_line.args.verbose:
ui.step(configurations.compiler(), cmd)
else:
ui.step(configurations.compiler(), in_filename)
shell.execute(cmd)
开发者ID:podusowski,项目名称:pake,代码行数:29,代码来源:compiler.py
示例8: getchangeentriesbytypeandvalue
def getchangeentriesbytypeandvalue(self, comparetype, value):
dateformat = "yyyy-MM-dd HH:mm:ss"
outputfilename = self.config.getlogpath("Compare_" + comparetype + "_" + value + ".txt")
comparecommand = "%s --show-alias n --show-uuid y compare ws %s %s %s -r %s -I sw -C @@{name}@@{email}@@ --flow-directions i -D @@\"%s\"@@" \
% (self.config.scmcommand, self.config.workspace, comparetype, value, self.config.repo, dateformat)
shell.execute(comparecommand, outputfilename)
return ImportHandler.getchangeentriesfromfile(outputfilename)
开发者ID:cwill747,项目名称:rtc2git,代码行数:7,代码来源:rtcFunctions.py
示例9: kill_worker
def kill_worker():
worker_pid = find_worker_pid()
if worker_pid is None:
print "Error: failed to find worker pid"
return
fail_cmd = "sudo kill -9 %s" % (worker_pid)
execute(fail_cmd, verbose=True)
开发者ID:fmacias64,项目名称:big-data-system,代码行数:7,代码来源:run_spark_query.py
示例10: setcomponentstobaseline
def setcomponentstobaseline(self, componentbaselineentries, streamuuid):
for entry in componentbaselineentries:
shouter.shout("Set component '%s'(%s) to baseline '%s' (%s)" % (entry.componentname, entry.component,
entry.baselinename, entry.baseline))
replacecommand = "%s set component -r %s -b %s %s stream %s %s --overwrite-uncommitted" % \
(self.scmcommand, self.repo, entry.baseline, self.workspace, streamuuid, entry.component)
shell.execute(replacecommand)
开发者ID:cwill747,项目名称:rtc2git,代码行数:8,代码来源:rtcFunctions.py
示例11: createandload
def createandload(self, stream, componentbaselineentries=[]):
shell.execute("%s create workspace -r %s -s %s %s" % (self.scmcommand, self.repo, stream, self.workspace))
if componentbaselineentries:
self.setcomponentstobaseline(componentbaselineentries, stream)
else:
self.setcomponentstobaseline(ImportHandler(self.config).determineinitialbaseline(stream),
stream)
self.load()
开发者ID:cwill747,项目名称:rtc2git,代码行数:8,代码来源:rtcFunctions.py
示例12: load
def load(self):
command = "%s load -r %s %s --force" % (self.scmcommand, self.repo, self.workspace)
if self.config.includecomponentroots:
command += " --include-root"
shouter.shout("Start (re)loading current workspace: " + command)
shell.execute(command)
shouter.shout("Load of workspace finished")
Commiter.restore_shed_gitignore(Commiter.get_untracked_statuszlines())
开发者ID:ohumbel,项目名称:rtc2git,代码行数:8,代码来源:rtcFunctions.py
示例13: addandcommit
def addandcommit(changeentry):
Commiter.replaceauthor(changeentry.author, changeentry.email)
shell.execute("git add -A")
shell.execute(Commiter.getcommitcommand(changeentry))
Commiter.commitcounter += 1
if Commiter.commitcounter is 30:
shouter.shout("30 Commits happend, push current branch to avoid out of memory")
Commiter.pushbranch("")
Commiter.commitcounter = 0
shouter.shout("Commited change in local git repository")
开发者ID:jacobilsoe,项目名称:rtc2git,代码行数:10,代码来源:gitFunctions.py
示例14: get_working_hotspot_iface_using_wext
def get_working_hotspot_iface_using_wext():
try:
if 'Mode:Master' in shell.execute('%s %s' % (IWCONFIG_PATH, 'wl0.1')):
return 'wl0.1'
if 'Mode:Master' in shell.execute('%s %s' % (IWCONFIG_PATH, WIFI_INTERFACE)):
return WIFI_INTERFACE
return None
except:
LOGGER.exception('failed to get working hotspot iface using wext')
return None
开发者ID:catoc,项目名称:fqrouter,代码行数:10,代码来源:wifi.py
示例15: start_p2p_persistent_network
def start_p2p_persistent_network(iface, control_socket_dir, ssid, password, sets_channel=False):
shell.execute('%s -p %s -i %s p2p_set disabled 0' % (P2P_CLI_PATH, control_socket_dir, iface))
shell.execute(
'%s -p %s -i %s set driver_param use_p2p_group_interface=1' % (P2P_CLI_PATH, control_socket_dir, iface))
index = shell.execute('%s -p %s -i %s add_network' % (P2P_CLI_PATH, control_socket_dir, iface)).strip()
def set_network(param):
shell.execute('%s -p %s -i %s set_network %s %s' % (P2P_CLI_PATH, control_socket_dir, iface, index, param))
set_network('mode 3')
set_network('disabled 2')
set_network('ssid \'"%s"\'' % ssid)
set_network('key_mgmt WPA-PSK')
set_network('proto RSN')
set_network('pairwise CCMP')
set_network('psk \'"%s"\'' % password)
frequency, channel = get_upstream_frequency_and_channel()
if channel:
channel = channel if sets_channel else 0
reg_class = 81 if sets_channel else 0
reset_p2p_channels(iface, control_socket_dir, channel, reg_class)
reset_p2p_channels(WIFI_INTERFACE, get_wpa_supplicant_control_socket_dir(), channel, reg_class)
if frequency:
shell.execute('%s -p %s -i %s p2p_group_add persistent=%s freq=%s ' %
(P2P_CLI_PATH, control_socket_dir, iface, index, frequency.replace('.', '')))
else:
shell.execute('%s -p %s -i %s p2p_group_add persistent=%s' % (P2P_CLI_PATH, control_socket_dir, iface, index))
time.sleep(2)
return index
开发者ID:catoc,项目名称:fqrouter,代码行数:29,代码来源:wifi.py
示例16: copy_resources
def copy_resources(self, toolchain):
root_dir = os.getcwd()
os.chdir(self.common_parameters.root_path)
for resource in self.common_parameters.resources.eval():
ui.step("copy", resource)
shell.execute("rsync --update -r '{resource}' '{build_dir}/'"
.format(resource=resource,
build_dir=toolchain.build_dir()))
os.chdir(root_dir)
开发者ID:podusowski,项目名称:pake,代码行数:11,代码来源:targets.py
示例17: execute_testcases
def execute_testcases():
testcases = ['java MessageLoopEditor < sampleInput.txt | diff - sampleOutput1.txt']
for test_cmd in testcases:
try:
execute("echo '\n----> %s' >> grade.out" % test_cmd)
execute("%s >> grade.out 2>&1" % test_cmd, verbose=True)
except subprocess.CalledProcessError:
# ignore
pass
return
开发者ID:zarcen,项目名称:cs367_p2_grading,代码行数:11,代码来源:grade_learnUW.py
示例18: execute_testing_programs
def execute_testing_programs(submission_dir):
src_dir = os.path.dirname(os.path.realpath(__file__))
cp_files = ['ArrayListLoop.java', 'DblListnode.java', 'LinkedLoopTester.java', 'Loop.java']
for root, dirs, files in os.walk(submission_dir, topdown=True):
for student_dir in dirs:
for f in cp_files:
fp = os.path.join(src_dir, f)
shutil.copy(fp, os.path.join(root, student_dir))
testfiles_cp = "cp -f *.txt '%s'\n" % (os.path.join(root, student_dir))
execute(testfiles_cp, verbose=True)
execute_tester_in_student_dir(os.path.join(root, student_dir))
开发者ID:zarcen,项目名称:cs367_p2_grading,代码行数:11,代码来源:grade_learnUW.py
示例19: restart_thrift
def restart_thrift(custom_conf=""):
while True:
kill_thrift = "ps -ef |grep hive.thriftserver|grep -v grep | awk '{print $2}' | xargs kill"
execute(kill_thrift, ignored_returns=[123], verbose=True)
try:
res = execute("ss -tlnp |grep 10000")
except subprocess.CalledProcessError as e:
if e.returncode == 1: # have not get up
break
else:
time.sleep(1)
return start_thrift(custom_conf)
开发者ID:fmacias64,项目名称:big-data-system,代码行数:12,代码来源:run_spark_query.py
示例20: setup_networking
def setup_networking(hotspot_interface):
control_socket_dir = get_wpa_supplicant_control_socket_dir()
setup_network_interface_ip(hotspot_interface, '10.24.1.1', '255.255.255.0')
try:
shell.execute('%s dnsmasq' % KILLALL_PATH)
except:
LOGGER.exception('failed to killall dnsmasq')
shell.execute('%s -i %s --dhcp-authoritative --no-negcache --user=root --no-resolv --no-hosts '
'--server=8.8.8.8 --dhcp-range=10.24.1.2,10.24.1.254,12h '
'--dhcp-leasefile=/data/data/fq.router/dnsmasq.leases '
'--pid-file=/data/data/fq.router/dnsmasq.pid' % (DNSMASQ_PATH, hotspot_interface))
log_upstream_wifi_status('after setup networking', control_socket_dir)
开发者ID:catoc,项目名称:fqrouter,代码行数:12,代码来源:wifi.py
注:本文中的shell.execute函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论