From 45ae807115cca2889591ffa1c08a605d53ef08b3 Mon Sep 17 00:00:00 2001 From: DominikDeak Date: Thu, 23 Jul 2020 14:02:09 +1000 Subject: [PATCH] Script work. --- Scripts/Detail/Config.py | 30 ++++++++++++++++++++---------- Scripts/build.py | 10 ++++++---- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/Scripts/Detail/Config.py b/Scripts/Detail/Config.py index 72abcf4..97ca1c7 100644 --- a/Scripts/Detail/Config.py +++ b/Scripts/Detail/Config.py @@ -21,6 +21,8 @@ class Configuration(): platformVersion = "" productName = "" + productVersion = "unknown-version" + productStage = "snapshot" productPackageName = "" productRepoPath = "" productBuildPath = "" @@ -44,7 +46,8 @@ class Configuration(): section = platform.system() for name in self.variableList(): - setattr( self, name, parser.get( section, name, fallback = "" ) ) + value = parser.get( section, name, fallback = getattr( self, name ) ) + setattr( self, name, value ) def validateToplevelPath( self ): @@ -130,18 +133,25 @@ class Configuration(): def updateProductVersion( self ): - versionFile = open( self.productVersionPath, "r" ) - versionData = versionFile.read() - versionFile.close() + if not os.path.exists( self.productVersionPath ): + + utility.printWarning( "Unable to determine product version at this time; version file was missing:\n\t", self.productVersionPath ) - versionParts = re.findall( r'set \(SYNERGY_VERSION_\w+ "?(\w+)"?\)', versionData ) + else: - if len( versionParts ) != 4: - printError( "Failed to extract version information." ) - raise SystemExit( 1 ) + versionFile = open( self.productVersionPath, "r" ) + versionData = versionFile.read() + versionFile.close() + + versionParts = re.findall( r'set \(SYNERGY_VERSION_\w+ "?(\w+)"?\)', versionData ) + + if len( versionParts ) != 4: + printError( "Failed to extract version information." ) + raise SystemExit( 1 ) + + self.productVersion = ".".join( versionParts[ 0:3 ] ) + self.productStage = versionParts[ 3 ] - self.productVersion = ".".join( versionParts[ 0:3 ] ) - self.productStage = versionParts[ 3 ] self.productPackageName = "-".join( [ self.productName, self.productVersion, self.productStage, self.platformVersion ] ).lower() utility.printItem( "productVersion: ", self.productVersion ) diff --git a/Scripts/build.py b/Scripts/build.py index 48faa2e..103fc1b 100755 --- a/Scripts/build.py +++ b/Scripts/build.py @@ -13,13 +13,15 @@ def configureSubmodules(): os.chdir( config.toplevelPath ) - status = utility.captureCommandOutput( "git submodule status" ) - - print( status ) + statusBefore = utility.captureCommandOutput( "git submodule status" ) + print( statusBefore ) utility.runCommand( "git submodule update --init --remote --recursive" ) - if status != utility.captureCommandOutput( "git submodule status" ): + statusAfter = utility.captureCommandOutput( "git submodule status" ) + + if statusBefore != statusAfter: + print( statusAfter ) config.updateProductVersion() def configureEnvironment():