Exemplo n.º 1
0
def upgradeDesign(additionalParam):
    """Method for adjusting Design.xml for a new Design.xsd when updating to a new version of the Framework"""
    print("Formatting your design file ...")
    formatDesign()

    output = "Design.xml.upgraded"
    transformDesignVerbose(designPath + "designToUpgradedDesign.xslt",
                           designPath + output, 0, 0, additionalParam)

    print("Formatting the upgraded file ")
    formatedOutput = output + ".formatted"
    if platform.system() == "Windows":
        subprocessWithImprovedErrorsPipeOutputToFile(
            [getCommand("xmllint"), designPath + output],
            designPath + formatedOutput, getCommand("xmllint"))
    elif platform.system() == "Linux":
        subprocessWithImprovedErrorsPipeOutputToFile(
            [getCommand("xmllint"), "--format", designPath + output],
            designPath + formatedOutput, getCommand("xmllint"))

    print("Now running merge-tool. Please merge the upgraded changed")
    subprocessWithImprovedErrors([
        getCommand("diff"), "-o", designPath + designXML,
        designPath + designXML, designPath + formatedOutput
    ], getCommand("diff"))
Exemplo n.º 2
0
def formatXml(inFileName, outFileName):
    if platform.system() == "Windows":
        subprocessWithImprovedErrorsPipeOutputToFile(
            [getCommand("xmllint"), inFileName], outFileName,
            getCommand("xmllint"))
    elif platform.system() == "Linux":
        subprocessWithImprovedErrorsPipeOutputToFile(
            [getCommand("xmllint"), "--format", inFileName], outFileName,
            getCommand("xmllint"))
Exemplo n.º 3
0
def generateConfiguration(context):
	"""Generates the file Configuration.xsd. This method is called automatically by cmake, it does not need to be called by the user."""
	config_xsd_path = os.path.join(context['projectBinaryDir'],'Configuration','Configuration.xsd')
	try: 
		transformByKey( TransformKeys.CONFIGURATION_XSD, {
			'context':context,
			'metaXsdPath':os.path.join(context['projectSourceDir'],'Meta','config','Meta.xsd').replace('\\','/') } )
	except:	
		if os.path.isfile(config_xsd_path):
			os.remove(config_xsd_path)
		raise
	subprocessWithImprovedErrorsPipeOutputToFile(
		[getCommand("xmllint"), "--xinclude", getTransformOutput(TransformKeys.CONFIGURATION_XSD, {'context':context})], 
		config_xsd_path, 
		getCommand("xmllint"))
Exemplo n.º 4
0
def formatDesign():
	"""Formats design.xml. This is done to have always the same indentation format. The formatting is done in a separate file, in case something goes wrong, and then copied over."""
	backupName = designXML + ".backup"
	tempName = designXML + ".new"

	print("Creating a backup of " + designXML + " under the name of " + backupName)
	shutil.copyfile(designPath + designXML, designPath + backupName)

	print("Formatting the file " + designXML + "using the tool XMLlint. The result will be saved in " + tempName)
	try:
		if platform.system() == "Windows":
			subprocessWithImprovedErrorsPipeOutputToFile([getCommand("xmllint"), designPath + designXML], designPath + tempName, getCommand("xmllint"))
		elif platform.system() == "Linux":
			subprocessWithImprovedErrorsPipeOutputToFile([getCommand("xmllint"), "--format", designPath + designXML], designPath + tempName, getCommand("xmllint"))
	except Exception, e:
		raise Exception ("There was a problem formatting the file [" + designXML + "]; Exception: [" + str(e) + "]")
Exemplo n.º 5
0
def formatDesign():
	"""Formats design.xml. This is done to have always the same indentation format. The formatting is done in a separate file, in case something goes wrong, and then copied over."""
	backupName = designXML + ".backup"
	tempName = designXML + ".new"

	print("Creating a backup of " + designXML + " under the name of " + backupName)
	shutil.copyfile(designPath + designXML, designPath + backupName)

	print("Formatting the file " + designXML + "using the tool XMLlint. The result will be saved in " + tempName)
	try:
		if platform.system() == "Windows":
			subprocessWithImprovedErrorsPipeOutputToFile([getCommand("xmllint"), designPath + designXML], designPath + tempName, getCommand("xmllint"))
		elif platform.system() == "Linux":
			subprocessWithImprovedErrorsPipeOutputToFile([getCommand("xmllint"), "--format", designPath + designXML], designPath + tempName, getCommand("xmllint"))
	except Exception, e:
		raise Exception ("There was a problem formatting the file [" + designXML + "]; Exception: [" + str(e) + "]")
Exemplo n.º 6
0
def generateConfiguration():
    """Generates the file Configuration.xsd. This method is called automatically by cmake, it does not need to be called by the user."""
    outputFile = os.path.join('Configuration', 'Configuration.xsd')
    cleanedOutputFile = os.path.join('Configuration', 'Configuration.xsd.new')
    transformationFile = os.path.join(configPath,
                                      "designToConfigurationXSD.xslt")
    #output = "Configuration.xsd"
    transformDesignVerbose(transformationFile, outputFile, 0, 0)
    print("Calling xmllint to modify " + outputFile)
    #this call is not using subprocess with improved errors because of the need of the piping.
    subprocessWithImprovedErrorsPipeOutputToFile(
        [getCommand("xmllint"), "--xinclude", outputFile], cleanedOutputFile,
        getCommand("xmllint"))
    print("Copying the modified file  " + cleanedOutputFile +
          " into the name of " + outputFile)
    shutil.copyfile(cleanedOutputFile, outputFile)
Exemplo n.º 7
0
def upgradeDesign(additionalParam):
	"""Method for adjusting Design.xml for a new Design.xsd when updating to a new version of the Framework"""
	print("Formatting your design file ...")
	formatDesign()
	
	output = "Design.xml.upgraded"
	transformDesignVerbose(designPath + "designToUpgradedDesign.xslt", designPath + output, 0, 0, additionalParam)
	
	print("Formatting the upgraded file ")
	formatedOutput = output + ".formatted"
	if platform.system() == "Windows":
		subprocessWithImprovedErrorsPipeOutputToFile([getCommand("xmllint"), designPath + output], designPath + formatedOutput, getCommand("xmllint"))
	elif platform.system() == "Linux":
		subprocessWithImprovedErrorsPipeOutputToFile([getCommand("xmllint"), "--format", designPath + output], designPath + formatedOutput, getCommand("xmllint"))
		
	print("Now running merge-tool. Please merge the upgraded changed")
	subprocessWithImprovedErrors([getCommand("diff"), "-o", designPath + designXML, designPath + designXML, designPath + formatedOutput], getCommand("diff"))
def generateConfiguration(projectBinaryDir):
    """Generates the file Configuration.xsd. This method is called automatically by cmake, it does not need to be called by the user."""
    outputFile = os.path.join(projectBinaryDir, 'Configuration',
                              'Configuration.xsd')
    cleanedOutputFile = os.path.join(projectBinaryDir, 'Configuration',
                                     'Configuration.xsd.new')
    transformationFile = os.path.join(configPath,
                                      "designToConfigurationXSD.xslt")
    transformDesignVerbose(transformationFile,
                           outputFile,
                           0,
                           astyleRun=False,
                           additionalParam="metaXsdPath={0}".format(
                               os.path.join(os.getcwd(), "Meta", "config",
                                            "Meta.xsd")))
    print("Calling xmllint to modify " + outputFile)
    #this call is not using subprocess with improved errors because of the need of the piping.
    subprocessWithImprovedErrorsPipeOutputToFile(
        [getCommand("xmllint"), "--xinclude", outputFile], cleanedOutputFile,
        getCommand("xmllint"))
    print("Copying the modified file  " + cleanedOutputFile +
          " into the name of " + outputFile)
    shutil.copyfile(cleanedOutputFile, outputFile)