def getPackVersion( self, strMetaDataFileContents ): "extract a version from a metadata file" # print( "INF: LifeData.getPackVersion: strMetaDataFileContents: " +strMetaDataFileContents ); nPick = strMetaDataFileContents.find( "<version>" ); if( nPick == -1 ): print( "INF: LifeData.getPackVersion: no version number found in data (data size: %d)" % ( len( strMetaDataFileContents ) ) ); return 0.; rVersion = stringtools.findNumber( strMetaDataFileContents[nPick:] ); return rVersion;
def getFileVersion( self, strFilePath ): "extract a version from a life_data file (yeah it's this file, but find it without loading it with python)" enclosedFileData = filetools.getFileContents( strFilePath ); # print( "INF: LifeData.getFileVersion: '%s'" % enclosedFileData ); nPick = enclosedFileData.find( "rLifeDataVersionNumber" ); if( nPick == -1 ): print( "INF: LifeData.getFileVersion: no version number found in %s (file size: %d)" % ( strFilePath, len( enclosedFileData ) ) ); return 0.; rVersion = stringtools.findNumber( enclosedFileData[nPick:] ); return rVersion;
def getPackVersion(self, strMetaDataFileContents): "extract a version from a metadata file" # print( "INF: LifeData.getPackVersion: strMetaDataFileContents: " +strMetaDataFileContents ); nPick = strMetaDataFileContents.find("<version>") if (nPick == -1): print( "INF: LifeData.getPackVersion: no version number found in data (data size: %d)" % (len(strMetaDataFileContents))) return 0. rVersion = stringtools.findNumber(strMetaDataFileContents[nPick:]) return rVersion
def getFileVersion(self, strFilePath): "extract a version from a life_data file (yeah it's this file, but find it without loading it with python)" enclosedFileData = filetools.getFileContents(strFilePath) # print( "INF: LifeData.getFileVersion: '%s'" % enclosedFileData ); nPick = enclosedFileData.find("rLifeDataVersionNumber") if (nPick == -1): print( "INF: LifeData.getFileVersion: no version number found in %s (file size: %d)" % (strFilePath, len(enclosedFileData))) return 0. rVersion = stringtools.findNumber(enclosedFileData[nPick:]) return rVersion