本文整理汇总了Python中utils.system函数的典型用法代码示例。如果您正苦于以下问题:Python system函数的具体用法?Python system怎么用?Python system使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了system函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: unpack
def unpack( self ):
svnpath = self.kdeSvnPath()
utils.cleanDirectory( self.workdir )
if svnpath:
if not self.kdeSvnUnpack( svnpath, "scripts" ):
return False
for pkg in self.subinfo.languages.split():
if not self.kdeSvnUnpack( svnpath, pkg ):
return False
else:
print "Unpacked %s" % pkg
autogen = os.path.join( self.packagedir , "autogen.py" )
svnpath = os.path.join( self.kdesvndir, svnpath )
# execute autogen.py and generate the CMakeLists.txt files
cmd = "cd %s && python %s %s" % \
(svnpath , autogen, self.subinfo.languages )
utils.system( cmd )
else:
filenames = []
for pkg in self.subinfo.languages.split():
if not self.subinfo.buildTarget in self.subinfo.targets.keys():
return False
tgt = self.subinfo.buildTarget
filenames.append( 'kde-l10n-' + pkg + '-' + tgt + '.tar.bz2' )
if not utils.unpackFiles( self.downloaddir, filenames, self.workdir ):
return False
# no need for autogen.py - CMake scripts are already created
return True
开发者ID:KDE,项目名称:emerge-history,代码行数:33,代码来源:l10n-kde4-20080320.py
示例2: unpack
def unpack( self ):
svnpath = self.kdeSvnPath()
utils.cleanDirectory( self.workdir )
if svnpath:
if not self.kdeSvnUnpack( svnpath, "scripts" ):
return False
for pkg in self.subinfo.languages.split():
if not self.kdeSvnUnpack( svnpath, pkg ):
return False
autogen = os.path.join( self.packagedir , "autogen.py" )
svnpath = os.path.join( self.kdesvndir, svnpath )
# execute autogen.py and generate the CMakeLists.txt files
cmd = [ "python", autogen, self.subinfo.languages ]
# FIXME comment out once libxslt works again
cmd.append( "--disable-docs" )
utils.system( cmd )
else:
filenames = []
for pkg in self.subinfo.languages.split():
if not self.subinfo.buildTarget in self.subinfo.targets.keys():
return False
tgt = self.subinfo.buildTarget
filenames.append( 'kde-l10n-' + pkg + '-' + tgt + '.tar.bz2' )
if not utils.unpackFiles( self.downloaddir, filenames, self.workdir ):
return False
# no need for autogen.py - CMake scripts are already created
return True
开发者ID:KDE,项目名称:emerge-history,代码行数:32,代码来源:l10n-kde4-e5-20110117.py
示例3: run_once
def run_once(self):
# check if the screensaver process is running and alive
try:
utils.system('export DISPLAY=:0.0 && xscreensaver-command -version')
except error.CmdError, e:
logging.debug(e)
raise error.TestFail('xscreensaver is not alive')
开发者ID:wenhann,项目名称:chromiumos,代码行数:7,代码来源:ui_ScreenSaverRunning.py
示例4: failure_epilogue
def failure_epilogue (self):
if expected:
print("Could not stat {} - was expected to be present".format(rootfs))
else:
print("Sliver rootfs {} still present - this is unexpected".format(rootfs))
utils.system(self.test_ssh.actual_command("ls -l {rootfs}; du -hs {rootfs}".format(**locals()),
dry_run=self.dry_run, timeout=20))
开发者ID:dreibh,项目名称:planetlab-lxc-tests,代码行数:7,代码来源:TestSlice.py
示例5: dld_genome_data
def dld_genome_data( fname, url_prefix='ftp://ftp.ncbi.nih.gov/genomes/Bacteria/' ):
bname = os.path.basename( fname ) ## e.g. NC_002937
try:
os.makedirs( 'GENOMES' )
except:
pass
if not os.path.isfile( 'GENOMES/' + bname + '.gff' ):
try:
os.remove('GENOMES/' + bname + '.gff'); os.remove('GENOMES/' + bname + '.fna');
except:
pass
os.chdir( 'GENOMES' )
cmd = "wget '" + url_prefix + fname + ".gff'"
tmp = ut.system( cmd )
cmd = "wget '" + url_prefix + fname + ".fna'"
tmp = ut.system( cmd )
myfile = open( bname + '.fna', 'r' )
line = myfile.readline()
myfile.close()
cmd = "../rpl '" + line.strip() + "' '>" + line.split('|')[3] + "' " + bname + '.fna'
tmp = ut.system( cmd )
ut.system( "awk '($3==\"gene\"){print}' " + bname + ".gff > " + bname + "_genes.gff" )
os.chdir( '..' )
开发者ID:baliga-lab,项目名称:discovery2014,代码行数:28,代码来源:starproc.py
示例6: run_once
def run_once(self, binary = '/opt/google/chrome/chrome'):
# Try to kill all running instances of the binary.
try:
utils.system('pkill -KILL -f %s' % binary)
except error.CmdError, e:
logging.debug(e)
raise error.TestFail('%s is not running before kill' % binary)
开发者ID:wenhann,项目名称:chromiumos,代码行数:7,代码来源:ui_ChromeKillRestart.py
示例7: make
def make( self ):
build, bt, toolsetSwitches = self.getBuildSettings();
return utils.system("msbuild /target:lib_mpir_gc \"%s\" /p:Configuration=%s %s" %
(os.path.join(self.sourceDir(), build, "mpir.sln"), bt, toolsetSwitches)
) and utils.system("msbuild /target:dll_mpir_gc \"%s\" /p:Configuration=%s %s" %
(os.path.join(self.sourceDir(), build, "mpir.sln"), bt, toolsetSwitches)
)
开发者ID:pgquiles,项目名称:kdewindows-emerge,代码行数:8,代码来源:mpir.py
示例8: qemu_local_init
def qemu_local_init(self):
"all nodes : init a clean local directory for holding node-dep stuff like iso image..."
utils.system("rm -rf {}".format(self.nodedir()))
utils.system("mkdir {}".format(self.nodedir()))
if not self.is_qemu():
return True
return utils.system("rsync -v -a --exclude .svn template-qemu/ {}/"\
.format(self.nodedir())) == 0
开发者ID:dreibh,项目名称:planetlab-lxc-tests,代码行数:8,代码来源:TestNode.py
示例9: compile
def compile( self ):
if self.compiler == "mingw":
compiler = "mingw32"
else:
compiler = "do_ms"
workdir = os.path.join( self.workdir, self.instsrcdir )
cmd = 'cd %s && ms\\%s' % ( workdir, compiler )
print cmd
utils.system( cmd ) or utils.die( "failed on command: %s" % cmd )
return True
开发者ID:KDE,项目名称:emerge-history,代码行数:10,代码来源:new-openssl-src-0.9.8g.py
示例10: compile
def compile( self ):
cmd = 'cd %s && python configure.py -b %s -w' % ( os.path.join( self.workdir, self.instsrcdir ),
os.path.join( self.imagedir, "bin" ) )
if self.compiler == "mingw":
cmd += " -p win32-g++"
utils.system( cmd ) or utils.die( "failed to execute %s" % cmd )
sedcommand = r""" -e "s/""" + os.path.join( self.rootdir, "tmp", "qt" ).replace('\\', '\\/') + "*\\/image-mingw\\/" + """/""" + self.rootdir.replace('\\', '\\/') + """/g" """
utils.sedFile( os.path.join( self.workdir, self.instsrcdir ), "pyqtconfig.py", sedcommand )
cmd = 'cd %s && %s' % ( os.path.join( self.workdir, self.instsrcdir ), self.cmakeMakeProgramm )
utils.system( cmd ) or utils.die( "failed to execute %s" % cmd )
return True
开发者ID:KDE,项目名称:emerge-history,代码行数:11,代码来源:pyqt-4.3.3.py
示例11: __init__
def __init__( self, parent=None ):
self.parent = self
if parent:
self.parent = parent
self.output = False
self.outFile = None
self.graphVizInstallPath = None
if not self.isInstalled():
utils.system("emerge.bat graphviz")
if not self.isInstalled():
utils.die("could not find installed graphviz package, you may download and install it from http://www.graphviz.org/Download.php")
开发者ID:pombredanne,项目名称:emerge-1,代码行数:11,代码来源:graphviz.py
示例12: install
def install( self ):
if self.isTargetBuild():
# Configuring Qt for WinCE ignores the -prefix option,
# so we have to do the job manually...
# delete this because it is not working for windows
utils.deleteFile( os.path.join( self.buildDir(), "plugin", "bearer", "qnmbearerd4.dll" ))
utils.deleteFile( os.path.join( self.buildDir(), "plugin", "bearer", "qnmbearer4.dll" ))
# syncqt expects qconfig.h to be in the install dir and fails if not
utils.createDir( os.path.join( self.installDir(), "src", "corelib", "global") )
utils.copyFile( os.path.join( self.buildDir(), "src", "corelib", "global", "qconfig.h" ), os.path.join( self.installDir(), "src", "corelib" , "global", "qconfig.h" ) )
# headers need to be copied using syncqt because of the relative paths
utils.prependPath(self.sourceDir(), "bin")
command = os.path.join(self.sourceDir(), "bin", "syncqt.bat")
command += " -base-dir \"" + self.sourceDir() + "\""
command += " -outdir \"" + self.installDir() + "\""
command += " -copy"
command += " -quiet"
utils.system( command )
utils.copySrcDirToDestDir( os.path.join( self.buildDir(), "bin" ) , os.path.join( self.installDir(), "bin" ) )
utils.copySrcDirToDestDir( os.path.join( self.buildDir(), "lib" ) , os.path.join( self.installDir(), "lib" ) )
# the dlls must be copied to the bin dir too
for file in os.listdir( os.path.join( self.installDir(), "lib" ) ):
if file.endswith( ".dll" ):
utils.copyFile( os.path.join( self.installDir(), "lib" , file ), os.path.join( self.installDir(), "bin" , file ) )
utils.copySrcDirToDestDir( os.path.join( self.buildDir(), "mkspecs" ) , os.path.join( self.installDir(), "mkspecs" ) )
utils.copySrcDirToDestDir( os.path.join( self.buildDir(), "plugins" ) , os.path.join( self.installDir(), "plugins" ) )
# create qt.conf
utils.copyFile( os.path.join( self.packageDir(), "qt.conf" ), os.path.join( self.installDir(), "bin", "qt.conf" ) )
return True
if not QMakeBuildSystem.install(self):
return False
# Workaround QTBUG-12034
utils.copySrcDirToDestDir( os.path.join( self.buildDir(), "plugins", "imageformats" ) ,
os.path.join( self.installDir(), "bin", "imageformats" ) )
# create qt.conf
utils.copyFile( os.path.join( self.packageDir(), "qt.conf" ), os.path.join( self.installDir(), "bin", "qt.conf" ) )
# install msvc debug files if available
if self.buildType() == "Debug" and (self.compiler() == "msvc2005" or self.compiler() == "msvc2008" or self.compiler() == "msvc2010"):
srcdir = os.path.join( self.buildDir(), "lib" )
destdir = os.path.join( self.installDir(), "lib" )
filelist = os.listdir( srcdir )
for file in filelist:
if file.endswith( ".pdb" ):
utils.copyFile( os.path.join( srcdir, file ), os.path.join( destdir, file ) )
return True
开发者ID:KDE,项目名称:emerge-history,代码行数:53,代码来源:qt-4.7.1.20101224.py
示例13: some_zeroed_input_file
def some_zeroed_input_file(self, prefix, mbytes):
name = os.path.join(self.workdir,
'%s%d' % (prefix, self.input_file_count))
self.input_file_count += 1
# TODO: use actual disk file size, avoid rebuilding across iterations
old_mbytes = self.existing_input_files.get(name, 0)
if mbytes > old_mbytes:
cmd = ('/bin/dd if=/dev/zero of=%s bs=1M seek=%d count=%d'
% (name, old_mbytes, mbytes-old_mbytes))
utils.system(cmd)
self.existing_input_files[name] = mbytes
return name
开发者ID:google,项目名称:blkcgroup,代码行数:12,代码来源:blkcgroup_test_lib.py
示例14: kill_slower_workers
def kill_slower_workers(fast_pid, cpu_cgroup, pids_file):
moved_pids_file = pids_file + '.moved'
try:
os.rename(pids_file, moved_pids_file)
except OSError:
return
logging.debug('fastest worker pid %d of container %s'
' killing all slower workers',
fast_pid, cpu_cgroup.path)
for line in open(moved_pids_file):
pid = int(line.rstrip())
if pid != fast_pid:
utils.system('kill %d' % pid, ignore_status=True)
开发者ID:google,项目名称:blkcgroup,代码行数:13,代码来源:blkcgroup_test_lib.py
示例15: patch
def patch():
os.chdir(utils.mojo_root_dir)
utils.filter_file("build/landmines.py", lambda line: not "gyp" in line)
utils.commit("filter gyp out of build/landmines.py")
utils.filter_file("gpu/BUILD.gn", lambda line: not "//gpu/ipc" in line)
utils.commit("filter gpu/ipc out of gpu/BUILD.gn")
for p in utils.find(["*.patch"], os.path.dirname(os.path.realpath(__file__))):
print "applying patch %s" % os.path.basename(p)
utils.system(["git", "apply", p])
utils.commit("applied patch %s" % os.path.basename(p))
开发者ID:dalecurtis,项目名称:mojo,代码行数:13,代码来源:patch.py
示例16: make_package
def make_package( self ):
self.svnpath = os.path.join( self.kdesvndir, self.subinfo.svnTargets['svnHEAD'] )
dstpath = self.packageDestinationDir(withBuildType=False)
if not utils.test4application( "kdewin-packager" ):
utils.die( "kdewin-packager not found - please make sure it is in your path" )
for pkg in self.subinfo.languages.split():
workdir = os.path.join( self.workdir, pkg )
cmd = "kdewin-packager -name kde-l10n-%s -version %s -hashfirst -compression 2 -root %s/%s -destdir %s" % \
( pkg, self.buildTarget, self.imagedir, pkg, dstpath )
utils.system( cmd )
return True
开发者ID:KDE,项目名称:emerge-history,代码行数:13,代码来源:l10n-kde4-e5-20110117.py
示例17: sedFile
def sedFile(self, directory, fileName, sedcommand ):
""" runs the given sed command on the given file """
olddir = os.getcwd()
try:
os.chdir( directory )
backup = "%s.orig" % fileName
if( os.path.isfile( backup ) ):
os.remove( backup )
command = "sed -i.orig %s %s" % ( sedcommand, fileName )
utils.system( command )
finally:
os.chdir( olddir )
开发者ID:pgquiles,项目名称:kdewindows-emerge,代码行数:14,代码来源:shared-mime-info.py
示例18: configure
def configure( self, buildType=None, defines=""):
thirdparty_dir = os.path.join( self.buildDir(), "3rdparty" )
utils.prependPath(self.buildDir(), "bin")
configure = os.path.join( self.sourceDir(), "configure.exe" ).replace( "/", "\\" )
self.enterBuildDir()
# so that the mkspecs can be found, when -prefix is set
os.putenv( "QMAKEPATH", self.sourceDir() )
# configure qt
# prefix = os.path.join( self.rootdir, "qt" ).replace( "\\", "/" )
prefix = self.installDir()
platform = ""
libtmp = os.getenv( "LIB" )
inctmp = os.getenv( "INCLUDE" )
if self.compiler() == "msvc2005" or self.compiler() == "msvc2008":
platform = "win32-%s" % self.compiler()
elif self.compiler() == "mingw":
os.environ[ "LIB" ] = ""
os.environ[ "INCLUDE" ] = ""
platform = "win32-g++"
else:
exit( 1 )
os.environ[ "USERIN" ] = "y"
userin = "y"
command = r"echo %s | %s -opensource -platform %s -prefix %s " \
"-qt-gif -qt-libpng -qt-libjpeg -qt-libtiff -plugin-sql-mysql " \
"-no-phonon -qdbus -openssl -dbus-linked " \
"-fast -no-vcproj -no-dsp -plugin-sql-mysql " \
"-nomake demos -nomake examples -nomake docs " \
"-I \"%s\" -L \"%s\" " % \
( userin, configure, platform, prefix,
os.path.join( thirdparty_dir, "include" ),
os.path.join( thirdparty_dir, "lib" ) )
if self.buildType() == "Debug":
command = command + " -debug "
else:
command = command + " -release "
print "command: ", command
utils.system( command )
if( not libtmp == None ):
os.environ[ "LIB" ] = libtmp
if( not inctmp == None ):
os.environ[ "INCLUDE" ] = inctmp
return True
开发者ID:KDE,项目名称:emerge-history,代码行数:50,代码来源:kde-qt-4.5.2.20090727.py
示例19: install
def install(self):
srcdir = os.path.join(self.workdir, os.getenv("KDECOMPILER") + "-" + self.buildType, "wincursors")
destdir = os.path.join(self.cmakeInstallPrefix, "share", "icons")
utils.copySrcDirToDestDir(srcdir, destdir)
srcreg = os.path.join(self.packagedir, "cursor.reg")
dstreg = os.path.join(self.workdir, "cursor.reg")
shutil.copy(srcreg, dstreg)
utils.sedFile(
self.workdir, "cursor.reg", "s/CHANGEME/%s/g" % destdir.replace("\\", "\\\\\\\\").replace("/", "\\\\\\\\")
)
utils.system("regedit /S %s" % os.path.join(self.workdir, "cursor.reg"))
return True
开发者ID:KDE,项目名称:emerge-history,代码行数:14,代码来源:cursors-4.1.py
示例20: unittest
def unittest( self ):
os.chdir( os.path.join( self.sourceDir(), 'build.vc12') )
if self.buildType() == "Debug":
bt = "Debug"
else:
bt = "Release"
toolsetSwitches = ""
if compiler.isMSVC2012():
toolsetSwitches = "/property:PlatformToolset=v110"
elif compiler.isMSVC2013():
toolsetSwitches = "/tv:12.0 /property:PlatformToolset=v120"
return utils.system("msbuild \"%s\" /p:Configuration=%s %s" %
(os.path.join(self.sourceDir(), "build.vc12", "mpir-tests.sln"), bt, toolsetSwitches)
) and utils.system(os.path.join("mpir-tests", "run-tests.py"));
开发者ID:TheOneRing,项目名称:emerge,代码行数:15,代码来源:mpir.py
注:本文中的utils.system函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论