示例#1
0
	def getDefaultVersion( self, name ) :

		c = self.__findClass( name )

		v = self.__defaultVersions.get( name, c["versions"][-1] )
		if not v in c["versions"] :
			msg( Msg.Level.Warning, "ClassLoader.getDefaultVersion", "Version %d doesn't exist, reverting to version %d." % ( v, c["versions"][-1] ) )
			v = c["versions"][-1]
			self.__defaultVersions[name] = v

		return v
	def getDefaultVersion( self, name ) :

		c = self.__findClass( name )

		v = self.__defaultVersions.get( name, c["versions"][-1] )
		if not v in c["versions"] :
			msg( Msg.Level.Warning, "ClassLoader.getDefaultVersion", "Version %d doesn't exist, reverting to version %d." % ( v, c["versions"][-1] ) )
			v = c["versions"][-1]
			self.__defaultVersions[name] = v

		return v
示例#3
0
	def defaultLoader( cls, envVar ) :

		with cls.__defaultLoaderMutex:
			
			loader = cls.__defaultLoaders.get( envVar, None )
			if loader :
				return loader

			sp = ""
			if envVar in os.environ :
				sp = os.environ[envVar]
			else :
				msg( Msg.Level.Warning, "ClassLoader.defaultLoader", "Environment variable %s not set." % envVar )

			loader = cls( SearchPath( os.path.expandvars( sp ), ";" ) )
			cls.__defaultLoaders[envVar] = loader

			return loader
	def defaultLoader( cls, envVar ) :

		with cls.__defaultLoaderMutex:
			
			loader = cls.__defaultLoaders.get( envVar, None )
			if loader :
				return loader

			sp = ""
			if envVar in os.environ :
				sp = os.environ[envVar]
			else :
				msg( Msg.Level.Warning, "ClassLoader.defaultLoader", "Environment variable %s not set." % envVar )

			loader = cls( SearchPath( os.path.expandvars( sp ), ":" ) )
			cls.__defaultLoaders[envVar] = loader

			return loader