Commit 8711c2f4 authored by Daniel Silveira's avatar Daniel Silveira Committed by Luca Giordano

Support to hardcoded files in configure

User now can define their own version of generated files by configure,
by adding .hc in the end of extension. Configure will rename the file
automatically

This is used for init.c of testsuites not being renamed by init.c
generated by config.xml, so in this case a init.c.hc is created

Also being used for the Makefile.hc of edilib

refs #112291
parent 4f1101f7
......@@ -3,13 +3,14 @@
# @author pfnf
# @brief Tool to configuration a AIR OS instalation
__author__ = "pfnf"
__author__ = "pfnf,dtms"
import os
import air
import sys
import utils.templates as makoutils
import utils.terminal as terminalutils
import utils.file as fileutils
import air.configurations as air_configuration
......@@ -48,6 +49,9 @@ def Run(args, logger):
# show info
if args.info: ShowInstallInfo(logger)
#check hardcoded files to replace generated
fileutils.setHardcodedFiles()
# parse input args or prompt the user for configuration
if args.target is None:
arch, bsp, fpu_enabled = prompt_configuration(logger)
......
......@@ -2,7 +2,7 @@
# @author pfnf
# @brief Tool to configuration a AIR OS instalation
__author__ = 'pfnf'
__author__ = 'pfnf,dtms'
import os
import air
......@@ -11,6 +11,7 @@ import utils.file as fileutils
import utils.templates as makoutils
import air.configurations as air_configuration
from localization.logger import *
import parsers.a653.definitions as a653_definitions
......@@ -67,7 +68,7 @@ def Run(args, os_configuration, logger):
print(" PARSING configs")
app_configuration = airParser(os_configuration, logger)
app_configuration.parse(args.xml_file)
print(" done PARSING configs")
#print(" done PARSING configs")
# sanity check
if logger.total_errors > 0:
logger.error(' :: XML configuration contains errors...')
......@@ -175,7 +176,7 @@ def Run(args, os_configuration, logger):
os.path.join(temp_directory, 'Makefile'),
dict(app_configuration=app_configuration),
logger, template_includes)
# load previous cleaning record (if it exists)
record = fileutils.loadFileRecord(os.path.join(air.WORKING_DIRECTORY, '.config'))
fileutils.safeMultiFileCopyWithRecord(temp_directory, air.WORKING_DIRECTORY, record)
......@@ -239,6 +240,7 @@ def convertMemoryPermissions(permissions_str):
## @brief Clear application configuration
# @param logger Logger object
def clearConfiguration(logger):
fileutils.runCleaningRecord(os.path.join(air.WORKING_DIRECTORY, '.config'), logger)
exit(0)
## @package utils.file
# @author pfnf
# @author pfnf,dtms
# @brief File manipulation methods
import os
import shutil
import fnmatch
import re
import utils
import terminal as terminalutils
......@@ -338,3 +340,11 @@ def runCleaningRecord(record, logger, followDefault = False):
if res: safeRemoveFile(record)
## @brief search hardcoded files, they have extension .hc and remove that extension
def setHardcodedFiles():
for root, dirnames, filenames in os.walk('.'):
for filename in fnmatch.filter(filenames, '*.hc'):
#matches.append(os.path.join(root, filename))
old_name = os.path.join(root, filename)
new_name = old_name[:-3]
shutil.copy(old_name, new_name)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment