def setProgramArgumentsVersion(self): print "Changing versions in localize.py..." mbl.regexReplace("../stonix_resources/localize.py", r"^STONIXVERSION =.*$", r"STONIXVERSION = '" + self.APPVERSION + "'", backupname="../stonix_resources/localize.py.bak") print "Finished changing versions in localize.py..."
def buildStonix4MacAppPkg(self, appName, appVersion, appPath): ''' Build installer package and wrap into a dmg @author: Roy Nielsen, Eric Ball @param appName: Name of application as it should appear on OS X systems @param appVersion: Version of app being built @param appPath: Path to [stonixroot]/src/MacBuild ''' print "Started buildStonix4MacAppPkg..." try: returnDir = os.getcwd() os.chdir(appPath + "/" + appName) print "Putting new version into Makefile..." mbl.regexReplace("Makefile", r"PACKAGE_VERSION=", "PACKAGE_VERSION=" + appVersion) if not os.path.isdir(appPath + "/dmgs"): os.mkdir(appPath + "/dmgs") else: # Cannot use mkdtmp here because it will make the directory on # the root filesystem instead of the ramdisk, then it will try # to link across filesystems which won't work tmpdir = appPath + "/dmgs." + str(time()) os.rename(appPath + "/dmgs", tmpdir) os.mkdir(appPath + "/dmgs") print "Creating a .dmg file with a .pkg file inside for " + \ "installation purposes..." call([ "make", "dmg", "PACKAGE_VERSION=" + appVersion, "USE_PKGBUILD=1" ]) call([ "make", "pkg", "PACKAGE_VERSION=" + appVersion, "USE_PKGBUILD=1" ]) print "Moving dmg and pkg to the dmgs directory." dmgname = appName + "-" + appVersion + ".dmg" pkgname = appName + "-" + appVersion + ".pkg" os.rename(dmgname, appPath + "/dmgs/" + dmgname) os.rename(pkgname, appPath + "/dmgs/" + pkgname) os.chdir(returnDir) except Exception: raise print "buildStonix4MacAppPkg... Finished"
def buildStonix4MacAppPkg(self, appName, appVersion, appPath): ''' Build installer package and wrap into a dmg @author: Roy Nielsen, Eric Ball @param appName: Name of application as it should appear on OS X systems @param appVersion: Version of app being built @param appPath: Path to [stonixroot]/src/MacBuild ''' print "Started buildStonix4MacAppPkg..." try: returnDir = os.getcwd() os.chdir(appPath + "/" + appName) print "Putting new version into Makefile..." mbl.regexReplace("Makefile", r"PACKAGE_VERSION=", "PACKAGE_VERSION=" + appVersion) if not os.path.isdir(appPath + "/dmgs"): os.mkdir(appPath + "/dmgs") else: # Cannot use mkdtmp here because it will make the directory on # the root filesystem instead of the ramdisk, then it will try # to link across filesystems which won't work tmpdir = appPath + "/dmgs." + str(time()) os.rename(appPath + "/dmgs", tmpdir) os.mkdir(appPath + "/dmgs") print "Creating a .dmg file with a .pkg file inside for " + \ "installation purposes..." call(["make", "dmg", "PACKAGE_VERSION=" + appVersion, "USE_PKGBUILD=1"]) call(["make", "pkg", "PACKAGE_VERSION=" + appVersion, "USE_PKGBUILD=1"]) print "Moving dmg and pkg to the dmgs directory." dmgname = appName + "-" + appVersion + ".dmg" pkgname = appName + "-" + appVersion + ".pkg" os.rename(dmgname, appPath + "/dmgs/" + dmgname) os.rename(pkgname, appPath + "/dmgs/" + pkgname) os.chdir(returnDir) except Exception: raise print "buildStonix4MacAppPkg... Finished"
def setProgramArgumentsVersion(self, localizePath): ''' Change the STONIX version to the version specified within the build script @author: Roy Nielsen, Eric Ball @param localizePath: Path to the [stonixroot]/src/stonix_resources/ localize.py file that this method should modify ''' print "Changing versions in localize.py..." try: mbl.regexReplace(localizePath, r"^STONIXVERSION =.*$", r"STONIXVERSION = '" + self.APPVERSION + "'", backupname="../stonix_resources/localize.py.bak") except Exception: raise print "Finished changing versions in localize.py..."
def tarAndBuildStonix4MacAppPkg(self, appName, appVersion): ################################################################################ ################################################################################ ##### ##### Archive, build installer package and wrap into a dmg: ##### stonix4mac.app ##### ################################################################################ ################################################################################ APPNAME=appName APPVERSION=appVersion print "Started tarAndBuildStonix4MacApp..." mypwd=os.getcwd() print "pwd: " + mypwd ##### # Make sure the "tarfiles" directory exists, so we can archive # tarfiles of the name $APPNAME-$APPVERSION.app.tar.gz there if not os.path.isdir("tarfiles"): os.mkdir("tarfiles") else: ##### # Cannot use mkdtmp here because it will make the directory on the # root filesystem instead of the ramdisk, then it will try to link # across filesystems which won't work TMPFILE= "tarfiles" + str(self.timeStamp()) #TMPFILE=mkdtemp(prefix="tariles.") os.rename("tarfiles", TMPFILE) os.mkdir("tarfiles") ##### # tar up the app and put it in the tarfiles directory print "Tarring up the app & putting the tarfile in the ../tarfiles directory" self.dirq.put(os.getcwd()) os.chdir("./" + APPNAME + "/dist") mypwd=os.getcwd() print "pwd: " + mypwd mbl.makeTarball(APPNAME + ".app", "../../tarfiles/" + APPNAME + "-" + APPVERSION + ".app.tar.gz") os.chdir(self.dirq.get()) mypwd=os.getcwd() print "pwd: " + mypwd ################################################### # to create the package self.dirq.put(os.getcwd()) os.chdir(APPNAME) print "Putting new version into Makefile..." mbl.regexReplace("Makefile", r"PACKAGE_VERSION=", "PACKAGE_VERSION=" + APPVERSION) ### # Currently Makefile does not actually have a LUGGAGE_TMP variable mbl.regexReplace("Makefile", r"LUGGAGE_TMP\S+", "LUGGAGE_TMP=" + self.TMPHOME) if not os.path.isdir("../dmgs"): os.mkdir("../dmgs") else: ##### # Cannot use mkdtmp here because it will make the directory on the # root filesystem instead of the ramdisk, then it will try to link # across filesystems which won't work TMPFILE= "dmgs" + str(self.timeStamp()) #TMPFILE=mkdtemp(prefix="dmgs.") os.rename("../dmgs", TMPFILE) os.mkdir("../dmgs") print "Creating a .dmg file with a .pkg file inside for installation purposes..." call(["make", "dmg", "PACKAGE_VERSION=" + APPVERSION,"USE_PKGBUILD=1"]) print "Moving the dmg to the dmgs directory." dmgname = APPNAME + "-" + APPVERSION + ".dmg" os.rename(dmgname, "../dmgs/" + dmgname) os.chdir(self.dirq.get()) print "tarAndBuildStonix4MacApp... Finished"