Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"bdist",
"Bswm",
"Bswmd",
"CORTEXM",
"datamodel",
"ebmodel",
"Ecuc",
Expand All @@ -17,6 +18,7 @@
"Microkernel",
"nsmap",
"openpyxl",
"OSDEFAULTAPPMODE",
"ostask",
"preemptable",
"prefs",
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,9 @@ PrefSystemImporter --base-path c:/EB/ACG-8_8_8_WIN32X86/workspace/simple_demo_rt

1. Solve the case issue of read_optional_value enables attribute.
2. Support to read IMPORT_INFO for OsResource.
3. Add the test cases for OsXdmParser.
3. Add the test cases for OsXdmParser.

**Version 1.1.8**

1. Support to read NvM configuration from EB tresos Xdm file
2. Export the NvM Configuration to excel file.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setup(
name='py_eb_model',
version='1.1.7',
version='1.1.8',
license='proprietary',
description="The parser for EB XDM file",
long_description=long_description,
Expand Down
35 changes: 22 additions & 13 deletions src/eb_model/cli/pref_system_importer_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,31 @@
from ..parser import PerfXdmParser
from ..models import PreferenceModel


def main():
version = pkg_resources.require("py_eb_model")[0].version

ap = argparse.ArgumentParser()
ap.add_argument("-v", "--verbose", required= False, help = "print debug information.", action = "store_true")
ap.add_argument("--file-list", required=False, help = "generate the file list (Default)", action = "store_true")
ap.add_argument("--ab-project", required=False, help = "generate the AUTOSAR builder project", action = "store_true")
ap.add_argument("--base-path", required=True, help="base Path for EB tresos")
ap.add_argument("--env", required=False, help="specify the environment variable", nargs='+')
ap.add_argument("--project", required=False, help="specify the project name")
ap.add_argument("INPUTS", nargs='+', help = "The path of perf_imp_xxx.xdm.")
ap.add_argument("OUTPUT", help = "The path of output file.")
ap.description = "PrefSystemImporter ver: %s" % version
ap.add_argument("-v", "--verbose", required=False,
help="print debug information.", action="store_true")
ap.add_argument("--file-list", required=False,
help="generate the file list (Default)", action="store_true")
ap.add_argument("--ab-project", required=False,
help="generate the AUTOSAR builder project", action="store_true")
ap.add_argument("--base-path", required=True,
help="base Path for EB tresos")
ap.add_argument("--env", required=False,
help="specify the environment variable", nargs='+')
ap.add_argument("--project", required=False,
help="specify the project name")
ap.add_argument("INPUTS", nargs='+', help="The path of perf_imp_xxx.xdm.")
ap.add_argument("OUTPUT", help="The path of output file.")

args = ap.parse_args()

logger = logging.getLogger()

formatter = logging.Formatter('[%(levelname)s] : %(message)s')

stdout_handler = logging.StreamHandler(sys.stderr)
Expand All @@ -48,7 +56,7 @@ def main():
stdout_handler.setLevel(logging.DEBUG)
else:
stdout_handler.setLevel(logging.INFO)

if args.verbose:
logger.addHandler(file_handler)
logger.addHandler(stdout_handler)
Expand All @@ -68,7 +76,8 @@ def main():
parser = PerfXdmParser()
for file in args.INPUTS:
if args.base_path is not None:
file_name = os.path.realpath(os.path.join(args.base_path, file))
file_name = os.path.realpath(
os.path.join(args.base_path, file))
else:
file_name = file
parser.parse_preference_xdm(file_name, doc)
Expand All @@ -80,15 +89,15 @@ def main():
m = re.match(r'(\w+)=([:\/\\\.\w]+)', env)
if m:
params["env_var:%s" % m.group(1)] = m.group(2)
#params['tresos_output_base_dir'] = args.TRESOS_OUTPUT_BASE_DIR
# params['tresos_output_base_dir'] = args.TRESOS_OUTPUT_BASE_DIR

if format == "file_list":
writer = TextPreferenceModelWriter()
writer.writer_import_files(args.OUTPUT, doc.getSystemDescriptionImporter(), params)
elif format == "ab_project":
writer = ABProjectWriter()
writer.writer_import_files(args.OUTPUT, doc.getSystemDescriptionImporter(), params)

except Exception as e:
logger.error(e)
raise e
4 changes: 3 additions & 1 deletion src/eb_model/models/importer_xdm.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@ def getParsedInputFiles(self, params={}) -> List[str]:
if m and m.group(1) in params:
old_input_file = input_file
input_file = params[m.group(1)] + m.group(2)
self.logger.info("Replace Environment Variable Path: %s => %s" % (old_input_file, os.path.realpath(input_file)))
# self.logger.info("Replace Environment Variable Path: %s => %s" % (old_input_file, os.path.realpath(input_file)))
self.logger.info("Replace Environment Variable Path: %s => %s" % (old_input_file, input_file))
if params['base_path'] is not None:
if params['wildcard']:
m = re.match(r'(.+)\\(\*\.\w+)', input_file)
if m:
for file_name in self.parseWildcard(os.path.realpath(os.path.join(params['base_path'], input_file))):
# self.logger.info("Add the file <%s>." % file_name)
file_list.append(file_name)
else:
file_list.append(os.path.realpath(os.path.join(params['base_path'], input_file)))
Expand Down
Loading