用于简单命令行执行的构建块
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了用于简单命令行执行的构建块相关的知识,希望对你有一定的参考价值。
import os, platform, sys, getopt ####################### CONFIG ## Put the path to the nuke exe here nkExePath = 'Z:/software/Nuke6.1v1_x64/Nuke6.1.exe --nukex' ## Put the path to NUKE_PATH here so nuke can find scripts. ## Set this to '' if you dont have anything for this. nkPath = 'z:/software/nuke_throb' def main(): # Parse command line options = 'h' longOptions = ['img=', 'out=', 'script=', 'startframe=', 'endframe=' ] opts, pargs = getopt.getopt(sys.argv[1:], options, longOptions) # Extract command line options for opt in opts: if opt[0] == '--img': img = opt[1] elif opt[0] == '--out': out = opt[1] elif opt[0] == '--script': script = opt[1] elif opt[0] == '--startframe': startframe = opt[1] elif opt[0] == '--endframe': endframe = opt[1] # Check for a command missingOpts = [] try: img except NameError: missingOpts.append('img') try: out except NameError: missingOpts.append('out') try: startframe except NameError: missingOpts.append('startframe') try: script except NameError: missingOpts.append('script') try: endframe except NameError: missingOpts.append('endframe') if len(missingOpts) > 0 : usage(missingOpts, longOptions) sys.exit(1) #job = getJob(img) #sequence = getSeq(img) #shot = getShot(img) #os.putenv('JOB',job) if nkPath != '': os.putenv('NUKE_PATH',nkPath) if os.path.exists(os.path.dirname(out)) == False: os.makedirs(os.path.dirname(out)) cmdLine = '%s -x %s %s %s %d,%d' % (nkExePath, script, img, out, int(startframe), int(endframe)) os.system(cmdLine) def usage (opts, allOpts): print '=' * 20, 'Usage','=' * 20, ' ' scriptOpts = '' scriptPath = os.path.basename(sys.argv[0]) for curOpt in allOpts: scriptOpts = '%s --%s [option]' % (scriptOpts, curOpt.replace('=','')) print '%s %s ' % (scriptPath, scriptOpts) for opt in opts: print 'Option missing: %s ' % opt if __name__ == '__main__': main() sys.exit(0)
以上是关于用于简单命令行执行的构建块的主要内容,如果未能解决你的问题,请参考以下文章
用于开源编译/构建的 Apple 命令行工具和 XCode?
命令行执行Ant构建Jmeter,一直报Java(TM) Platform SE binary 已停止工作
XCode:用于 xcode 命令行构建的 Documents and Library 文件夹