Beispiel #1
0
                 os.path.join(dllPath, "*", "*.dll")):
             zipf.write(f, os.path.join(binDir, f[len(dllPath) + 1:]))
         files_to_zip = (
             glob.glob(
                 os.path.join(options.rootDir, options.binDir, "*.exe")) +
             glob.glob(
                 os.path.join(options.rootDir, options.binDir, "*.jar")) +
             glob.glob(
                 os.path.join(options.rootDir, options.binDir, "*.bat")))
         for f in files_to_zip:
             zipf.write(f, os.path.join(binDir, os.path.basename(f)))
         zipf.close()
         if options.suffix == "":
             # installers only for the vanilla build
             wix.buildMSI(binaryZip,
                          binaryZip.replace(".zip", ".msi"),
                          log=log)
     except IOError as ziperr:
         (errno, strerror) = ziperr.args
         print("Warning: Could not zip to %s!" % binaryZip, file=log)
         print("I/O error(%s): %s" % (errno, strerror), file=log)
 try:
     setup = os.path.join(env["SUMO_HOME"], 'tools', 'game', 'setup.py')
     subprocess.call(['python', setup, binaryZip],
                     stdout=log,
                     stderr=subprocess.STDOUT)
 except Exception as e:
     print("Warning: Could not create nightly sumo-game.zip! (%s)" % e,
           file=log)
 log.close()
 subprocess.call(compiler + " /rebuild Debug|%s %s\\%s /out %s" %
Beispiel #2
0
                 write = not f.endswith('/doxygen/')
             elif write:
                 zipf.writestr(f, srcZip.read(f))
         srcZip.close()
         dllPath = os.path.join(options.rootDir, dllDir)
         for f in glob.glob(os.path.join(dllPath, "*.dll")) + glob.glob(os.path.join(dllPath, "*", "*.dll")):
             zipf.write(f, os.path.join(binDir, f[len(dllPath) + 1:]))
         for ext in ("*.exe", "*.bat", "*.py", "*.pyd", "*.dll", "*.jar"):
             for f in glob.glob(os.path.join(options.rootDir, options.binDir, ext)):
                 nameInZip = os.path.join(binDir, os.path.basename(f))
                 if nameInZip not in srcZip.namelist():
                     zipf.write(f, nameInZip)
         zipf.close()
         if options.suffix == "":
             # installers only for the vanilla build
             wix.buildMSI(binaryZip, binaryZip.replace(".zip", ".msi"), log=log)
     except IOError as ziperr:
         (errno, strerror) = ziperr.args
         print("Warning: Could not zip to %s!" % binaryZip, file=log)
         print("I/O error(%s): %s" % (errno, strerror), file=log)
 try:
     setup = os.path.join(env["SUMO_HOME"], 'tools', 'game', 'setup.py')
     subprocess.call(['python', setup, binaryZip], stdout=log, stderr=subprocess.STDOUT)
 except Exception as e:
     print("Warning: Could not create nightly sumo-game.zip! (%s)" % e, file=log)
 log.close()
 with open(makeAllLog, 'a') as log:
     subprocess.call(["cmake", "--build", ".", "--config", "Debug"],
                     cwd=buildDir, stdout=log, stderr=subprocess.STDOUT)
 if sumoAllZip:
     try:
Beispiel #3
0
def main(options, platform="x64"):
    env["FILEPREFIX"] = options.msvc_version + options.suffix + platform
    prefix = os.path.join(options.remoteDir, env["FILEPREFIX"])
    makeLog = prefix + "Release.log"
    makeAllLog = prefix + "Debug.log"
    testLog = prefix + "Test.log"
    testDebugLog = prefix + "DebugTest.log"
    statusLog = prefix + "status.log"
    log_handler = status.set_rotating_log(makeLog)

    status.killall(("", "D"), BINARIES)
    toClean = []
    for ext in ("*.exe", "*.ilk", "*.pdb", "*.py", "*.pyd", "*.dll", "*.lib", "*.exp", "*.jar", "*.manifest", "*.fmu"):
        toClean += glob.glob(os.path.join(SUMO_HOME, "bin", ext))
    toClean += glob.glob(os.path.join(SUMO_HOME, "tools", "lib*", "*lib*"))
    toClean += glob.glob(os.path.join(SUMO_HOME, "share", "*", "*"))
    for f in toClean:
        try:
            os.remove(f)
        except Exception:
            pass
    for d in (glob.glob(os.path.join(SUMO_HOME, "bin", "osgPlugins*")) +
              glob.glob(os.path.join(SUMO_HOME, "tools", "*.egg-info"))):
        shutil.rmtree(d, ignore_errors=True)
    for d in glob.glob(os.path.join(SUMO_HOME, "docs", "*")):
        if os.path.basename(d) in ('examples', 'javadoc', 'man', 'pydoc', 'tutorial', 'userdoc'):
            shutil.rmtree(d, ignore_errors=True)

    status.printLog("Running %s build using python %s." % (options.msvc_version, sys.version))
    gitrev = repositoryUpdate(options)
    generator = "Visual Studio " + ("12 2013" if options.msvc_version == "msvc12" else "16 2019")
    buildDir = generateCMake(generator, platform, options.suffix == "extra", options.python)
    ret = status.log_subprocess(["cmake", "--build", ".", "--config", "Release"], cwd=buildDir)
    status.log_subprocess(["cmake", "--build", ".", "--config", "Release", "--target", "lisum"], cwd=buildDir)
    status.log_subprocess(["cmake", "--build", ".", "--config", "Release", "--target", "userdoc", "examples"],
                          cwd=buildDir)
    status.log_subprocess(["cmake", "--install", "."], cwd=buildDir)
    plat = platform.lower().replace("x", "win")
    if options.msvc_version != "msvc16":
        plat += options.msvc_version
    for d in glob.glob(os.path.join(buildDir, "sumo-*")):
        if os.path.isdir(d):
            installDir = d
    installBase = os.path.basename(installDir)
    binaryZip = os.path.join(buildDir, "sumo-%s%s-%s" % (plat, options.suffix, installBase[5:]))
    if ret == 0:
        try:
            for f in (glob.glob(os.path.join(SUMO_HOME, "*.md")) +
                      [os.path.join(SUMO_HOME, n) for n in ("AUTHORS", "ChangeLog", "LICENSE")]):
                shutil.copy(f, installDir)
            if options.suffix == "extra":
                shutil.copy(os.path.join(SUMO_HOME, "build", "wix", "gpl-2.0.txt"), os.path.join(installDir, "LICENSE"))
            for f in glob.glob(os.path.join(SUMO_HOME, "bin", "*.jar")):
                shutil.copy(f, os.path.join(installDir, "bin"))
            shutil.copytree(os.path.join(SUMO_HOME, "docs"), os.path.join(installDir, "docs"),
                            ignore=shutil.ignore_patterns('web'))
            shutil.copy(os.path.join(buildDir, "src", "version.h"), os.path.join(installDir, "include"))
            status.printLog("Creating sumo.zip.")
            shutil.make_archive(binaryZip, 'zip', buildDir, installBase)
            shutil.copy(binaryZip + ".zip", options.remoteDir)
            status.printLog("Creating sumo.msi.")
            if options.suffix == "extra":
                wix.buildMSI(binaryZip + ".zip", binaryZip + ".msi",
                             license=os.path.join(SUMO_HOME, "build", "wix", "gpl-2.0.rtf"))
            else:
                wix.buildMSI(binaryZip + ".zip", binaryZip + ".msi")
            shutil.copy(binaryZip + ".msi", options.remoteDir)
        except Exception as ziperr:
            status.printLog("Warning: Could not zip to %s.zip (%s)!" % (binaryZip, ziperr))

    gameZip = os.path.join(buildDir, "sumo-game-%s%s-%s.zip" % (plat, options.suffix, installBase[5:]))
    status.printLog("Creating sumo-game.zip.")
    try:
        status.log_subprocess(["cmake", "--build", ".", "--target", "game"], cwd=buildDir)
        shutil.move(os.path.join(buildDir, "sumo-game.zip"), gameZip)
        shutil.copy(gameZip, options.remoteDir)
    except Exception as e:
        status.printLog("Warning: Could not create nightly sumo-game.zip! (%s)" % e)

    debug_handler = status.set_rotating_log(makeAllLog, log_handler)
    ret = status.log_subprocess(["cmake", "--build", ".", "--config", "Debug"], cwd=buildDir)
    if ret == 0:
        debugZip = os.path.join(buildDir, "sumo-%s%sDebug-%s.zip" % (plat, options.suffix, installBase[5:]))
        status.printLog("Creating sumoDebug.zip.")
        try:
            with zipfile.ZipFile(debugZip, 'w', zipfile.ZIP_DEFLATED) as zipf:
                for ext in ("*D.exe", "*.dll", "*D.pdb"):
                    for f in glob.glob(os.path.join(SUMO_HOME, "bin", ext)):
                        zipf.write(f, os.path.join(installBase, "bin", os.path.basename(f)))
            shutil.copy(debugZip, options.remoteDir)
        except IOError as ziperr:
            status.printLog("Warning: Could not zip to %s (%s)!" % (debugZip, ziperr))

    log_handler = status.set_rotating_log(testLog, debug_handler)
    status.printLog("Running tests.")
    runTests(options, env, gitrev)
    with open(statusLog, 'w') as log:
        status.printStatus(makeLog, makeAllLog, env["SMTP_SERVER"], log, testLog=testLog)
    if not options.x64only:
        debug_handler = status.set_rotating_log(testDebugLog, log_handler)
        status.printLog("Running debug tests.")
        runTests(options, env, gitrev, "D")
        with open(prefix + "Dstatus.log", 'w') as log:
            status.printStatus(makeAllLog, testDebugLog, env["SMTP_SERVER"], log, testLog=testDebugLog)
                glob.glob(os.path.join(env["FOX16"+envSuffix], "lib",
                                       "libpng*.dll")) +
                glob.glob(os.path.join(nightlyDir, "msvc?100.dll")) +
                glob.glob(os.path.join(options.rootDir, options.binDir, "*.exe")) +
                glob.glob(os.path.join(options.rootDir, options.binDir, "*.jar")) +
                glob.glob(os.path.join(options.rootDir, options.binDir, "*.bat")))
        for f in files_to_zip:
            zipf.write(f, os.path.join(binDir, os.path.basename(f)))
            if platform == "Win32" and not f.startswith(nightlyDir):
                try:
                    shutil.copy2(f, nightlyDir)
                except IOError, (errno, strerror):
                    print >> log, "Warning: Could not copy %s to %s!" % (f, nightlyDir)
                    print >> log, "I/O error(%s): %s" % (errno, strerror)
        zipf.close()
        wix.buildMSI(binaryZip, binaryZip.replace(".zip", ".msi"), platformSuffix=programSuffix)
        shutil.copy2(binaryZip, options.remoteDir)
    except IOError, (errno, strerror):
        print >> log, "Warning: Could not zip to %s!" % binaryZip
        print >> log, "I/O error(%s): %s" % (errno, strerror)
    if platform == "Win32" and options.sumoExe == "sumo":
        try:
            setup = os.path.join(os.path.dirname(__file__), '..', 'game', 'setup.py')
            subprocess.call(['python', setup], stdout=log, stderr=subprocess.STDOUT)
        except Exception as e:
            print >> log, "Warning: Could not create nightly sumogame.zip! (%s)" % e
    log.close()
    subprocess.call(compiler+" /rebuild Debug|%s %s\\%s /out %s" % (platform, options.rootDir, options.project, makeAllLog))
    if options.addConf:
        subprocess.call(compiler+" /rebuild %sDebug|%s %s\\%s /out %s" % (options.addConf, platform, options.rootDir, options.project, makeAllLog))
Beispiel #5
0
         glob.glob(os.path.join(options.rootDir, options.binDir, "*.exe")) +
         glob.glob(os.path.join(options.rootDir, options.binDir, "*.jar")) +
         glob.glob(os.path.join(options.rootDir, options.binDir, "*.bat")))
     for f in files_to_zip:
         zipf.write(f, os.path.join(binDir, os.path.basename(f)))
         if not f.startswith(nightlyDir):
             try:
                 shutil.copy2(f, nightlyDir)
             except IOError, (errno, strerror):
                 print >> log, "Warning: Could not copy %s to %s!" % (
                     f, nightlyDir)
                 print >> log, "I/O error(%s): %s" % (errno, strerror)
     zipf.close()
     shutil.copy2(binaryZip, options.remoteDir)
     wix.buildMSI(binaryZip,
                  binaryZip.replace(".zip", ".msi"),
                  platformSuffix=programSuffix)
     shutil.copy2(binaryZip.replace(".zip", ".msi"), options.remoteDir)
 except IOError, (errno, strerror):
     print >> log, "Warning: Could not zip to %s!" % binaryZip
     print >> log, "I/O error(%s): %s" % (errno, strerror)
 if platform == "Win32" and options.sumoExe == "sumo":
     try:
         setup = os.path.join(os.path.dirname(__file__), '..', 'game',
                              'setup.py')
         subprocess.call(['python', setup],
                         stdout=log,
                         stderr=subprocess.STDOUT)
     except Exception as e:
         print >> log, "Warning: Could not create nightly sumo-game.zip! (%s)" % e
 if platform == "x64" and options.sumoExe == "meso":