本文整理汇总了Python中shell.execute函数的典型用法代码示例。如果您正苦于以下问题:Python execute函数的具体用法?Python execute怎么用?Python execute使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了execute函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
示例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
示例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')
示例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)
示例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()
示例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)
示例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)
示例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)
示例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)
示例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)
示例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()
示例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())
示例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")
示例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
示例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