py-eb-model 1.0.3__py3-none-any.whl → 1.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- eb_model/cli/pref_system_importer_cli.py +31 -14
- eb_model/models/abstract.py +1 -2
- eb_model/models/eclipse_project.py +8 -0
- eb_model/models/importer_xdm.py +85 -16
- eb_model/tests/models/test_importer_xdm.py +61 -0
- eb_model/writer/__init__.py +2 -1
- eb_model/writer/project_writer.py +71 -0
- eb_model/writer/text_writer.py +2 -2
- py_eb_model-1.1.0.dist-info/METADATA +184 -0
- {py_eb_model-1.0.3.dist-info → py_eb_model-1.1.0.dist-info}/RECORD +14 -11
- {py_eb_model-1.0.3.dist-info → py_eb_model-1.1.0.dist-info}/entry_points.txt +1 -1
- py_eb_model-1.0.3.dist-info/METADATA +0 -110
- {py_eb_model-1.0.3.dist-info → py_eb_model-1.1.0.dist-info}/LICENSE +0 -0
- {py_eb_model-1.0.3.dist-info → py_eb_model-1.1.0.dist-info}/WHEEL +0 -0
- {py_eb_model-1.0.3.dist-info → py_eb_model-1.1.0.dist-info}/top_level.txt +0 -0
@@ -3,8 +3,9 @@ import pkg_resources
|
|
3
3
|
import logging
|
4
4
|
import sys
|
5
5
|
import os.path
|
6
|
+
import re
|
6
7
|
|
7
|
-
from ..writer import TextPreferenceModelWriter
|
8
|
+
from ..writer import TextPreferenceModelWriter, ABProjectWriter
|
8
9
|
from ..parser import PerfXdmParser
|
9
10
|
from ..models import PreferenceModel
|
10
11
|
|
@@ -12,10 +13,12 @@ def main():
|
|
12
13
|
version = pkg_resources.require("py_eb_model")[0].version
|
13
14
|
|
14
15
|
ap = argparse.ArgumentParser()
|
15
|
-
ap.add_argument("-v", "--verbose", required= False, help = "
|
16
|
-
ap.add_argument("--file-list", required=False, help = "
|
17
|
-
ap.add_argument("--ab-project", required=False, help = "
|
18
|
-
ap.add_argument("--base-path", required=False, help="
|
16
|
+
ap.add_argument("-v", "--verbose", required= False, help = "print debug information.", action = "store_true")
|
17
|
+
ap.add_argument("--file-list", required=False, help = "generate the file list (Default)", action = "store_true")
|
18
|
+
ap.add_argument("--ab-project", required=False, help = "generate the AUTOSAR builder project", action = "store_true")
|
19
|
+
ap.add_argument("--base-path", required=False, help="base Path for EB tresos")
|
20
|
+
ap.add_argument("--env", required=False, help="specify the environment variable", nargs='+')
|
21
|
+
ap.add_argument("--project", required=False, help="specify the project name")
|
19
22
|
ap.add_argument("INPUTS", nargs='+', help = "The path of perf_imp_xxx.xdm.")
|
20
23
|
ap.add_argument("OUTPUT", help = "The path of output file.")
|
21
24
|
|
@@ -34,18 +37,20 @@ def main():
|
|
34
37
|
if os.path.exists(log_file):
|
35
38
|
os.remove(log_file)
|
36
39
|
|
37
|
-
|
38
|
-
|
40
|
+
if args.verbose:
|
41
|
+
file_handler = logging.FileHandler(log_file)
|
42
|
+
file_handler.setFormatter(formatter)
|
43
|
+
file_handler.setLevel(logging.DEBUG)
|
39
44
|
|
40
45
|
logger.setLevel(logging.DEBUG)
|
41
|
-
file_handler.setLevel(logging.DEBUG)
|
42
46
|
|
43
47
|
if args.verbose:
|
44
48
|
stdout_handler.setLevel(logging.DEBUG)
|
45
49
|
else:
|
46
50
|
stdout_handler.setLevel(logging.INFO)
|
47
|
-
|
48
|
-
|
51
|
+
|
52
|
+
if args.verbose:
|
53
|
+
logger.addHandler(file_handler)
|
49
54
|
logger.addHandler(stdout_handler)
|
50
55
|
|
51
56
|
format = "file_list"
|
@@ -63,12 +68,24 @@ def main():
|
|
63
68
|
file_name = file
|
64
69
|
parser.parse_preference_xdm(file_name, doc)
|
65
70
|
|
71
|
+
params = {}
|
72
|
+
params['base_path'] = args.base_path
|
73
|
+
params['wildcard'] = True
|
74
|
+
params['project'] = args.project
|
75
|
+
|
76
|
+
if args.env is not None:
|
77
|
+
for env in args.env:
|
78
|
+
m = re.match(r'(\w+)=([:\/\\\.\w]+)', env)
|
79
|
+
if m:
|
80
|
+
params["env_var:%s" % m.group(1)] = m.group(2)
|
81
|
+
#params['tresos_output_base_dir'] = args.TRESOS_OUTPUT_BASE_DIR
|
82
|
+
|
66
83
|
if format == "file_list":
|
67
84
|
writer = TextPreferenceModelWriter()
|
68
|
-
writer.writer_import_files(args.OUTPUT, doc.getSystemDescriptionImporter(),
|
69
|
-
|
70
|
-
|
71
|
-
|
85
|
+
writer.writer_import_files(args.OUTPUT, doc.getSystemDescriptionImporter(), params)
|
86
|
+
elif format == "ab_project":
|
87
|
+
writer = ABProjectWriter()
|
88
|
+
writer.writer_import_files(args.OUTPUT, doc.getSystemDescriptionImporter(), params)
|
72
89
|
|
73
90
|
except Exception as e:
|
74
91
|
logger.error(e)
|
eb_model/models/abstract.py
CHANGED
eb_model/models/importer_xdm.py
CHANGED
@@ -1,45 +1,114 @@
|
|
1
|
+
from typing import Dict, List
|
2
|
+
|
3
|
+
from ..models.eclipse_project import Link
|
4
|
+
from ..models.abstract import EcucObject
|
1
5
|
import glob
|
2
|
-
from typing import List
|
3
|
-
from .abstract import EcucObject
|
4
6
|
import os
|
5
7
|
import re
|
8
|
+
import logging
|
6
9
|
|
7
10
|
class SystemDescriptionImporter(EcucObject):
|
8
11
|
def __init__(self, parent, name):
|
9
12
|
super().__init__(parent, name)
|
10
|
-
|
13
|
+
|
14
|
+
self.logger = logging.getLogger()
|
11
15
|
self.inputFiles = [] # type: List[str]
|
12
16
|
|
13
17
|
def getInputFiles(self):
|
14
18
|
return self.inputFiles
|
15
19
|
|
16
|
-
def addInputFile(self, value):
|
20
|
+
def addInputFile(self, value: str):
|
17
21
|
self.inputFiles.append(value)
|
18
22
|
return self
|
19
23
|
|
20
24
|
def parseWildcard(self, filename: str) -> List[str]:
|
21
|
-
#path: str, file_pattern: str
|
22
25
|
file_list = []
|
23
|
-
for file in glob.iglob(filename):
|
24
|
-
print(file)
|
26
|
+
for file in glob.iglob(filename, recursive=True):
|
25
27
|
file_list.append(file)
|
26
28
|
return file_list
|
27
29
|
|
28
|
-
def getParsedInputFiles(self,
|
30
|
+
def getParsedInputFiles(self, params = {}) -> List[str]:
|
29
31
|
file_list = []
|
30
32
|
for input_file in self.inputFiles:
|
31
|
-
|
32
|
-
|
33
|
+
m = re.match(r'\$\{(env_var:\w+)\}(.*)', input_file)
|
34
|
+
if m and m.group(1) in params:
|
35
|
+
old_input_file = input_file
|
36
|
+
input_file = params[m.group(1)] + m.group(2)
|
37
|
+
self.logger.info("Replace Environment Variable Path: %s => %s" % (old_input_file, os.path.realpath(input_file)))
|
38
|
+
if params['base_path'] is not None:
|
39
|
+
if params['wildcard']:
|
33
40
|
m = re.match(r'(.+)\\(\*\.\w+)', input_file)
|
34
41
|
if m:
|
35
|
-
|
36
|
-
#for file_name in self.parseWildcard(os.path.realpath(os.path.join(base_path, path)), file_pattern):
|
37
|
-
for file_name in self.parseWildcard(os.path.realpath(os.path.join(base_path, input_file))):
|
42
|
+
for file_name in self.parseWildcard(os.path.realpath(os.path.join(params['base_path'], input_file))):
|
38
43
|
file_list.append(file_name)
|
39
44
|
else:
|
40
|
-
file_list.append(os.path.realpath(os.path.join(base_path, input_file)))
|
45
|
+
file_list.append(os.path.realpath(os.path.join(params['base_path'], input_file)))
|
41
46
|
else:
|
42
|
-
file_list.append(os.path.realpath(os.path.join(base_path, input_file)))
|
47
|
+
file_list.append(os.path.realpath(os.path.join(params['base_path'], input_file)))
|
43
48
|
else:
|
44
49
|
file_list.append(input_file)
|
45
|
-
return file_list
|
50
|
+
return file_list
|
51
|
+
|
52
|
+
def getAllPaths(self, path :str) -> List[str]:
|
53
|
+
path_segments = path.split("/")
|
54
|
+
|
55
|
+
result = []
|
56
|
+
long_path = ""
|
57
|
+
for path_segment in path_segments:
|
58
|
+
if path_segment == "..":
|
59
|
+
continue
|
60
|
+
if long_path == "":
|
61
|
+
long_path = path_segment
|
62
|
+
else:
|
63
|
+
long_path = long_path +"/" + path_segment
|
64
|
+
result.append(long_path)
|
65
|
+
return result
|
66
|
+
|
67
|
+
def getNameByPath(self, path : str):
|
68
|
+
path_segments = path.split("/")
|
69
|
+
|
70
|
+
result = []
|
71
|
+
count = 0
|
72
|
+
for path_segment in path_segments:
|
73
|
+
if path_segment == "..":
|
74
|
+
count += 1
|
75
|
+
else:
|
76
|
+
result.append(path_segment)
|
77
|
+
|
78
|
+
return (count , "/".join(result))
|
79
|
+
|
80
|
+
def getLinks(self, file_list: List[str]) -> List[Link]:
|
81
|
+
path_sets = {} # type: Dict[str, List[str]]
|
82
|
+
path_segment_sets = []
|
83
|
+
|
84
|
+
for file in file_list:
|
85
|
+
path, basename = os.path.split(file)
|
86
|
+
path = os.path.relpath(path).replace("\\", "/")
|
87
|
+
if path not in path_sets:
|
88
|
+
path_sets[path] = []
|
89
|
+
|
90
|
+
# To avoid the duplicate file
|
91
|
+
if basename not in path_sets[path]:
|
92
|
+
path_sets[path].append(basename)
|
93
|
+
|
94
|
+
links = []
|
95
|
+
for name in path_sets:
|
96
|
+
for path_segment in self.getAllPaths(name):
|
97
|
+
if path_segment not in path_sets:
|
98
|
+
if path_segment not in path_segment_sets:
|
99
|
+
path_segment_sets.append(path_segment)
|
100
|
+
|
101
|
+
for segment in path_segment_sets:
|
102
|
+
link = Link(segment, 2, "virtual:/virtual")
|
103
|
+
links.append(link)
|
104
|
+
|
105
|
+
for path_set in path_sets:
|
106
|
+
for basename in path_sets[path_set]:
|
107
|
+
path = os.path.relpath(os.path.join(path_set, basename)).replace("\\", "/")
|
108
|
+
count, name = self.getNameByPath(path)
|
109
|
+
link = Link(name, 1, "PARENT-%d-PROJECT_LOC/%s" % (count, name))
|
110
|
+
links.append(link)
|
111
|
+
|
112
|
+
return links
|
113
|
+
|
114
|
+
|
@@ -0,0 +1,61 @@
|
|
1
|
+
|
2
|
+
from ...models.eb_doc import PreferenceModel
|
3
|
+
from ...models.importer_xdm import SystemDescriptionImporter
|
4
|
+
|
5
|
+
|
6
|
+
class TestSystemDescriptionImporter:
|
7
|
+
|
8
|
+
def test_get_parsed_input_files(self):
|
9
|
+
document = PreferenceModel.getInstance()
|
10
|
+
importer = document.getSystemDescriptionImporter()
|
11
|
+
importer.addInputFile("${env_var:TRESOS_OUTPUT_DIR}\**\*.arxml")
|
12
|
+
input_files = importer.getParsedInputFiles({"env_var:TRESOS_OUTPUT_DIR": "c:/EB/ACG-8_8_8_WIN32X86/workspace/simple_demo_rte/output/generated/swcd", "base_path": None})
|
13
|
+
|
14
|
+
assert(len(input_files) == 1)
|
15
|
+
assert(input_files[0] == "c:/EB/ACG-8_8_8_WIN32X86/workspace/simple_demo_rte/output/generated/swcd\\**\\*.arxml")
|
16
|
+
document = PreferenceModel.getInstance()
|
17
|
+
importer = document.getSystemDescriptionImporter()
|
18
|
+
path_segments = importer.getAllPaths("../../EB/ACG-8_8_8_WIN32X86/workspace/simple_demo_rte/output/generated/swcd")
|
19
|
+
assert(len(path_segments) == 7)
|
20
|
+
assert(path_segments[0] == "EB")
|
21
|
+
assert(path_segments[1] == "EB/ACG-8_8_8_WIN32X86")
|
22
|
+
assert(path_segments[2] == "EB/ACG-8_8_8_WIN32X86/workspace")
|
23
|
+
assert(path_segments[6] == "EB/ACG-8_8_8_WIN32X86/workspace/simple_demo_rte/output/generated/swcd")
|
24
|
+
|
25
|
+
def test_get_links(self):
|
26
|
+
document = PreferenceModel.getInstance()
|
27
|
+
importer = document.getSystemDescriptionImporter()
|
28
|
+
file_list = []
|
29
|
+
file_list.append("../../EB/ACG-8_8_8_WIN32X86/workspace/simple_demo_rte/output/generated/swcd/Atomics_Bswmd.arxml")
|
30
|
+
file_list.append("../../EB/ACG-8_8_8_WIN32X86/workspace/simple_demo_rte/output/generated/swcd/BswM.arxml")
|
31
|
+
file_list.append("../../EB/ACG-8_8_8_WIN32X86/workspace/simple_demo_rte/output/generated/swcd/Atomics_Bswmd.arxml")
|
32
|
+
|
33
|
+
links = importer.getLinks(file_list)
|
34
|
+
assert(len(links) == 9)
|
35
|
+
assert(links[0].name == "EB")
|
36
|
+
assert(links[0].type == 2)
|
37
|
+
assert(links[0].locationURI == "virtual:/virtual")
|
38
|
+
|
39
|
+
assert(links[1].name == "EB/ACG-8_8_8_WIN32X86")
|
40
|
+
assert(links[1].type == 2)
|
41
|
+
assert(links[1].locationURI == "virtual:/virtual")
|
42
|
+
|
43
|
+
assert(links[2].name == "EB/ACG-8_8_8_WIN32X86/workspace")
|
44
|
+
assert(links[2].type == 2)
|
45
|
+
assert(links[2].locationURI == "virtual:/virtual")
|
46
|
+
|
47
|
+
assert(links[3].name == "EB/ACG-8_8_8_WIN32X86/workspace/simple_demo_rte")
|
48
|
+
assert(links[3].type == 2)
|
49
|
+
assert(links[3].locationURI == "virtual:/virtual")
|
50
|
+
|
51
|
+
assert(links[6].name == "EB/ACG-8_8_8_WIN32X86/workspace/simple_demo_rte/output/generated/swcd")
|
52
|
+
assert(links[6].type == 2)
|
53
|
+
assert(links[6].locationURI == "virtual:/virtual")
|
54
|
+
|
55
|
+
assert(links[7].name == "EB/ACG-8_8_8_WIN32X86/workspace/simple_demo_rte/output/generated/swcd/Atomics_Bswmd.arxml")
|
56
|
+
assert(links[7].type == 1)
|
57
|
+
assert(links[7].locationURI == "PARENT-2-PROJECT_LOC/EB/ACG-8_8_8_WIN32X86/workspace/simple_demo_rte/output/generated/swcd/Atomics_Bswmd.arxml")
|
58
|
+
|
59
|
+
assert(links[8].name == "EB/ACG-8_8_8_WIN32X86/workspace/simple_demo_rte/output/generated/swcd/BswM.arxml")
|
60
|
+
assert(links[8].type == 1)
|
61
|
+
assert(links[8].locationURI == "PARENT-2-PROJECT_LOC/EB/ACG-8_8_8_WIN32X86/workspace/simple_demo_rte/output/generated/swcd/BswM.arxml")
|
eb_model/writer/__init__.py
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
from .text_writer import TextPreferenceModelWriter
|
1
|
+
from .text_writer import TextPreferenceModelWriter
|
2
|
+
from .project_writer import ABProjectWriter
|
@@ -0,0 +1,71 @@
|
|
1
|
+
from typing import List
|
2
|
+
from xml.dom import minidom
|
3
|
+
import xml.etree.ElementTree as ET
|
4
|
+
import logging
|
5
|
+
|
6
|
+
from ..models.eclipse_project import Link
|
7
|
+
from ..models.importer_xdm import SystemDescriptionImporter
|
8
|
+
|
9
|
+
class EclipseProjectWriter:
|
10
|
+
def __init__(self):
|
11
|
+
self.logger = logging.getLogger()
|
12
|
+
|
13
|
+
def write_element(self, element: ET.Element, key: str, content: str) -> ET.Element:
|
14
|
+
child_element = ET.SubElement(element, key)
|
15
|
+
child_element.text = str(content)
|
16
|
+
|
17
|
+
return child_element
|
18
|
+
|
19
|
+
def write(self, links: List[Link]):
|
20
|
+
pass
|
21
|
+
|
22
|
+
class ABProjectWriter(EclipseProjectWriter):
|
23
|
+
def __init__(self):
|
24
|
+
super().__init__()
|
25
|
+
|
26
|
+
def _write_link(self, element: ET.Element, link: Link):
|
27
|
+
child_element = ET.SubElement(element, "link")
|
28
|
+
self.write_element(child_element, "name", link.name)
|
29
|
+
self.write_element(child_element, "type", link.type)
|
30
|
+
self.write_element(child_element, "locationURI", link.locationURI)
|
31
|
+
|
32
|
+
def _write_links(self, element: ET.Element, links: List[Link]):
|
33
|
+
child_element = ET.SubElement(element, "linkedResources")
|
34
|
+
for link in links:
|
35
|
+
self._write_link(child_element, link)
|
36
|
+
|
37
|
+
self.logger.info("Total <%d> Links are written." % len(links))
|
38
|
+
|
39
|
+
|
40
|
+
def _write_file_head(self, element: ET.Element, project: str):
|
41
|
+
if project is not None:
|
42
|
+
self.write_element(element, "name", project)
|
43
|
+
else:
|
44
|
+
self.write_element(element, "name", "project")
|
45
|
+
|
46
|
+
self.write_element(element, "comment", "")
|
47
|
+
self.write_element(element, "projects", "")
|
48
|
+
self.write_element(element, "buildSpec", "")
|
49
|
+
child_element = ET.SubElement(element, "natures")
|
50
|
+
self.write_element(child_element, "nature", "org.artop.aal.workspace.autosarnature")
|
51
|
+
|
52
|
+
def write(self, filename: str, project: str, links: List[Link]):
|
53
|
+
root = ET.Element("projectDescription")
|
54
|
+
|
55
|
+
self._write_file_head(root, project)
|
56
|
+
self._write_links(root, links)
|
57
|
+
|
58
|
+
xml = ET.tostring(root, encoding = "UTF-8", xml_declaration = True, short_empty_elements = False)
|
59
|
+
|
60
|
+
dom = minidom.parseString(xml.decode())
|
61
|
+
xml = dom.toprettyxml(indent = " ", encoding = "UTF-8")
|
62
|
+
|
63
|
+
with open(filename, "w", encoding="utf-8") as f_out:
|
64
|
+
f_out.write(xml.decode())
|
65
|
+
|
66
|
+
|
67
|
+
def writer_import_files(self, filename: str, importer: SystemDescriptionImporter, params = {'base_path': None, 'wildcard': None, "project": None}):
|
68
|
+
self.logger.info("Generate AB project <%s>" % filename)
|
69
|
+
file_list = sorted(importer.getParsedInputFiles(params))
|
70
|
+
links = importer.getLinks(file_list)
|
71
|
+
self.write(filename, params['project'], links)
|
eb_model/writer/text_writer.py
CHANGED
@@ -16,10 +16,10 @@ class TextPreferenceModelWriter(TextWriter):
|
|
16
16
|
def __init__(self):
|
17
17
|
super().__init__()
|
18
18
|
|
19
|
-
def writer_import_files(self, filename: str, importer: SystemDescriptionImporter,
|
19
|
+
def writer_import_files(self, filename: str, importer: SystemDescriptionImporter, params = {'base_path': None, 'wildcard': None, "tresos_output_base_dir": None}):
|
20
20
|
self.logger.info("Generate import files list <%s>" % filename)
|
21
21
|
lines = []
|
22
|
-
for file in sorted(importer.getParsedInputFiles(
|
22
|
+
for file in sorted(importer.getParsedInputFiles(params)):
|
23
23
|
if file in lines:
|
24
24
|
self.logger.warning("file <%s> is duplicated." % file)
|
25
25
|
else:
|
@@ -0,0 +1,184 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: py-eb-model
|
3
|
+
Version: 1.1.0
|
4
|
+
Summary: The parser for EB XDM file
|
5
|
+
Home-page: UNKNOWN
|
6
|
+
Author: melodypapa
|
7
|
+
Author-email: melodypapa@outlook.com
|
8
|
+
License: proprietary
|
9
|
+
Keywords: EB Tresos XDM
|
10
|
+
Platform: UNKNOWN
|
11
|
+
Classifier: Development Status :: 1 - Planning
|
12
|
+
Classifier: Environment :: Console
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
15
|
+
Classifier: Operating System :: OS Independent
|
16
|
+
Description-Content-Type: text/markdown
|
17
|
+
Requires-Dist: openpyxl
|
18
|
+
Provides-Extra: pytest
|
19
|
+
Requires-Dist: pytest-cov ; extra == 'pytest'
|
20
|
+
|
21
|
+
# 1. py-eb-model
|
22
|
+
|
23
|
+
1. The python parser engine for EB Tresos Xdm file.
|
24
|
+
2. To support EB Tresos data model with python.
|
25
|
+
|
26
|
+
# 2. How to create the distribution and upload to pypi
|
27
|
+
|
28
|
+
1. Run `python setup.py bdist_wheel` to generate distribution
|
29
|
+
2. Run `twine check dist/*` to check the validation of distribution
|
30
|
+
3. Run `twine upload dist/*` to upload to pypi repository
|
31
|
+
4. Check the website https://pypi.org/project/armodel/ to find out it works or not
|
32
|
+
|
33
|
+
And more details can be found at https://packaging.python.org/
|
34
|
+
|
35
|
+
# 3. CLI
|
36
|
+
|
37
|
+
## 3.1. os-task-xlsx
|
38
|
+
|
39
|
+
Extract the Os Task information from os.xdm and then report all to Excel file.
|
40
|
+
|
41
|
+
```bash
|
42
|
+
os-xdm-xlsx data/Os.xdm data/Os.xlsx
|
43
|
+
```
|
44
|
+
|
45
|
+
**Result:**
|
46
|
+
|
47
|
+
1. OsIsrs
|
48
|
+
|
49
|
+

|
50
|
+
|
51
|
+
1. OsTasks
|
52
|
+
|
53
|
+

|
54
|
+
|
55
|
+
3. OsScheduleTable
|
56
|
+
|
57
|
+

|
58
|
+
|
59
|
+
4. OsCounter
|
60
|
+
|
61
|
+

|
62
|
+
|
63
|
+
## 3.2. rte-task-xls
|
64
|
+
|
65
|
+
Extract the Rte Configuration information from rte.xdm and then report all to Excel file.
|
66
|
+
|
67
|
+
1. Export the Rte Configuration information to excel file
|
68
|
+
|
69
|
+
```bash
|
70
|
+
rte-xdm-xlsx data/Rte.xdm data/Rte.xlsx
|
71
|
+
```
|
72
|
+
|
73
|
+
2. Export the Runnable Entities information to excel file
|
74
|
+
|
75
|
+
```bash
|
76
|
+
rte-xdm-xlsx -r data/Rte.xdm data/Os.xdm data/Runnable.xlsx
|
77
|
+
```
|
78
|
+
|
79
|
+
## 3.3. PrefSystemImporter
|
80
|
+
|
81
|
+
Read the EB preference XDM and generate the ARXML file list into text file or create the AUTOSAR builder project file.
|
82
|
+
|
83
|
+
```bash
|
84
|
+
$ pref-system-importer.exe -h
|
85
|
+
usage: pref-system-importer [-h] [-v] [--file-list] [--ab-project] [--base-path BASE_PATH] [--TRESOS_OUTPUT_BASE_DIR TRESOS_OUTPUT_BASE_DIR] [--project PROJECT] INPUTS [INPUTS ...] OUTPUT
|
86
|
+
|
87
|
+
positional arguments:
|
88
|
+
INPUTS The path of perf_imp_xxx.xdm.
|
89
|
+
OUTPUT The path of output file.
|
90
|
+
|
91
|
+
optional arguments:
|
92
|
+
-h, --help show this help message and exit
|
93
|
+
-v, --verbose print debug information.
|
94
|
+
--file-list generate the file list (Default)
|
95
|
+
--ab-project generate the AUTOSAR builder project
|
96
|
+
--base-path BASE_PATH
|
97
|
+
base Path for EB tresos
|
98
|
+
--env ENV [ENV ...] specify the environment variable
|
99
|
+
--project PROJECT specify the project name
|
100
|
+
```
|
101
|
+
### 3.3.1. Configuration
|
102
|
+
|
103
|
+
**h, help**
|
104
|
+
> Show the usage information
|
105
|
+
|
106
|
+
**-v, --verbose**
|
107
|
+
> Print the extra debug information during execution.
|
108
|
+
|
109
|
+
**--file-list or --ab-project**
|
110
|
+
> Generate ARXML file list text file or AUTOSAR builder project.
|
111
|
+
|
112
|
+
**--base-path**
|
113
|
+
> Base path for the EB tresos project. **For example**: c:/EB/ACG-8_8_8_WIN32X86/workspace/simple_demo_rte
|
114
|
+
>
|
115
|
+
> If the base path is specified, all input preference XDM configuration files will be based on this BasePath, which can solve the problem of the input preference configuration file name being too long.
|
116
|
+
|
117
|
+
**--project**
|
118
|
+
|
119
|
+
> The project name will be generate in the AUTOSAR build project.
|
120
|
+
>
|
121
|
+
> It is meaningless if you choose to generate ARXML file list text file.
|
122
|
+
|
123
|
+
**--env**
|
124
|
+
|
125
|
+
> Replace the variable definition of ${env_var:xxx} which is defined in the EB preference XDM file.
|
126
|
+
|
127
|
+
### 3.3.2. Example
|
128
|
+
|
129
|
+
**To generate the ARXML file list:**
|
130
|
+
|
131
|
+
* Base path: c:/EB/ACG-8_8_8_WIN32X86/workspace/simple_demo_rte
|
132
|
+
* INPUT:
|
133
|
+
* c:/EB/ACG-8_8_8_WIN32X86/workspace/simple_demo_rte/.prefs/pref_imp_exp_Imp_System.xdm
|
134
|
+
* OUTPUT: output.lst
|
135
|
+
|
136
|
+
```bash
|
137
|
+
PrefSystemImporter --base-path c:/EB/ACG-8_8_8_WIN32X86/workspace/simple_demo_rte .prefs/pref_imp_exp_Imp_System.xdm output.lst
|
138
|
+
```
|
139
|
+
|
140
|
+
**To generate the AUTOSAR builder project:**
|
141
|
+
|
142
|
+
All ARXML files in the .project file will use relative path names, so it is recommended to run PrefSystemImporter in the directory where the .project is located.
|
143
|
+
|
144
|
+
* Base Path: c:/EB/ACG-8_8_8_WIN32X86/workspace/simple_demo_rte
|
145
|
+
* INPUTs:
|
146
|
+
* c:/EB/ACG-8_8_8_WIN32X86/workspace/simple_demo_rte/.prefs/pref_imp_exp_Bswm_rte.xdm
|
147
|
+
* c:/EB/ACG-8_8_8_WIN32X86/workspace/simple_demo_rte/.prefs/pref_imp_exp_Imp_System.xdm
|
148
|
+
* OUTPUT
|
149
|
+
* c:/EB/ACG-8_8_8_WIN32X86/workspace/simple_demo_rte/ab_project/.project
|
150
|
+
* Project Name: SimpleDemoRte
|
151
|
+
|
152
|
+
```bash
|
153
|
+
cd c:/EB/ACG-8_8_8_WIN32X86/workspace/simple_demo_rte/ab_project
|
154
|
+
PrefSystemImporter --base-path c:/EB/ACG-8_8_8_WIN32X86/workspace/simple_demo_rte --ab-project --project SimpleDemoRte .prefs/pref_imp_exp_Bswm_rte.xdm .prefs/pref_imp_exp_Imp_System.xdm .project
|
155
|
+
```
|
156
|
+
|
157
|
+
# 4. Change History
|
158
|
+
|
159
|
+
**Version 0.8.0**
|
160
|
+
|
161
|
+
1. Create the basic model for EB xdm. (Issue #1)
|
162
|
+
2. Support to extract the Os Tasks/Isrs from EB xdm and store them in the excel files. (Issue #1)
|
163
|
+
|
164
|
+
**Version 1.0.1**
|
165
|
+
|
166
|
+
1. Change the attribute to start with lowercase
|
167
|
+
2. *read_ref_value* and *read_optional_ref_value* method returns EcucRefType.
|
168
|
+
3. Read the OsScheduleTable and export to excel
|
169
|
+
4. Read the OsCounter and export to excel
|
170
|
+
|
171
|
+
**Version 1.0.2**
|
172
|
+
|
173
|
+
1. Fix the setOsAlarmCallbackName bug
|
174
|
+
|
175
|
+
**Version 1.0.3**
|
176
|
+
|
177
|
+
1. Generate the System import file list based on EB preference Xdm.
|
178
|
+
2. Add the support to read OsTaskAutostart element.
|
179
|
+
3. Add the support to read OsTaskType element.
|
180
|
+
|
181
|
+
**Version 1.1.0**
|
182
|
+
|
183
|
+
|
184
|
+
|
@@ -1,12 +1,13 @@
|
|
1
1
|
eb_model/__init__.py,sha256=oMw5xoAS-lHLxufQSlBIXhGZZMcPmwGFA3PYpTwaQTU,92
|
2
2
|
eb_model/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
3
|
eb_model/cli/os_xdm_2_xls_cli.py,sha256=lTIYNVDDMIKu6sosjV8I3pLQxD-I11cKjUDXTyKDrLE,1643
|
4
|
-
eb_model/cli/pref_system_importer_cli.py,sha256=
|
4
|
+
eb_model/cli/pref_system_importer_cli.py,sha256=M46tHz97GTTud0dCtOhFVZ04B3yzThBmix7OSg00K_c,3315
|
5
5
|
eb_model/cli/rte_xdm_2_xls_cli.py,sha256=83uzE2Vk0h267gWxF9mnWN3Bh69RJpYyKULFXpxTByY,2127
|
6
6
|
eb_model/models/__init__.py,sha256=7_WxCwRdVavLbPzepHWNar3O-rOxhLwmVYWd2pqm2kI,124
|
7
|
-
eb_model/models/abstract.py,sha256=
|
7
|
+
eb_model/models/abstract.py,sha256=9Bvz75pwvSv1Txt68t-01zErY78aWrlis390Mzmfvvw,2394
|
8
8
|
eb_model/models/eb_doc.py,sha256=hPsGdNHlm3vl-ys3B3NGrlJRrWAWPhRvFJrN3fLQTW8,2569
|
9
|
-
eb_model/models/
|
9
|
+
eb_model/models/eclipse_project.py,sha256=W6ovTd3SMnlmWm_efVBZqTUGQebF0hJocsTqMlQ7_XQ,169
|
10
|
+
eb_model/models/importer_xdm.py,sha256=tnd-9Smcd_vLs5t9wb7ob-i-nykUF7xUesf4zxmB4wA,4193
|
10
11
|
eb_model/models/os_xdm.py,sha256=HrAhFiPkbkE_YBihG2S5lQTTU9IQla7O15E8guKLDXg,32439
|
11
12
|
eb_model/models/rte_xdm.py,sha256=73hBsQ7pUePA9ewFI2d50iImI_FA-jzFQFlnp0K6WTs,19407
|
12
13
|
eb_model/parser/__init__.py,sha256=7VOmPr4dng_TrOyDZFu2_s3r0BJZQGiOUxALMY8EnqI,170
|
@@ -25,8 +26,10 @@ eb_model/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
25
26
|
eb_model/tests/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
26
27
|
eb_model/tests/models/test_eb_model.py,sha256=3fpIHhzQlf9KZjm4fZxcSTT4Zio6YhTrcn9UBvlhOfo,1632
|
27
28
|
eb_model/tests/models/test_ecuc_container.py,sha256=lZmtXwPMz9T52WFduTgFy16fO2agjSW-Rl2cVypM86s,722
|
28
|
-
eb_model/
|
29
|
-
eb_model/writer/
|
29
|
+
eb_model/tests/models/test_importer_xdm.py,sha256=F80kO77jeyfCkLPRgRLjEj3UPcrACimR5LhBhFgX_m4,3372
|
30
|
+
eb_model/writer/__init__.py,sha256=CXvQAsNV1OvYClkHdKCG7Q300OVBzcl2TmoD68MyQOs,95
|
31
|
+
eb_model/writer/project_writer.py,sha256=umFx3M-VccqzKRAfGzrbYJwo_n0eCvjpZUbQOfbg0QE,2799
|
32
|
+
eb_model/writer/text_writer.py,sha256=7d4_PUTJk5Y6S_EQflAH3ACDnUw9VwJzP90GFDh0n0I,991
|
30
33
|
py_eb_model/__init__.py,sha256=u3VUin2V_1eExLd9NIpw_LGHIAwaG2vEoyhssZurrvM,69
|
31
34
|
py_eb_model/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
32
35
|
py_eb_model/cli/os_xdm_2_xls_cli.py,sha256=BzeFhyWHbG57qieDNESaXYggszHSy17uwCeXvEfrbCQ,1629
|
@@ -42,9 +45,9 @@ py_eb_model/reporter/markdown.py,sha256=NhcJOFQ_BVbkgGe66uAT7KUPIchWU4kfVMtMLQtb
|
|
42
45
|
py_eb_model/reporter/excel_reporter/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
43
46
|
py_eb_model/reporter/excel_reporter/abstract.py,sha256=BOuLhWwwTwqBzErtmwPrelB1iByMfZP9haFmg9ayFQw,1488
|
44
47
|
py_eb_model/reporter/excel_reporter/os_xdm.py,sha256=WGMxK0PYxi9J5fUZ-EeiiM8NBpIg2WyxRsrN-gK37YE,1589
|
45
|
-
py_eb_model-1.0.
|
46
|
-
py_eb_model-1.0.
|
47
|
-
py_eb_model-1.0.
|
48
|
-
py_eb_model-1.0.
|
49
|
-
py_eb_model-1.0.
|
50
|
-
py_eb_model-1.0.
|
48
|
+
py_eb_model-1.1.0.dist-info/LICENSE,sha256=I52rGS7W1IwAmYCUfqTpDaSHoFAdt7grcNiBhk-Z3eI,1088
|
49
|
+
py_eb_model-1.1.0.dist-info/METADATA,sha256=3eIiugWxfU5Qlgi0vCYMR9UACd5NZcR85o_vU3JIwsA,5759
|
50
|
+
py_eb_model-1.1.0.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
|
51
|
+
py_eb_model-1.1.0.dist-info/entry_points.txt,sha256=yDLH9wnJ5Fp7ImgyFRSnr3mU6nvaenuKZnbe2rgs8Mk,183
|
52
|
+
py_eb_model-1.1.0.dist-info/top_level.txt,sha256=DGBNh6YW_x4RF_UoLKW3cKqb2SLnmfuEIZlkTewR66A,9
|
53
|
+
py_eb_model-1.1.0.dist-info/RECORD,,
|
@@ -1,110 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.1
|
2
|
-
Name: py-eb-model
|
3
|
-
Version: 1.0.3
|
4
|
-
Summary: The parser for EB XDM file
|
5
|
-
Home-page: UNKNOWN
|
6
|
-
Author: melodypapa
|
7
|
-
Author-email: melodypapa@outlook.com
|
8
|
-
License: proprietary
|
9
|
-
Keywords: EB Tresos XDM
|
10
|
-
Platform: UNKNOWN
|
11
|
-
Classifier: Development Status :: 1 - Planning
|
12
|
-
Classifier: Environment :: Console
|
13
|
-
Classifier: Programming Language :: Python :: 3
|
14
|
-
Classifier: License :: OSI Approved :: MIT License
|
15
|
-
Classifier: Operating System :: OS Independent
|
16
|
-
Description-Content-Type: text/markdown
|
17
|
-
Requires-Dist: openpyxl
|
18
|
-
Provides-Extra: pytest
|
19
|
-
Requires-Dist: pytest-cov ; extra == 'pytest'
|
20
|
-
|
21
|
-
# 1. py-eb-model
|
22
|
-
|
23
|
-
1. The python parser engine for EB Tresos Xdm file.
|
24
|
-
2. To support EB Tresos data model with python.
|
25
|
-
|
26
|
-
# 2. How to create the distribution and upload to pypi
|
27
|
-
|
28
|
-
1. Run `python setup.py bdist_wheel` to generate distribution
|
29
|
-
2. Run `twine check dist/*` to check the validation of distribution
|
30
|
-
3. Run `twine upload dist/*` to upload to pypi repository
|
31
|
-
4. Check the website https://pypi.org/project/armodel/ to find out it works or not
|
32
|
-
|
33
|
-
And more details can be found at https://packaging.python.org/
|
34
|
-
|
35
|
-
# 3. CLI
|
36
|
-
|
37
|
-
## 3.1. os-task-xlsx
|
38
|
-
|
39
|
-
Extract the Os Task information from os.xdm and then report all to Excel file.
|
40
|
-
|
41
|
-
```bash
|
42
|
-
os-xdm-xlsx data/Os.xdm data/Os.xlsx
|
43
|
-
```
|
44
|
-
|
45
|
-
**Result:**
|
46
|
-
|
47
|
-
1. OsIsrs
|
48
|
-
|
49
|
-

|
50
|
-
|
51
|
-
1. OsTasks
|
52
|
-
|
53
|
-

|
54
|
-
|
55
|
-
3. OsScheduleTable
|
56
|
-
|
57
|
-

|
58
|
-
|
59
|
-
4. OsCounter
|
60
|
-
|
61
|
-

|
62
|
-
|
63
|
-
## 3.2. rte-task-xls
|
64
|
-
|
65
|
-
Extract the Rte Configuration information from rte.xdm and then report all to Excel file.
|
66
|
-
|
67
|
-
1. Export the Rte Configuration information to excel file
|
68
|
-
|
69
|
-
```bash
|
70
|
-
rte-xdm-xlsx data/Rte.xdm data/Rte.xlsx
|
71
|
-
```
|
72
|
-
|
73
|
-
2. Export the Runnable Entities information to excel file
|
74
|
-
|
75
|
-
```bash
|
76
|
-
rte-xdm-xlsx -r data/Rte.xdm data/Os.xdm data/Runnable.xlsx
|
77
|
-
```
|
78
|
-
|
79
|
-
## 3.3. pref-system-importer
|
80
|
-
|
81
|
-
Read the EB preference XDM and generate the file list into text file.
|
82
|
-
|
83
|
-
```bash
|
84
|
-
pref-system-importer .prefs/pref_imp_exp_Imp_System.xdm data/output.lst --base-path /c/EB/ACG-8_8_8_WIN32X86/workspace/simple_demo_rte
|
85
|
-
```
|
86
|
-
|
87
|
-
# 4. Change History
|
88
|
-
|
89
|
-
**Version 0.8.0**
|
90
|
-
|
91
|
-
1. Create the basic model for EB xdm. (Issue #1)
|
92
|
-
2. Support to extract the Os Tasks/Isrs from EB xdm and store them in the excel files. (Issue #1)
|
93
|
-
|
94
|
-
**Version 1.0.1**
|
95
|
-
|
96
|
-
1. Change the attribute to start with lowercase
|
97
|
-
2. *read_ref_value* and *read_optional_ref_value* method returns EcucRefType.
|
98
|
-
3. Read the OsScheduleTable and export to excel
|
99
|
-
4. Read the OsCounter and export to excel
|
100
|
-
|
101
|
-
**Version 1.0.2**
|
102
|
-
|
103
|
-
1. Fix the setOsAlarmCallbackName bug
|
104
|
-
|
105
|
-
**Version 1.0.3**
|
106
|
-
|
107
|
-
1. Generate the System import file list based on EB preference Xdm.
|
108
|
-
2. Add the support to read OsTaskAutostart element.
|
109
|
-
3. Add the support to read OsTaskType element.
|
110
|
-
|
File without changes
|
File without changes
|
File without changes
|