Пример #1
0
	def getLatestVersions( self ):
		'''
		This Method Gets The Last Online Release Version Number By Downloading The Change Log File And Parse It.
		'''

		if os.path.exists( self.cLocalReleasesFile ):
			self.cReleases = sIBL_Parser.sIBL_Parser( self.cLocalReleasesFile )
		else :
			cLogger.error( "'%s'.", "sIBL_GUI | " + "Failed To Access Local Change Log !" )
Пример #2
0
    def getLatestVersions(self):
        '''
		This Method Gets The Last Online Release Version Number By Downloading The Change Log File And Parse It.
		'''

        if os.path.exists(self.cLocalReleasesFile):
            self.cReleases = sIBL_Parser.sIBL_Parser(self.cLocalReleasesFile)
        else:
            cLogger.error(
                "'%s'.", "sIBL_GUI | " + "Failed To Access Local Change Log !")
Пример #3
0
def sIBL_Framework(sIBLFile, cTemplateFile, cOutputFile, cOverrideKeys):
    '''
	This Definition Outputs The Loader Script File By Processing The sIBL File And The Template File.

	@param sIBLFile: Current sIBL File Path. ( String )
	@param cTemplateFile: Current Template File Path. ( String )
	@param cOutputFile: Current Loader Script Output Path. ( String )
	@param cOverrideKeys: Current Provided Override Keys. ( String )
	@return: Error State Of The Output And Output File Path. ( Boolean, String )
	'''

    sIBLPath = os.path.abspath(os.path.dirname(sIBLFile)).replace("\\",
                                                                  "/") + "/"
    cLogger.debug("> Current sIBLPath : '%s'.", sIBLPath)

    # Get sIBL File Concatened Sections Attributes.
    cLogger.debug("> ------ Parsing '%s' File ------", "sIBL")
    cSIBLFile = sIBL_Parser.sIBL_Parser(sIBLFile)

    if cSIBLFile is None:
        return False, None
    cSIBLFileSections = cSIBLFile.getSections()

    # If .IBL File Seem Corrupted Or Invalid.
    if cSIBLFileSections is None:
        return False, None

    cSIBLSectionsAttributes = {}
    cDynamicLights = []
    for cSection in cSIBLFileSections.keys():
        cLogger.debug("> Current sIBL File Section : '%s'.", cSection)
        if not "Light" in cSection:
            cSIBLSectionsAttributes.update(
                cSIBLFile.getSectionAttributes(cSection))
        else:
            # Dynamic Lights Attributes
            cLightAttributes = cSIBLFile.getSectionAttributes(cSection, True)
            cDynamicLights.append(cSection)
            cDynamicLights.append(cLightAttributes["LIGHTname"])
            cLightColorTokens = cLightAttributes["LIGHTcolor"].split(",")
            for cColor in cLightColorTokens:
                cDynamicLights.append(cColor)
            cDynamicLights.append(cLightAttributes["LIGHTmulti"])
            cDynamicLights.append(cLightAttributes["LIGHTu"])
            cDynamicLights.append(cLightAttributes["LIGHTv"])

            cLogger.debug("> Dynamic Lights : '%s'.", cDynamicLights)

    # Preparing The Dynamic Lights String
    cDynamicLightsString = ""
    for cComponent in cDynamicLights:
        cDynamicLightsString = cDynamicLightsString + cComponent + "|"

    # Adding The Dynamic Lights String
    if cDynamicLightsString == "":
        cDynamicLightsString = "-1"
    else:
        cDynamicLightsString = cDynamicLightsString[:-1]

    cSIBLSectionsAttributes[sIBL_Parser.sIBL_CompoundNamespace(
        "Lights", "DynamicLights")] = cDynamicLightsString

    # Get Template File Sections.
    cLogger.debug("> ------ Parsing '%s' File ------", "Template")
    cTemplateFile = sIBL_Parser.sIBL_Parser(cTemplateFile)

    if cTemplateFile is None:
        return False, None
    cTemplateFileSections = cTemplateFile.getSections()

    # If Template File Seem Corrupted Or Invalid.
    if cTemplateFileSections is None:
        return False, None

    # Get Template File Concatened Sections Attributes And Values.
    cTemplateSectionsAttributesStore = {}

    for cKey in cTemplateFileSections.keys():
        if cKey != "Script":
            cLogger.debug("> Current Template File Processed Section : '%s'.",
                          cKey)
            if cKey == "sIBL File Attributes":
                cTemplateSectionsAttributesStore.update(
                    cTemplateFile.getSectionAttributes(cKey, True))
            else:
                cTemplateSectionsAttributesStore.update(
                    cTemplateFile.getSectionAttributes(cKey))

    # Get A Copy Of Template File Concatened Sections Attributes In Order To Update It.
    cTemplateSectionsAttributes = cTemplateSectionsAttributesStore.copy()

    # Update Template File Attributes With sIBL File Ones.
    for cKey in cTemplateSectionsAttributes:
        if cKey in cSIBLSectionsAttributes:
            # Updating Path To The File.
            if "file" in cKey:
                cTemplateSectionsAttributes[
                    cKey] = sIBLPath + cSIBLSectionsAttributes[cKey]
            else:
                cTemplateSectionsAttributes[cKey] = cSIBLSectionsAttributes[
                    cKey]
        else:
            # Need An Number Here More Than A String Here, Or Typed Variables Script Will Need To Write Cast Functions.
            cTemplateSectionsAttributes[cKey] = "-1"
            # cTemplateSectionsAttributes[cKey] = "\"Not Available\""

    # Get Default Values, Types And Update Template Attributes With Default Values.
    cTemplateSectionsAttributesValues = {}
    cTemplateSectionsAttributesTypes = {}
    for cKey in cTemplateSectionsAttributesStore:
        if "|" in cTemplateSectionsAttributesStore[cKey]:
            cTemplateSectionsAttributesValues[
                cKey] = sIBL_Parser.sIBL_GetExtraAttributeComponents(
                    cTemplateSectionsAttributesStore[cKey], "Value")
            cTemplateSectionsAttributesTypes[
                cKey] = sIBL_Parser.sIBL_GetExtraAttributeComponents(
                    cTemplateSectionsAttributesStore[cKey], "Type")
            cTemplateSectionsAttributesStore[
                cKey] = sIBL_Parser.sIBL_GetExtraAttributeComponents(
                    cTemplateSectionsAttributesStore[cKey],
                    "Attribute Link Name")

    cTemplateSectionsAttributes.update(cTemplateSectionsAttributesValues)

    # Manually Updating Template Attributes With Override Keys (Manual In Order To Not Transmit Erroneus Keys).
    if cOverrideKeys is not None:
        for cKey in cOverrideKeys:
            if cKey in cTemplateSectionsAttributes:
                cTemplateSectionsAttributes[cKey] = cOverrideKeys[cKey]
            else:
                try:
                    raise sIBL_Exceptions.Invalid_Key_Error(
                        "Invalid cKey Provided ! : '%s'" % cKey)
                except sIBL_Exceptions.Invalid_Key_Error, cError:
                    sIBL_Exceptions.sIBL_Exceptions_Feedback(
                        cError,
                        "Exception In sIBL_Framework Main() Definition | '%s'"
                        % cError.cValue)
                    return False, None
Пример #4
0
def sIBL_Framework( sIBLFile, cTemplateFile, cOutputFile, cOverrideKeys ):
	'''
	This Definition Outputs The Loader Script File By Processing The sIBL File And The Template File.

	@param sIBLFile: Current sIBL File Path. ( String )
	@param cTemplateFile: Current Template File Path. ( String )
	@param cOutputFile: Current Loader Script Output Path. ( String )
	@param cOverrideKeys: Current Provided Override Keys. ( String )
	@return: Error State Of The Output And Output File Path. ( Boolean, String )
	'''

	sIBLPath = os.path.abspath( os.path.dirname( sIBLFile ) ).replace( "\\", "/" ) + "/"
	cLogger.debug( "> Current sIBLPath : '%s'.", sIBLPath )

	# Get sIBL File Concatened Sections Attributes.
	cLogger.debug( "> ------ Parsing '%s' File ------", "sIBL" )
	cSIBLFile = sIBL_Parser.sIBL_Parser( sIBLFile )

	if cSIBLFile is  None :
		return False, None
	cSIBLFileSections = cSIBLFile.getSections()

	# If .IBL File Seem Corrupted Or Invalid.
	if cSIBLFileSections is None :
		return False, None

	cSIBLSectionsAttributes = {}
	cDynamicLights = []
	for cSection in cSIBLFileSections.keys():
		cLogger.debug( "> Current sIBL File Section : '%s'.", cSection )
		if not "Light" in cSection :
			cSIBLSectionsAttributes.update( cSIBLFile.getSectionAttributes( cSection ) )
		else :
			# Dynamic Lights Attributes
			cLightAttributes = cSIBLFile.getSectionAttributes( cSection, True )
			cDynamicLights.append( cSection )
			cDynamicLights.append( cLightAttributes["LIGHTname"] )
			cLightColorTokens = cLightAttributes["LIGHTcolor"].split( "," )
			for cColor in cLightColorTokens:
				cDynamicLights.append( cColor )
			cDynamicLights.append( cLightAttributes["LIGHTmulti"] )
			cDynamicLights.append( cLightAttributes["LIGHTu"] )
			cDynamicLights.append( cLightAttributes["LIGHTv"] )

			cLogger.debug( "> Dynamic Lights : '%s'.", cDynamicLights )

	# Preparing The Dynamic Lights String
	cDynamicLightsString = ""
	for cComponent in cDynamicLights :
		cDynamicLightsString = cDynamicLightsString + cComponent + "|"

	# Adding The Dynamic Lights String
	if cDynamicLightsString == "" :
		cDynamicLightsString = "-1"
	else :
		cDynamicLightsString = cDynamicLightsString[:-1]

	cSIBLSectionsAttributes[sIBL_Parser.sIBL_CompoundNamespace( "Lights", "DynamicLights" )] = cDynamicLightsString

	# Get Template File Sections.
	cLogger.debug( "> ------ Parsing '%s' File ------", "Template" )
	cTemplateFile = sIBL_Parser.sIBL_Parser( cTemplateFile )

	if cTemplateFile is None :
		return False, None
	cTemplateFileSections = cTemplateFile.getSections()

	# If Template File Seem Corrupted Or Invalid.
	if cTemplateFileSections is None :
		return False, None

	# Get Template File Concatened Sections Attributes And Values.
	cTemplateSectionsAttributesStore = {}

	for cKey in cTemplateFileSections.keys():
		if cKey != "Script" :
			cLogger.debug( "> Current Template File Processed Section : '%s'.", cKey )
			if cKey == "sIBL File Attributes" :
				cTemplateSectionsAttributesStore.update( cTemplateFile.getSectionAttributes( cKey, True ) )
			else :
				cTemplateSectionsAttributesStore.update( cTemplateFile.getSectionAttributes( cKey ) )

	# Get A Copy Of Template File Concatened Sections Attributes In Order To Update It.
	cTemplateSectionsAttributes = cTemplateSectionsAttributesStore.copy()

	# Update Template File Attributes With sIBL File Ones.
	for cKey in cTemplateSectionsAttributes:
		if cKey in cSIBLSectionsAttributes :
			# Updating Path To The File.
			if "file" in cKey:
				cTemplateSectionsAttributes[cKey] = sIBLPath + cSIBLSectionsAttributes[cKey]
			else :
				cTemplateSectionsAttributes[cKey] = cSIBLSectionsAttributes[cKey]
		else :
			# Need An Number Here More Than A String Here, Or Typed Variables Script Will Need To Write Cast Functions.
			cTemplateSectionsAttributes[cKey] = "-1"
			# cTemplateSectionsAttributes[cKey] = "\"Not Available\""

	# Get Default Values, Types And Update Template Attributes With Default Values.
	cTemplateSectionsAttributesValues = {}
	cTemplateSectionsAttributesTypes = {}
	for cKey in cTemplateSectionsAttributesStore:
		if "|" in cTemplateSectionsAttributesStore[cKey] :
			cTemplateSectionsAttributesValues[cKey] = sIBL_Parser.sIBL_GetExtraAttributeComponents( cTemplateSectionsAttributesStore[cKey], "Value" )
			cTemplateSectionsAttributesTypes[cKey] = sIBL_Parser.sIBL_GetExtraAttributeComponents( cTemplateSectionsAttributesStore[cKey], "Type" )
			cTemplateSectionsAttributesStore[cKey] = sIBL_Parser.sIBL_GetExtraAttributeComponents( cTemplateSectionsAttributesStore[cKey], "Attribute Link Name" )

	cTemplateSectionsAttributes.update( cTemplateSectionsAttributesValues )

	# Manually Updating Template Attributes With Override Keys (Manual In Order To Not Transmit Erroneus Keys).
	if cOverrideKeys is not None :
		for cKey in cOverrideKeys :
			if cKey in cTemplateSectionsAttributes :
				cTemplateSectionsAttributes[cKey] = cOverrideKeys[cKey]
			else :
				try:
					raise sIBL_Exceptions.Invalid_Key_Error( "Invalid cKey Provided ! : '%s'" % cKey )
				except sIBL_Exceptions.Invalid_Key_Error, cError:
					sIBL_Exceptions.sIBL_Exceptions_Feedback ( cError, "Exception In sIBL_Framework Main() Definition | '%s'" % cError.cValue )
					return False, None