python編譯as

直接外部傳入參數:html

import subprocess
import os

def compile(sdk, mainPath, configPath=None, callback=None):
    os.chdir(sdk + "/bin/")
    cmdName = 'mxmlc'
    args = cmdName + " " + mainPath + " "
    if configPath:
        f = open(configPath)
        conf = f.read()
        conf = conf.replace("\r", "")
        conf = conf.replace("\n", " ")
        args += conf
    print args

    sp = subprocess.Popen(args)
    sp.wait()
    if callback:
        callback()

  配置文件的參數見 application compiler optionspython

相關文章
相關標籤/搜索