Changeset View
Changeset View
Standalone View
Standalone View
bin/VersionInfo.py
Show All 32 Lines | 32 | possibleInis= [ os.path.join( root, "version.ini" ), os.path.join( root, "..", "version.ini" ), | |||
---|---|---|---|---|---|
33 | os.path.join( root, "..", "..", "version.ini" ) ] | 33 | os.path.join( root, "..", "..", "version.ini" ) ] | ||
34 | else: | 34 | else: | ||
35 | possibleInis = [self._fileName] | 35 | possibleInis = [self._fileName] | ||
36 | 36 | | |||
37 | for iniPath in possibleInis: | 37 | for iniPath in possibleInis: | ||
38 | iniPath = os.path.abspath( iniPath ) | 38 | iniPath = os.path.abspath( iniPath ) | ||
39 | if iniPath in VersionInfo._VERSION_INFOS.keys( ): | 39 | if iniPath in VersionInfo._VERSION_INFOS.keys( ): | ||
40 | VersionInfo._VERSION_INFOS_HINTS[ name ] = iniPath | 40 | VersionInfo._VERSION_INFOS_HINTS[ name ] = iniPath | ||
41 | EmergeDebug.debug("Found a version info for %s in cache" % name, 2) | 41 | EmergeDebug.debug("Found a version info for %s in cache" % name, 1) | ||
42 | return VersionInfo._VERSION_INFOS[ iniPath ] | 42 | return VersionInfo._VERSION_INFOS[ iniPath ] | ||
43 | elif os.path.exists( iniPath ): | 43 | elif os.path.exists( iniPath ): | ||
44 | config = configparser.ConfigParser( ) | 44 | config = configparser.ConfigParser( ) | ||
45 | config.read( iniPath ) | 45 | config.read( iniPath ) | ||
46 | VersionInfo._VERSION_INFOS[ iniPath ] = config | 46 | VersionInfo._VERSION_INFOS[ iniPath ] = config | ||
47 | VersionInfo._VERSION_INFOS_HINTS[ name ] = iniPath | 47 | VersionInfo._VERSION_INFOS_HINTS[ name ] = iniPath | ||
48 | EmergeDebug.debug("Found a version info for %s in %s" % (name, iniPath), 2) | 48 | EmergeDebug.debug("Found a version info for %s in %s" % (name, iniPath), 1) | ||
49 | return config | 49 | return config | ||
50 | VersionInfo._VERSION_INFOS_HINTS[ name ] = None | 50 | VersionInfo._VERSION_INFOS_HINTS[ name ] = None | ||
51 | return self.__defaulVersions | 51 | return self.__defaulVersions | ||
52 | 52 | | |||
53 | 53 | | |||
54 | def _getVersionInfo( self, key, default = "" ): | 54 | def _getVersionInfo( self, key, default = "" ): | ||
55 | if self._defaulVersions.has_section( "General" ) and key in self._defaulVersions[ "General" ]: | 55 | if self._defaulVersions.has_section( "General" ) and key in self._defaulVersions[ "General" ]: | ||
56 | return self._defaulVersions[ "General" ][ key ] | 56 | return self._defaulVersions[ "General" ][ key ] | ||
▲ Show 20 Lines • Show All 82 Lines • Show Last 20 Lines |