本文整理汇总了Python中utils.Utils.run方法的典型用法代码示例。如果您正苦于以下问题:Python Utils.run方法的具体用法?Python Utils.run怎么用?Python Utils.run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utils.Utils
的用法示例。
在下文中一共展示了Utils.run方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import run [as 别名]
def main():
args = parse_args()
projectOut = os.path.join(args.dest[0], args.projName[0])
os.mkdir(projectOut)
genSrc(projectOut, args.projName[0], ["iostream", "string", "unistd.h", "vector", "cstdint", "cstdio", "cstddef", "utility", "map", "unordered_map", "algorithm"])
CC = genHelper.determineCC(args)
CXX = genHelper.determineCXX(args)
external = "external"
outname = args.projName[0]
prefix = "./"
installName = args.projName[0]
neededLibs = "none"
if args.externalLoc:
external = os.path.realpath(args.externalLoc[0])
if args.neededLibs:
neededLibs = args.neededLibs[0].split(",")
genHelper.generateCompfileFull(os.path.join(projectOut, "compfile.mk"), external, CC, CXX, outname, installName, prefix, neededLibs)
with open(os.path.join(projectOut, "configure.py"), "w") as configFile:
if(args.neededLibs):
configFile.write(genHelper.mkConfigFileStr(outname, args.neededLibs[0]))
else:
configFile.write(genHelper.mkConfigFileStr(outname, ""))
os.chmod(os.path.join(projectOut, "configure.py"), stat.S_IXGRP | stat.S_IXOTH | stat.S_IXUSR | stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH | stat.S_IWUSR)
exFrom = os.path.abspath(os.path.dirname(__file__))
cpSetUpCmd = exFrom + "/copySetUpFiles.py -from " + exFrom +"/../../ -to " + projectOut
print CT.boldBlack(cpSetUpCmd)
Utils.run(cpSetUpCmd)
cpMakefilesCmd = "cp " + exFrom + "/../cppSetUpFiles/*akefile* " + projectOut
print CT.boldBlack(cpMakefilesCmd)
Utils.run(cpMakefilesCmd)
示例2: cppitertools
# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import run [as 别名]
def cppitertools(self):
cppitpaths = self.__path('cppitertools')
os.mkdir(cppitpaths.local_dir)
gitCmd = "git clone {url} {d}".format(url=cppitpaths.url, d=shellquote(os.path.join(cppitpaths.local_dir, "cppitertools")))
Utils.run(gitCmd)
cmd = "cd {d} && git checkout d4f79321842dd584f799a7d51d3e066a2cdb7cac".format(d=shellquote(os.path.join(cppitpaths.local_dir, "cppitertools")))
Utils.run(cmd)
示例3: main
# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import run [as 别名]
def main():
args = parse_args()
prefix = "";
external = "external";
CC = genHelper.determineCC(args)
CXX = genHelper.determineCXX(args)
if(args.externalLibDir):
external = args.externalLibDir;
cmd = os.path.join(os.path.dirname(os.path.dirname(__file__)), "setUpScripts/generateCompFile.py") + """ -installName {name}
-outFilename compfile.mk -externalLoc {external} -CC {CC} -CXX {CXX}
-neededLibs {libs} -outname {name}"""
if args.private:
cmd += " -private ";
if args.prefix and args.prefix != "":
prefix = args.prefix;
cmd += " -prefix {prefix}"
if args.ldFlags and "" != args.ldFlags:
cmd += " -ldFlags " + args.ldFlags
if args.cxxFlags and "" != args.cxxFlags:
addingFlags = " -cxxFlags \""
if args.cxxFlags.startswith("-"):
addingFlags += "\\"
cmd += addingFlags + args.cxxFlags + "\""
cmd = " ".join(cmd.split())
cmd = cmd.format(name = args.name, external = external, CC=CC, CXX=CXX, libs = args.libs, prefix = prefix)
Utils.run(cmd)
示例4: main
# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import run [as 别名]
def main():
args = parse_args()
s = Setup(args)
ccWhich = Utils.which(s.CC)
cxxWhich = Utils.which(s.CXX)
cmakeWhich = Utils.which("cmake")
if not ccWhich or not cxxWhich or not cmakeWhich:
if not ccWhich:
print CT.boldRed("Could not find c compiler " + CT.purple + s.CC)
if args.compfile:
print "Change CC in " + args.compfile
else:
print "Can supply another c compiler by using -CC [option] or by defining bash environmental CC "
print ""
if not cxxWhich:
print CT.boldRed("Could not find c++ compiler " + CT.purple + s.CXX)
if args.compfile:
print "Change CXX in " + args.compfile
else:
print "Can supply another c++ compiler by using -CXX [option] or by defining bash environmental CXX "
print ""
if not cmakeWhich:
print CT.boldRed("Could not find " + CT.purple + "cmake")
if Utils.isMac():
print "If you have brew install via, brew update && brew install cmake, otherwise you can follow instructions from http://www.cmake.org/install/"
else:
print "On ubuntu to install latest cmake do the following"
print "sudo add-apt-repository ppa:george-edison55/cmake-3.x"
print "sudo apt-get update"
print "sudo apt-get install cmake"
return 1
if(args.instRPackageName):
s.installRPackageName(args.instRPackageName[0])
return 0
if(args.instRPackageSource):
s.installRPackageSource(args.instRPackageSource[0])
return 0
if args.updateBibProjects:
projectsSplit = args.updateBibProjects.split(",")
s.updateBibProjects(projectsSplit)
return 0
if args.printLibs:
s.printAvailableSetUps()
elif args.addBashCompletion:
if(os.path.isdir("./bashCompletes")):
cmd = "cat bashCompletes/* >> ~/.bash_completion"
Utils.run(cmd)
if(os.path.isdir("./bash_completion.d")):
cmd = "cat bash_completion.d/* >> ~/.bash_completion"
Utils.run(cmd)
else:
if len(s.setUpsNeeded) == 0:
s.printAvailableSetUps()
return 1
else:
s.setup()
return 0
示例5: main
# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import run [as 别名]
def main():
name = "njhcpp"
libs = "boost_filesystem:1_68_0,pstreams:RELEASE_1_0_1,jsoncpp:1.8.3,cppitertools:v0.2.1,zlib:1.2.11"
args = genHelper.parseNjhConfigureArgs()
if Utils.isMac():
cmd = genHelper.mkConfigCmd(name, libs, sys.argv, "-lpthread,-lz")
else:
cmd = genHelper.mkConfigCmd(name, libs, sys.argv, "-lpthread,-lz,-lrt")
Utils.run(cmd)
示例6: __gitTag
# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import run [as 别名]
def __gitTag(self, i, tagName):
cmd = "git clone {url} {d}".format(url=i.url, d=shellquote(i.local_dir))
tagCmd = "git checkout {tag}".format(tag=tagName)
try:
Utils.run(cmd)
Utils.run_in_dir(tagCmd, i.local_dir)
except:
print "failed to clone from {url}".format(url=i.url)
sys.exit(1)
示例7: installRPackageName
# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import run [as 别名]
def installRPackageName(self, packageName):
i = self.__path("r")
for pack in packageName.split(","):
if isMac():
cmd = """echo 'install.packages(c(\"{PACKAGENAME}\"), repos=\"http://cran.us.r-project.org\")' | $({local_dir}/R.framework/Resources/bin/R RHOME)/bin/R --slave --vanilla
""".format(local_dir=shellquote(i.local_dir).replace(' ', '\ '), PACKAGENAME = pack )
else:
cmd = """echo 'install.packages(\"{PACKAGENAME}\", repos=\"http://cran.us.r-project.org\")' | $({local_dir}/bin/R RHOME)/bin/R --slave --vanilla
""".format(local_dir=shellquote(i.local_dir).replace(' ', '\ '),PACKAGENAME = pack )
print CT.boldBlack(cmd)
cmd = " ".join(cmd.split())
Utils.run(cmd)
示例8: installRPackageSource
# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import run [as 别名]
def installRPackageSource(self, sourceFile):
i = self.__path("r")
for pack in sourceFile.split(","):
if isMac():
cmd = """echo 'install.packages(\"{SOURCEFILE}\", repos = NULL, type="source")' | $({local_dir}/R.framework/Resources/bin/R RHOME)/bin/R --slave --vanilla
""".format(local_dir=shellquote(i.local_dir).replace(' ', '\ '),SOURCEFILE = pack )
else:
cmd = """echo 'install.packages(\"{SOURCEFILE}\", repos = NULL, type="source")' | $({local_dir}/bin/R RHOME)/bin/R --slave --vanilla
""".format(local_dir=shellquote(i.local_dir).replace(' ', '\ '),SOURCEFILE = pack )
print CT.boldBlack(cmd)
cmd = " ".join(cmd.split())
Utils.run(cmd)
示例9: reatchHeadCommitPush
# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import run [as 别名]
def reatchHeadCommitPush(self, subModuleDir, branch, commitMessage):
try:
self.reatchHeadAndPull(subModuleDir, branch)
except Exception as excp:
print("Failed to reatch head and pull for " + subModuleDir + ":" + branch)
raise(excp)
cmds = "cd " + os.path.join(self.projectDir, subModuleDir) + " && git commit -a -m \"" + commitMessage + "\" && git push"
try:
Utils.run(cmds)
except Exception as pushExcep:
print("Failed to commit and push for " + subModuleDir + ":" + branch)
raise(pushExcep)
示例10: main
# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import run [as 别名]
def main():
name = "njhseq"
#libs = "bamtools:develop,bibcpp:develop,armadillo:8.200.0"
libs = "TwoBit:v2.0.9,bamtools:v2.5.2"
args = genHelper.parseNjhConfigureArgs()
if Utils.isMac():
macv, _, _ = platform.mac_ver()
macv = float('.'.join(macv.split('.')[:2]))
if macv < 10.12:
if args.CC and "gcc" in args.CC[0]:
pass
else:
libs = libs + ",sharedMutex:develop"
cmd = genHelper.mkConfigCmd(name, libs, sys.argv)
Utils.run(cmd)
示例11: main
# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import run [as 别名]
def main():
args = parse_args()
prefix = ""
external = "external"
CC = genHelper.determineCC(args)
CXX = genHelper.determineCXX(args)
if args.externalLibDir:
external = args.externalLibDir
cmd = """scripts/setUpScripts/generateCompFile.py -installName {name}
-outFilename compfile.mk -externalLoc {external} -CC {CC} -CXX {CXX}
-neededLibs {libs} -outname {name}"""
if args.prefix and args.prefix != "":
prefix = args.prefix
cmd += " -prefix {prefix}"
cmd = " ".join(cmd.split())
cmd = cmd.format(name=args.name, external=external, CC=CC, CXX=CXX, libs=args.libs, prefix=prefix)
Utils.run(cmd)
示例12: genCppProject
# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import run [as 别名]
def genCppProject(args):
projectOut = os.path.join(args.dest, args.projName)
if os.path.exists(projectOut):
if args.overwrite:
shutil.rmtree(projectOut)
else:
raise Exception("Directory " + str(projectOut) + " already exists, use --overWrite to delete")
#create project dir
os.mkdir(projectOut)
#generate skeleton source code directory
genSrc(projectOut, args.projName, ["iostream", "string", "unistd.h", "vector", "cstdint", "cstdio", "cstddef", "utility", "map", "unordered_map", "algorithm"])
#determine c++ and c compilers
CC = genHelper.determineCC(args)
CXX = genHelper.determineCXX(args)
external = "external"
outname = args.projName
prefix = "./"
installName = args.projName
neededLibs = "none"
if args.externalLoc:
external = os.path.realpath(args.externalLoc)
if args.neededLibs:
neededLibs = args.neededLibs.split(",")
#generate the compfile
genHelper.generateCompfileFull(os.path.join(projectOut, "compfile.mk"), external, CC, CXX, outname, installName, prefix, neededLibs)
#generate config file
with open(os.path.join(projectOut, "configure.py"), "w") as configFile:
if args.neededLibs:
configFile.write(genHelper.mkConfigFileStr(outname, args.neededLibs))
else:
configFile.write(genHelper.mkConfigFileStr(outname, ""))
#make executable
os.chmod(os.path.join(projectOut, "configure.py"), stat.S_IXGRP | stat.S_IXOTH | stat.S_IXUSR | stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH | stat.S_IWUSR)
#determine this file's location to dtermine where to copy setup and make files to
exFrom = os.path.abspath(os.path.dirname(__file__))
cpSetUpCmd = exFrom + "/copySetUpFiles.py -from " + exFrom + "/../../ -to " + projectOut
print CT.boldBlack(cpSetUpCmd)
Utils.run(cpSetUpCmd)
cpMakefilesCmd = "cp " + exFrom + "/../cppMakefiles/Makefile " + projectOut
print CT.boldBlack(cpMakefilesCmd)
Utils.run(cpMakefilesCmd)
#generate README.md
genReadme(projectOut, args.projName)
示例13: main
# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import run [as 别名]
def main():
args = parse_args()
externalIncludes = []
stdLibraryInc = ["iostream", "string", "unistd.h", "vector", "cstdint", "cstdio", "cstddef", "utility", "map", "unordered_map", "algorithm"]
projectOut = os.path.join(args.dest[0], args.projName[0])
os.mkdir(projectOut)
if args.programType == "singleRing":
genSrcSingleRingProgram(projectOut, args.projName[0], stdLibraryInc, externalIncludes, args.author)
elif args.programType == "oneRing":
genSrcWithOneRingProgram(projectOut, args.projName[0], stdLibraryInc, externalIncludes, args.author)
elif args.programType == "oneCmd":
genSrcWithOneCmdProgram(projectOut, args.projName[0], stdLibraryInc, externalIncludes, args.author)
else:
raise Exception("Error, only singleRing, oneRing,oneCmd available for options to programType, was given " + args.programType )
CC = genHelper.determineCC(args)
CXX = genHelper.determineCXX(args)
external = "external"
outname = args.projName[0]
prefix = "./"
installName = args.projName[0]
neededLibs = ["njhcppdev"]
if args.externalLoc:
external = os.path.realpath(args.externalLoc[0])
if args.neededLibs:
neededLibs = ["njhcppdev"] + args.neededLibs[0].split(",")
genHelper.generateCompfileFull(os.path.join(projectOut, "compfile.mk"), external, CC, CXX, outname, installName, prefix, neededLibs)
with open(os.path.join(projectOut, "configure.py"), "w") as configFile:
if(args.neededLibs):
configFile.write(genHelper.mkConfigFileStr(outname, ",".join(neededLibs)))
else:
configFile.write(genHelper.mkConfigFileStr(outname, "njhcppdev"))
os.chmod(os.path.join(projectOut, "configure.py"), stat.S_IXGRP | stat.S_IXOTH | stat.S_IXUSR | stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH | stat.S_IWUSR)
exFrom = os.path.abspath(os.path.dirname(__file__))
cpSetUpCmd = exFrom + "/copySetUpFiles.py -from " + exFrom +"/../../ -to " + projectOut
print CT.boldBlack(cpSetUpCmd)
Utils.run(cpSetUpCmd)
cpMakefilesCmd = "cp " + exFrom + "/../cppSetUpFiles/*akefile* " + projectOut
print CT.boldBlack(cpMakefilesCmd)
Utils.run(cpMakefilesCmd)
示例14: main
# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import run [as 别名]
def main():
name = "gtkExperimental"
libs = "gtkmm,bibcppdev"
args = genHelper.parseNjhConfigureArgs()
cmd = genHelper.mkConfigCmd(name, libs, sys.argv)
Utils.run(cmd)
示例15: __git
# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import run [as 别名]
def __git(self, i):
cmd = "git clone {url} {d}".format(url=i.url, d=shellquote(i.local_dir))
Utils.run(cmd)