py-eb-model 1.0.3__py3-none-any.whl → 1.1.1__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 +33 -14
- eb_model/models/abstract.py +58 -3
- eb_model/models/eclipse_project.py +8 -0
- eb_model/models/importer_xdm.py +86 -16
- eb_model/models/os_xdm.py +2 -3
- eb_model/models/rte_xdm.py +68 -20
- eb_model/parser/eb_parser.py +16 -3
- eb_model/parser/os_xdm_parser.py +10 -1
- eb_model/parser/pref_xdm_parser.py +12 -1
- eb_model/parser/rte_xdm_parser.py +50 -18
- eb_model/reporter/excel_reporter/rte_xdm.py +1 -1
- 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.1.dist-info/METADATA +188 -0
- {py_eb_model-1.0.3.dist-info → py_eb_model-1.1.1.dist-info}/RECORD +21 -18
- {py_eb_model-1.0.3.dist-info → py_eb_model-1.1.1.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.1.dist-info}/LICENSE +0 -0
- {py_eb_model-1.0.3.dist-info → py_eb_model-1.1.1.dist-info}/WHEEL +0 -0
- {py_eb_model-1.0.3.dist-info → py_eb_model-1.1.1.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=
|
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=True, 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"
|
@@ -55,6 +60,11 @@ def main():
|
|
55
60
|
try:
|
56
61
|
doc = PreferenceModel.getInstance()
|
57
62
|
|
63
|
+
params = {}
|
64
|
+
params['base_path'] = args.base_path
|
65
|
+
params['wildcard'] = True
|
66
|
+
params['project'] = args.project
|
67
|
+
|
58
68
|
parser = PerfXdmParser()
|
59
69
|
for file in args.INPUTS:
|
60
70
|
if args.base_path is not None:
|
@@ -63,12 +73,21 @@ def main():
|
|
63
73
|
file_name = file
|
64
74
|
parser.parse_preference_xdm(file_name, doc)
|
65
75
|
|
76
|
+
parser.add_ecu_extract(doc, params)
|
77
|
+
|
78
|
+
if args.env is not None:
|
79
|
+
for env in args.env:
|
80
|
+
m = re.match(r'(\w+)=([:\/\\\.\w]+)', env)
|
81
|
+
if m:
|
82
|
+
params["env_var:%s" % m.group(1)] = m.group(2)
|
83
|
+
#params['tresos_output_base_dir'] = args.TRESOS_OUTPUT_BASE_DIR
|
84
|
+
|
66
85
|
if format == "file_list":
|
67
86
|
writer = TextPreferenceModelWriter()
|
68
|
-
writer.writer_import_files(args.OUTPUT, doc.getSystemDescriptionImporter(),
|
69
|
-
|
70
|
-
|
71
|
-
|
87
|
+
writer.writer_import_files(args.OUTPUT, doc.getSystemDescriptionImporter(), params)
|
88
|
+
elif format == "ab_project":
|
89
|
+
writer = ABProjectWriter()
|
90
|
+
writer.writer_import_files(args.OUTPUT, doc.getSystemDescriptionImporter(), params)
|
72
91
|
|
73
92
|
except Exception as e:
|
74
93
|
logger.error(e)
|
eb_model/models/abstract.py
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
from abc import ABCMeta
|
2
|
-
from typing import Dict
|
2
|
+
from typing import Dict
|
3
3
|
import re
|
4
4
|
|
5
|
-
|
6
5
|
class EcucObject(metaclass=ABCMeta):
|
7
6
|
def __init__(self, parent, name) -> None:
|
8
7
|
if type(self) == EcucObject:
|
@@ -81,4 +80,60 @@ class EcucRefType:
|
|
81
80
|
m = re.match(r'\/[\w\/]+\/(\w+)', self.value)
|
82
81
|
if m:
|
83
82
|
return m.group(1)
|
84
|
-
return self.value
|
83
|
+
return self.value
|
84
|
+
|
85
|
+
class Version:
|
86
|
+
def __init__(self):
|
87
|
+
self.majorVersion = None
|
88
|
+
self.minorVersion = None
|
89
|
+
self.patchVersion = None
|
90
|
+
|
91
|
+
def getMajorVersion(self):
|
92
|
+
return self.majorVersion
|
93
|
+
|
94
|
+
def setMajorVersion(self, value):
|
95
|
+
if value is not None:
|
96
|
+
self.majorVersion = value
|
97
|
+
return self
|
98
|
+
|
99
|
+
def getMinorVersion(self):
|
100
|
+
return self.minorVersion
|
101
|
+
|
102
|
+
def setMinorVersion(self, value):
|
103
|
+
if value is not None:
|
104
|
+
self.minorVersion = value
|
105
|
+
return self
|
106
|
+
|
107
|
+
def getPatchVersion(self):
|
108
|
+
return self.patchVersion
|
109
|
+
|
110
|
+
def setPatchVersion(self, value):
|
111
|
+
if value is not None:
|
112
|
+
self.patchVersion = value
|
113
|
+
return self
|
114
|
+
|
115
|
+
def getVersion(self) -> str:
|
116
|
+
return "%d.%d.%d" % (self.majorVersion, self.minorVersion, self.patchVersion)
|
117
|
+
|
118
|
+
class Module(EcucContainer):
|
119
|
+
def __init__(self, parent, name):
|
120
|
+
super().__init__(parent, name)
|
121
|
+
|
122
|
+
self.arVersion = Version()
|
123
|
+
self.swVersion = Version()
|
124
|
+
|
125
|
+
def getArVersion(self):
|
126
|
+
return self.arVersion
|
127
|
+
|
128
|
+
def setArVersion(self, value):
|
129
|
+
if value is not None:
|
130
|
+
self.arVersion = value
|
131
|
+
return self
|
132
|
+
|
133
|
+
def getSwVersion(self):
|
134
|
+
return self.swVersion
|
135
|
+
|
136
|
+
def setSwVersion(self, value):
|
137
|
+
if value is not None:
|
138
|
+
self.swVersion = value
|
139
|
+
return self
|
eb_model/models/importer_xdm.py
CHANGED
@@ -1,45 +1,115 @@
|
|
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):
|
21
|
+
self.logger.debug("Add the file <%s>" % value)
|
17
22
|
self.inputFiles.append(value)
|
18
23
|
return self
|
19
24
|
|
20
25
|
def parseWildcard(self, filename: str) -> List[str]:
|
21
|
-
#path: str, file_pattern: str
|
22
26
|
file_list = []
|
23
|
-
for file in glob.iglob(filename):
|
24
|
-
print(file)
|
27
|
+
for file in glob.iglob(filename, recursive=True):
|
25
28
|
file_list.append(file)
|
26
29
|
return file_list
|
27
30
|
|
28
|
-
def getParsedInputFiles(self,
|
31
|
+
def getParsedInputFiles(self, params = {}) -> List[str]:
|
29
32
|
file_list = []
|
30
33
|
for input_file in self.inputFiles:
|
31
|
-
|
32
|
-
|
34
|
+
m = re.match(r'\$\{(env_var:\w+)\}(.*)', input_file)
|
35
|
+
if m and m.group(1) in params:
|
36
|
+
old_input_file = input_file
|
37
|
+
input_file = params[m.group(1)] + m.group(2)
|
38
|
+
self.logger.info("Replace Environment Variable Path: %s => %s" % (old_input_file, os.path.realpath(input_file)))
|
39
|
+
if params['base_path'] is not None:
|
40
|
+
if params['wildcard']:
|
33
41
|
m = re.match(r'(.+)\\(\*\.\w+)', input_file)
|
34
42
|
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))):
|
43
|
+
for file_name in self.parseWildcard(os.path.realpath(os.path.join(params['base_path'], input_file))):
|
38
44
|
file_list.append(file_name)
|
39
45
|
else:
|
40
|
-
file_list.append(os.path.realpath(os.path.join(base_path, input_file)))
|
46
|
+
file_list.append(os.path.realpath(os.path.join(params['base_path'], input_file)))
|
41
47
|
else:
|
42
|
-
file_list.append(os.path.realpath(os.path.join(base_path, input_file)))
|
48
|
+
file_list.append(os.path.realpath(os.path.join(params['base_path'], input_file)))
|
43
49
|
else:
|
44
50
|
file_list.append(input_file)
|
45
|
-
return file_list
|
51
|
+
return file_list
|
52
|
+
|
53
|
+
def getAllPaths(self, path :str) -> List[str]:
|
54
|
+
path_segments = path.split("/")
|
55
|
+
|
56
|
+
result = []
|
57
|
+
long_path = ""
|
58
|
+
for path_segment in path_segments:
|
59
|
+
if path_segment == "..":
|
60
|
+
continue
|
61
|
+
if long_path == "":
|
62
|
+
long_path = path_segment
|
63
|
+
else:
|
64
|
+
long_path = long_path +"/" + path_segment
|
65
|
+
result.append(long_path)
|
66
|
+
return result
|
67
|
+
|
68
|
+
def getNameByPath(self, path : str):
|
69
|
+
path_segments = path.split("/")
|
70
|
+
|
71
|
+
result = []
|
72
|
+
count = 0
|
73
|
+
for path_segment in path_segments:
|
74
|
+
if path_segment == "..":
|
75
|
+
count += 1
|
76
|
+
else:
|
77
|
+
result.append(path_segment)
|
78
|
+
|
79
|
+
return (count , "/".join(result))
|
80
|
+
|
81
|
+
def getLinks(self, file_list: List[str]) -> List[Link]:
|
82
|
+
path_sets = {} # type: Dict[str, List[str]]
|
83
|
+
path_segment_sets = []
|
84
|
+
|
85
|
+
for file in file_list:
|
86
|
+
path, basename = os.path.split(file)
|
87
|
+
path = os.path.relpath(path).replace("\\", "/")
|
88
|
+
if path not in path_sets:
|
89
|
+
path_sets[path] = []
|
90
|
+
|
91
|
+
# To avoid the duplicate file
|
92
|
+
if basename not in path_sets[path]:
|
93
|
+
path_sets[path].append(basename)
|
94
|
+
|
95
|
+
links = []
|
96
|
+
for name in path_sets:
|
97
|
+
for path_segment in self.getAllPaths(name):
|
98
|
+
if path_segment not in path_sets:
|
99
|
+
if path_segment not in path_segment_sets:
|
100
|
+
path_segment_sets.append(path_segment)
|
101
|
+
|
102
|
+
for segment in path_segment_sets:
|
103
|
+
link = Link(segment, 2, "virtual:/virtual")
|
104
|
+
links.append(link)
|
105
|
+
|
106
|
+
for path_set in path_sets:
|
107
|
+
for basename in path_sets[path_set]:
|
108
|
+
path = os.path.relpath(os.path.join(path_set, basename)).replace("\\", "/")
|
109
|
+
count, name = self.getNameByPath(path)
|
110
|
+
link = Link(name, 1, "PARENT-%d-PROJECT_LOC/%s" % (count, name))
|
111
|
+
links.append(link)
|
112
|
+
|
113
|
+
return links
|
114
|
+
|
115
|
+
|
eb_model/models/os_xdm.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
from typing import List
|
2
2
|
|
3
|
-
from ..models.abstract import EcucContainer, EcucObject, EcucRefType
|
4
|
-
|
3
|
+
from ..models.abstract import EcucContainer, EcucObject, EcucRefType, Module
|
5
4
|
|
6
5
|
class OsAlarmAction(EcucContainer):
|
7
6
|
def __init__(self, parent, name) -> None:
|
@@ -933,7 +932,7 @@ class OsScheduleTable(EcucContainer):
|
|
933
932
|
return self
|
934
933
|
|
935
934
|
|
936
|
-
class Os(
|
935
|
+
class Os(Module):
|
937
936
|
def __init__(self, parent) -> None:
|
938
937
|
super().__init__(parent, "Os")
|
939
938
|
|
eb_model/models/rte_xdm.py
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
from typing import Dict, List
|
2
|
-
from .abstract import EcucContainer, EcucRefType
|
3
|
-
|
2
|
+
from ..models.abstract import EcucContainer, EcucRefType, Module
|
4
3
|
class RteEventToIsrMapping(EcucContainer):
|
5
4
|
def __init__(self, parent, name) -> None:
|
6
5
|
super().__init__(parent, name)
|
@@ -35,7 +34,7 @@ class RteEventToTaskMapping(AbstractEventToTaskMapping):
|
|
35
34
|
self.rteServerNumberOfRequestProcessing = None
|
36
35
|
self.rteServerQueueLength = None
|
37
36
|
self.rteEventPredecessorSyncPointRef = None
|
38
|
-
|
37
|
+
|
39
38
|
self.rteEventSuccessorSyncPointRef = None
|
40
39
|
self.rteMappedToTaskRef = None
|
41
40
|
self.rtePeriod = None
|
@@ -100,13 +99,6 @@ class RteEventToTaskMapping(AbstractEventToTaskMapping):
|
|
100
99
|
self.rteEventPredecessorSyncPointRef = value
|
101
100
|
return self
|
102
101
|
|
103
|
-
def getRteEventRef(self) -> EcucRefType:
|
104
|
-
return self.rteEventRef
|
105
|
-
|
106
|
-
def setRteEventRef(self, value: EcucRefType):
|
107
|
-
self.rteEventRef = value
|
108
|
-
return self
|
109
|
-
|
110
102
|
def getRteEventSuccessorSyncPointRef(self):
|
111
103
|
return self.rteEventSuccessorSyncPointRef
|
112
104
|
|
@@ -183,6 +175,38 @@ class RteEventToTaskMapping(AbstractEventToTaskMapping):
|
|
183
175
|
def setRteVirtuallyMappedToTaskRef(self, value):
|
184
176
|
self.rteVirtuallyMappedToTaskRef = value
|
185
177
|
return self
|
178
|
+
|
179
|
+
class RteEventToTaskMappingV3(RteEventToTaskMapping):
|
180
|
+
def __init__(self, parent, name):
|
181
|
+
super().__init__(parent, name)
|
182
|
+
|
183
|
+
self.rteEventRef = None
|
184
|
+
|
185
|
+
def getRteEventRef(self) -> EcucRefType:
|
186
|
+
return self.rteEventRef
|
187
|
+
|
188
|
+
def setRteEventRef(self, value: EcucRefType):
|
189
|
+
self.rteEventRef = value
|
190
|
+
return self
|
191
|
+
|
192
|
+
class RteEventToTaskMappingV4(RteEventToTaskMapping):
|
193
|
+
def __init__(self, parent, name):
|
194
|
+
super().__init__(parent, name)
|
195
|
+
|
196
|
+
self.rteEventRefs = []
|
197
|
+
|
198
|
+
def getRteEventRefs(self):
|
199
|
+
return self.rteEventRefs
|
200
|
+
|
201
|
+
def addRteEventRef(self, value):
|
202
|
+
if value is not None:
|
203
|
+
self.rteEventRefs.append(value)
|
204
|
+
return self
|
205
|
+
|
206
|
+
def getRteEventRef(self):
|
207
|
+
if len(self.rteEventRefs) != 1:
|
208
|
+
raise ValueError("Unsupported RteEventRef of RteEventToTaskMapping <%s> " % self.name)
|
209
|
+
return self.rteEventRefs[0]
|
186
210
|
|
187
211
|
class RteBswEventToTaskMapping(AbstractEventToTaskMapping):
|
188
212
|
def __init__(self, parent, name) -> None:
|
@@ -196,7 +220,7 @@ class RteBswEventToTaskMapping(AbstractEventToTaskMapping):
|
|
196
220
|
self.rteBswServerQueueLength = None
|
197
221
|
self.rteOsSchedulePoint = None
|
198
222
|
self.rteBswEventPredecessorSyncPointRef = None
|
199
|
-
|
223
|
+
|
200
224
|
self.rteBswMappedToTaskRef = None
|
201
225
|
self.rteBswUsedOsAlarmRef = None
|
202
226
|
self.rteBswUsedOsEventRef = None
|
@@ -263,13 +287,6 @@ class RteBswEventToTaskMapping(AbstractEventToTaskMapping):
|
|
263
287
|
self.rteBswEventPredecessorSyncPointRef = value
|
264
288
|
return self
|
265
289
|
|
266
|
-
def getRteBswEventRef(self) -> EcucRefType:
|
267
|
-
return self.rteBswEventRef
|
268
|
-
|
269
|
-
def setRteBswEventRef(self, value: EcucRefType):
|
270
|
-
self.rteBswEventRef = value
|
271
|
-
return self
|
272
|
-
|
273
290
|
def getRteBswMappedToTaskRef(self) -> EcucRefType:
|
274
291
|
return self.rteBswMappedToTaskRef
|
275
292
|
|
@@ -312,6 +329,37 @@ class RteBswEventToTaskMapping(AbstractEventToTaskMapping):
|
|
312
329
|
self.rteRipsFlushRoutineRef = value
|
313
330
|
return self
|
314
331
|
|
332
|
+
class RteBswEventToTaskMappingV3(RteBswEventToTaskMapping):
|
333
|
+
def __init__(self, parent, name):
|
334
|
+
super().__init__(parent, name)
|
335
|
+
|
336
|
+
self.rteBswEventRef = None # type: EcucRefType
|
337
|
+
|
338
|
+
def getRteBswEventRef(self):
|
339
|
+
return self.rteBswEventRef
|
340
|
+
|
341
|
+
def setRteBswEventRef(self, value):
|
342
|
+
if value is not None:
|
343
|
+
self.rteBswEventRef = value
|
344
|
+
return self
|
345
|
+
|
346
|
+
class RteBswEventToTaskMappingV4(RteBswEventToTaskMapping):
|
347
|
+
def __init__(self, parent, name):
|
348
|
+
super().__init__(parent, name)
|
349
|
+
|
350
|
+
self.rteBswEventRefs = [] # type: List[EcucRefType]
|
351
|
+
|
352
|
+
def getRteBswEventRefs(self) -> EcucRefType:
|
353
|
+
return self.rteBswEventRefs
|
354
|
+
|
355
|
+
def addRteBswEventRef(self, value: EcucRefType):
|
356
|
+
self.rteBswEventRefs.append(value)
|
357
|
+
return self
|
358
|
+
|
359
|
+
def getRteBswEventRef(self):
|
360
|
+
if len(self.rteBswEventRefs) != 1:
|
361
|
+
raise ValueError("Unsupported RteEventRef of RteEventToTaskMapping <%s> " % self.name)
|
362
|
+
return self.rteBswEventRefs[0]
|
315
363
|
|
316
364
|
class AbstractRteInstance(EcucContainer):
|
317
365
|
def __init__(self, parent, name) -> None:
|
@@ -503,8 +551,8 @@ class RteBswModuleInstance(AbstractRteInstance):
|
|
503
551
|
def setRteMappedToOsApplicationRef(self, value):
|
504
552
|
self.rteMappedToOsApplicationRef = value
|
505
553
|
return self
|
506
|
-
|
507
|
-
class Rte(
|
554
|
+
|
555
|
+
class Rte(Module):
|
508
556
|
def __init__(self, parent) -> None:
|
509
557
|
super().__init__(parent, "Rte")
|
510
558
|
|
eb_model/parser/eb_parser.py
CHANGED
@@ -6,7 +6,7 @@ from abc import ABCMeta
|
|
6
6
|
from typing import List
|
7
7
|
|
8
8
|
from ..models.eb_doc import EBModel, PreferenceModel
|
9
|
-
from ..models.abstract import EcucRefType
|
9
|
+
from ..models.abstract import EcucRefType, Module
|
10
10
|
|
11
11
|
class AbstractEbModelParser(metaclass = ABCMeta):
|
12
12
|
|
@@ -17,10 +17,23 @@ class AbstractEbModelParser(metaclass = ABCMeta):
|
|
17
17
|
|
18
18
|
if type(self) == "AbstractEBModelParser":
|
19
19
|
raise ValueError("Abstract EBModelParser cannot be initialized.")
|
20
|
-
|
20
|
+
|
21
21
|
def validate_root(self, element: ET.Element):
|
22
22
|
if (element.tag != "{%s}%s" % (self.nsmap[''], "datamodel")):
|
23
23
|
raise ValueError("This document <%s> is not EB xdm format" % element.tag)
|
24
|
+
|
25
|
+
def read_version(self, parent: ET.Element, module: Module):
|
26
|
+
ctr_tag = self.find_ctr_tag(parent, "CommonPublishedInformation")
|
27
|
+
if ctr_tag is not None:
|
28
|
+
ar_version = module.getArVersion()
|
29
|
+
ar_version.setMajorVersion(self.read_value(ctr_tag, "ArMajorVersion"))
|
30
|
+
ar_version.setMinorVersion(self.read_value(ctr_tag, "ArMinorVersion"))
|
31
|
+
ar_version.setPatchVersion(self.read_value(ctr_tag, "ArPatchVersion"))
|
32
|
+
|
33
|
+
sw_version = module.getSwVersion()
|
34
|
+
sw_version.setMajorVersion(self.read_value(ctr_tag, "SwMajorVersion"))
|
35
|
+
sw_version.setMinorVersion(self.read_value(ctr_tag, "SwMinorVersion"))
|
36
|
+
sw_version.setPatchVersion(self.read_value(ctr_tag, "SwPatchVersion"))
|
24
37
|
|
25
38
|
def read_ref_raw_value(self, value):
|
26
39
|
'''
|
@@ -32,7 +45,7 @@ class AbstractEbModelParser(metaclass = ABCMeta):
|
|
32
45
|
return match.group(1)
|
33
46
|
return value
|
34
47
|
|
35
|
-
def _convert_value(self, tag):
|
48
|
+
def _convert_value(self, tag: ET.Element):
|
36
49
|
if 'type' in tag.attrib:
|
37
50
|
if (tag.attrib['type'] == 'INTEGER'):
|
38
51
|
return int(tag.attrib['value'])
|
eb_model/parser/os_xdm_parser.py
CHANGED
@@ -8,12 +8,21 @@ class OsXdmParser(AbstractEbModelParser):
|
|
8
8
|
def __init__(self, ) -> None:
|
9
9
|
super().__init__()
|
10
10
|
|
11
|
+
self.os = None
|
12
|
+
|
11
13
|
def parse(self, element: ET.Element, doc: EBModel):
|
12
14
|
if self.get_component_name(element) != "Os":
|
13
15
|
raise ValueError("Invalid <%s> xdm file" % "Os")
|
14
16
|
|
15
17
|
os = doc.getOs()
|
16
18
|
|
19
|
+
self.read_version(element, os)
|
20
|
+
|
21
|
+
self.logger.info("Parse Rte ARVersion:<%s> SwVersion:<%s>" %
|
22
|
+
(os.getArVersion().getVersion(), os.getSwVersion().getVersion()))
|
23
|
+
|
24
|
+
self.os = os
|
25
|
+
|
17
26
|
self.read_os_tasks(element, os)
|
18
27
|
self.read_os_isrs(element, os)
|
19
28
|
self.read_os_alarms(element, os)
|
@@ -35,7 +44,7 @@ class OsXdmParser(AbstractEbModelParser):
|
|
35
44
|
os_task.setOsTaskPriority(int(self.read_value(ctr_tag, "OsTaskPriority"))) \
|
36
45
|
.setOsTaskActivation(self.read_value(ctr_tag, "OsTaskActivation")) \
|
37
46
|
.setOsTaskSchedule(self.read_value(ctr_tag, "OsTaskSchedule")) \
|
38
|
-
.setOsTaskType(self.
|
47
|
+
.setOsTaskType(self.read_optional_value(ctr_tag, "OsTaskType")) \
|
39
48
|
.setOsStacksize(int(self.read_optional_value(ctr_tag, "OsStacksize", 0)))
|
40
49
|
|
41
50
|
for resource_ref in self.read_ref_value_list(ctr_tag, "OsTaskResourceRef"):
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import xml.etree.ElementTree as ET
|
2
2
|
import logging
|
3
|
+
import os
|
3
4
|
from ..models.eb_doc import PreferenceModel
|
4
5
|
from ..models.importer_xdm import SystemDescriptionImporter
|
5
6
|
from . import AbstractEbModelParser
|
@@ -22,4 +23,14 @@ class PerfXdmParser(AbstractEbModelParser):
|
|
22
23
|
for ctr_tag in self.find_ctr_tag_list(element, "SystemDescriptionImporters"):
|
23
24
|
self.logger.info("Parse SystemDescriptionImporters: <%s>" % ctr_tag.attrib["name"])
|
24
25
|
self.parse_input_files(ctr_tag, importer)
|
25
|
-
#importer.addInputFile()
|
26
|
+
#importer.addInputFile()
|
27
|
+
|
28
|
+
def add_ecu_extract(self, doc: PreferenceModel, params = {'base_path': None, 'wildcard': None, "project": None}):
|
29
|
+
importer = doc.getSystemDescriptionImporter()
|
30
|
+
|
31
|
+
#if params['base_path'] is None:
|
32
|
+
# raise ValueError("Please specify the base path")
|
33
|
+
|
34
|
+
#ecu_extract_path = os.path.join(params['base_path'], '')
|
35
|
+
|
36
|
+
importer.addInputFile('systemmod/EcuExtract.arxml')
|
@@ -1,63 +1,95 @@
|
|
1
1
|
import xml.etree.ElementTree as ET
|
2
2
|
|
3
|
-
from ..models.rte_xdm import Rte, RteBswEventToTaskMapping, RteBswModuleInstance, RteEventToTaskMapping, RteSwComponentInstance
|
3
|
+
from ..models.rte_xdm import Rte, RteBswEventToTaskMapping, RteBswEventToTaskMappingV3, RteBswEventToTaskMappingV4, RteBswModuleInstance, RteEventToTaskMapping, RteEventToTaskMappingV3, RteEventToTaskMappingV4, RteSwComponentInstance
|
4
4
|
from ..models.eb_doc import EBModel
|
5
|
-
from .eb_parser import AbstractEbModelParser
|
5
|
+
from ..parser.eb_parser import AbstractEbModelParser
|
6
6
|
|
7
7
|
class RteXdmParser(AbstractEbModelParser):
|
8
8
|
def __init__(self, ) -> None:
|
9
9
|
super().__init__()
|
10
|
+
self.rte = None
|
10
11
|
|
11
12
|
def parse(self, element: ET.Element, doc: EBModel):
|
12
13
|
if self.get_component_name(element) != "Rte":
|
13
14
|
raise ValueError("Invalid <%s> xdm file" % "Rte")
|
14
15
|
|
15
|
-
|
16
|
-
self.
|
16
|
+
rte = doc.getRte()
|
17
|
+
self.read_version(element, rte)
|
18
|
+
|
19
|
+
self.logger.info("Parse Rte ARVersion:<%s> SwVersion:<%s>" %
|
20
|
+
(rte.getArVersion().getVersion(), rte.getSwVersion().getVersion()))
|
21
|
+
|
22
|
+
self.rte = rte
|
23
|
+
|
24
|
+
self.read_rte_bsw_module_instances(element, rte)
|
25
|
+
self.read_rte_sw_component_instances(element, rte)
|
26
|
+
|
27
|
+
|
17
28
|
|
18
29
|
def read_rte_bsw_module_instance_event_to_task_mappings(self, element: ET.Element, instance: RteBswModuleInstance):
|
19
30
|
for ctr_tag in self.find_ctr_tag_list(element, "RteBswEventToTaskMapping"):
|
20
|
-
|
31
|
+
self.logger.debug("Read RteBswEventToTaskMapping <%s>" % ctr_tag.attrib['name'])
|
32
|
+
|
33
|
+
if self.rte.getArVersion().getMajorVersion() >= 4:
|
34
|
+
mapping = RteBswEventToTaskMappingV4(instance, ctr_tag.attrib['name'])
|
35
|
+
else:
|
36
|
+
mapping = RteBswEventToTaskMappingV3(instance, ctr_tag.attrib['name'])
|
37
|
+
|
21
38
|
mapping.setRteBswActivationOffset(self.read_optional_value(ctr_tag, "RteBswActivationOffset")) \
|
22
39
|
.setRteBswEventPeriod(self.read_optional_value(ctr_tag, "RteBswPeriod")) \
|
23
40
|
.setRteBswPositionInTask(self.read_optional_value(ctr_tag, "RteBswPositionInTask")) \
|
24
|
-
.setRteBswServerQueueLength(self.read_optional_value(ctr_tag, "RteBswServerQueueLength"))
|
25
|
-
|
26
|
-
|
41
|
+
.setRteBswServerQueueLength(self.read_optional_value(ctr_tag, "RteBswServerQueueLength"))
|
42
|
+
|
43
|
+
if isinstance(mapping, RteBswEventToTaskMappingV4):
|
44
|
+
for resource_ref in self.read_ref_value_list(ctr_tag, "RteBswEventRef"):
|
45
|
+
mapping.addRteBswEventRef(resource_ref)
|
46
|
+
elif isinstance(mapping, RteBswEventToTaskMappingV3):
|
47
|
+
mapping.setRteBswEventRef(self.read_ref_value(ctr_tag, "RteBswEventRef"))
|
48
|
+
|
49
|
+
mapping.setRteBswMappedToTaskRef(self.read_optional_ref_value(ctr_tag, "RteBswMappedToTaskRef"))
|
27
50
|
instance.addRteBswEventToTaskMapping(mapping)
|
28
51
|
|
29
52
|
def read_rte_bsw_module_instances(self, element: ET.Element, rte: Rte):
|
30
53
|
for ctr_tag in self.find_ctr_tag_list(element, 'RteBswModuleInstance'):
|
54
|
+
self.logger.debug("Read RteBswModuleInstance <%s>" % ctr_tag.attrib['name'])
|
55
|
+
|
31
56
|
instance = RteBswModuleInstance(rte, ctr_tag.attrib['name'])
|
32
57
|
instance.setRteBswImplementationRef(self.read_ref_value(ctr_tag, "RteBswImplementationRef")) \
|
33
58
|
.setRteMappedToOsApplicationRef(self.read_optional_ref_value(ctr_tag, "RteMappedToOsApplicationRef"))
|
34
59
|
|
35
60
|
self.read_rte_bsw_module_instance_event_to_task_mappings(ctr_tag, instance)
|
36
|
-
|
37
|
-
self.logger.debug("Add the RteBswModuleInstance <%s>" % instance.getName())
|
38
|
-
|
39
61
|
rte.addRteBswModuleInstance(instance)
|
40
62
|
|
41
63
|
def read_rte_sw_component_instance_event_to_task_mappings(self, element: ET.Element, instance: RteSwComponentInstance):
|
42
64
|
for ctr_tag in self.find_ctr_tag_list(element, "RteEventToTaskMapping"):
|
43
|
-
|
65
|
+
|
66
|
+
if self.rte.getArVersion().getMajorVersion() >= 4:
|
67
|
+
mapping = RteEventToTaskMappingV4(instance, ctr_tag.attrib['name'])
|
68
|
+
else:
|
69
|
+
mapping = RteEventToTaskMappingV3(instance, ctr_tag.attrib['name'])
|
70
|
+
|
44
71
|
mapping.setRteActivationOffset(self.read_optional_value(ctr_tag, "RteActivationOffset")) \
|
45
72
|
.setRtePeriod(self.read_optional_value(ctr_tag, "RtePeriod")) \
|
46
73
|
.setRtePositionInTask(self.read_optional_value(ctr_tag, "RtePositionInTask")) \
|
47
|
-
.setRteServerQueueLength(self.read_optional_value(ctr_tag, "RteServerQueueLength"))
|
48
|
-
|
49
|
-
|
74
|
+
.setRteServerQueueLength(self.read_optional_value(ctr_tag, "RteServerQueueLength"))
|
75
|
+
|
76
|
+
if isinstance(mapping, RteEventToTaskMappingV4):
|
77
|
+
for resource_ref in self.read_ref_value_list(ctr_tag, "RteEventRef"):
|
78
|
+
mapping.addRteEventRef(resource_ref)
|
79
|
+
elif isinstance(mapping, RteEventToTaskMappingV3):
|
80
|
+
mapping.setRteEventRef(self.read_ref_value(ctr_tag, "RteEventRef"))
|
81
|
+
|
82
|
+
mapping.setRteMappedToTaskRef(self.read_optional_ref_value(ctr_tag, "RteMappedToTaskRef"))
|
50
83
|
|
51
84
|
instance.addRteEventToTaskMapping(mapping)
|
52
85
|
|
53
86
|
def read_rte_sw_component_instances(self, element: ET.Element, rte: Rte):
|
54
87
|
for ctr_tag in self.find_ctr_tag_list(element, 'RteSwComponentInstance'):
|
88
|
+
self.logger.debug("Read RteSwComponentInstance <%s>" % ctr_tag.attrib['name'])
|
89
|
+
|
55
90
|
instance = RteSwComponentInstance(rte, ctr_tag.attrib['name'])
|
56
91
|
instance.setMappedToOsApplicationRef(self.read_optional_ref_value(ctr_tag, "MappedToOsApplicationRef")) \
|
57
92
|
.setRteSoftwareComponentInstanceRef(self.read_optional_ref_value(ctr_tag, "RteSoftwareComponentInstanceRef"))
|
58
93
|
|
59
94
|
self.read_rte_sw_component_instance_event_to_task_mappings(ctr_tag, instance)
|
60
|
-
|
61
|
-
self.logger.debug("Add the RteSwComponentInstance <%s>" % instance.getName())
|
62
|
-
|
63
95
|
rte.addRteSwComponentInstance(instance)
|
@@ -62,7 +62,7 @@ class RteRunnableEntityXlsWriter(ExcelReporter):
|
|
62
62
|
if isinstance(mapping, RteBswEventToTaskMapping):
|
63
63
|
self.logger.debug("Write Mapping %s" % mapping.getName())
|
64
64
|
instance = mapping.getRteBswModuleInstance()
|
65
|
-
self.write_cell(sheet, row, 2, mapping.
|
65
|
+
self.write_cell(sheet, row, 2, mapping.getRteBswEventRefs().getShortName())
|
66
66
|
self.write_cell(sheet, row, 5, instance.getRteBswImplementationRef().getValue())
|
67
67
|
self.write_cell(sheet, row, 6, mapping.getRteBswPositionInTask())
|
68
68
|
self.write_cell(sheet, row, 7, mapping.getRteBswActivationOffset())
|
@@ -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
|
+
import os
|
6
|
+
|
7
|
+
from ..models.eclipse_project import Link
|
8
|
+
from ..models.importer_xdm import SystemDescriptionImporter
|
9
|
+
|
10
|
+
class EclipseProjectWriter:
|
11
|
+
def __init__(self):
|
12
|
+
self.logger = logging.getLogger()
|
13
|
+
|
14
|
+
def write_element(self, element: ET.Element, key: str, content: str) -> ET.Element:
|
15
|
+
child_element = ET.SubElement(element, key)
|
16
|
+
child_element.text = str(content)
|
17
|
+
|
18
|
+
return child_element
|
19
|
+
|
20
|
+
def write(self, links: List[Link]):
|
21
|
+
pass
|
22
|
+
|
23
|
+
class ABProjectWriter(EclipseProjectWriter):
|
24
|
+
def __init__(self):
|
25
|
+
super().__init__()
|
26
|
+
|
27
|
+
def _write_link(self, element: ET.Element, link: Link):
|
28
|
+
child_element = ET.SubElement(element, "link")
|
29
|
+
self.write_element(child_element, "name", link.name)
|
30
|
+
self.write_element(child_element, "type", link.type)
|
31
|
+
self.write_element(child_element, "locationURI", link.locationURI)
|
32
|
+
|
33
|
+
def _write_links(self, element: ET.Element, links: List[Link]):
|
34
|
+
child_element = ET.SubElement(element, "linkedResources")
|
35
|
+
for link in links:
|
36
|
+
self._write_link(child_element, link)
|
37
|
+
|
38
|
+
self.logger.info("Total <%d> Links are written." % len(links))
|
39
|
+
|
40
|
+
|
41
|
+
def _write_file_head(self, element: ET.Element, project: str):
|
42
|
+
if project is not None:
|
43
|
+
self.write_element(element, "name", project)
|
44
|
+
else:
|
45
|
+
self.write_element(element, "name", "project")
|
46
|
+
|
47
|
+
self.write_element(element, "comment", "")
|
48
|
+
self.write_element(element, "projects", "")
|
49
|
+
self.write_element(element, "buildSpec", "")
|
50
|
+
child_element = ET.SubElement(element, "natures")
|
51
|
+
self.write_element(child_element, "nature", "org.artop.aal.workspace.autosarnature")
|
52
|
+
|
53
|
+
def write(self, filename: str, project: str, links: List[Link]):
|
54
|
+
root = ET.Element("projectDescription")
|
55
|
+
|
56
|
+
self._write_file_head(root, project)
|
57
|
+
self._write_links(root, links)
|
58
|
+
|
59
|
+
xml = ET.tostring(root, encoding = "UTF-8", xml_declaration = True, short_empty_elements = False)
|
60
|
+
|
61
|
+
dom = minidom.parseString(xml.decode())
|
62
|
+
xml = dom.toprettyxml(indent = " ", encoding = "UTF-8")
|
63
|
+
|
64
|
+
with open(filename, "w", encoding="utf-8") as f_out:
|
65
|
+
f_out.write(xml.decode())
|
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,188 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: py-eb-model
|
3
|
+
Version: 1.1.1
|
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.1**
|
182
|
+
|
183
|
+
1. PrefSystemImporter
|
184
|
+
* Add the support to append SystemMod/EcuExtract.arxml into list automatically.
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
@@ -1,32 +1,35 @@
|
|
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=Cra-rVpgxruLLyWHRdYAgbwfcHVPV2L8Jk6ck0v4lJU,3361
|
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=uavSXSfKeM2JvOLmpBh43WlYLQ5fCk_F99tf9YVHDkU,3833
|
8
8
|
eb_model/models/eb_doc.py,sha256=hPsGdNHlm3vl-ys3B3NGrlJRrWAWPhRvFJrN3fLQTW8,2569
|
9
|
-
eb_model/models/
|
10
|
-
eb_model/models/
|
11
|
-
eb_model/models/
|
9
|
+
eb_model/models/eclipse_project.py,sha256=W6ovTd3SMnlmWm_efVBZqTUGQebF0hJocsTqMlQ7_XQ,169
|
10
|
+
eb_model/models/importer_xdm.py,sha256=B2Vqw5nkmzFgaGSpZlmTVFWZ88rTMqD8Iryytg4kUnk,4249
|
11
|
+
eb_model/models/os_xdm.py,sha256=2Y6PJ_IMrXjC6oSK_k3vtZpH8P31GlJhfNv18zbPFQg,32438
|
12
|
+
eb_model/models/rte_xdm.py,sha256=otYbFuIKsFl0Jlqm18fRqroTi1fUEGw2HPhGZb7sAQ0,21060
|
12
13
|
eb_model/parser/__init__.py,sha256=7VOmPr4dng_TrOyDZFu2_s3r0BJZQGiOUxALMY8EnqI,170
|
13
|
-
eb_model/parser/eb_parser.py,sha256=
|
14
|
+
eb_model/parser/eb_parser.py,sha256=_5sUl2pMt1SchHvrLOhU2axqa3FmKTWElSB79taz0O4,8188
|
14
15
|
eb_model/parser/eb_parser_factory.py,sha256=zqsqq52uImU4-WcS5dvHfhM95hiEPAGRtNzVik8i8wc,971
|
15
|
-
eb_model/parser/os_xdm_parser.py,sha256=
|
16
|
-
eb_model/parser/pref_xdm_parser.py,sha256=
|
17
|
-
eb_model/parser/rte_xdm_parser.py,sha256=
|
16
|
+
eb_model/parser/os_xdm_parser.py,sha256=UBN-NZKes_3IX1crTLTDAYOa_wbklRfD9rp5-24WVW4,9909
|
17
|
+
eb_model/parser/pref_xdm_parser.py,sha256=EjfR4vrnjRVLw_7wyPmMYlBj6lPXZbBZMEdWlYPj3uI,1539
|
18
|
+
eb_model/parser/rte_xdm_parser.py,sha256=plUue0c4ejreE9w71_mT0JNzGSClf30cXhfC2NalrII,5471
|
18
19
|
eb_model/reporter/__init__.py,sha256=H8D_23UwJi1Ph6yjBfZhxWVbu9ci5_O4471gqXGiZCM,36
|
19
20
|
eb_model/reporter/markdown.py,sha256=NhcJOFQ_BVbkgGe66uAT7KUPIchWU4kfVMtMLQtbK-w,1647
|
20
21
|
eb_model/reporter/excel_reporter/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
21
22
|
eb_model/reporter/excel_reporter/abstract.py,sha256=PfIoiKNKy1eRJBABln7rADkSdwWzS03Vs03jBYM-_5Y,1622
|
22
23
|
eb_model/reporter/excel_reporter/os_xdm.py,sha256=n1e-tU04s0oh3v31OUKgkIju6BUAtCwb7iGtp2j4Hsc,5578
|
23
|
-
eb_model/reporter/excel_reporter/rte_xdm.py,sha256=
|
24
|
+
eb_model/reporter/excel_reporter/rte_xdm.py,sha256=OHuVPUV7xCdDzxELyXi766YJ6GejTHrzPrlAUBqexIw,3937
|
24
25
|
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=9BQU1CJAktVxFvQk89Pj4IbizTJXnlQidt4eX_CIFXU,2800
|
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.
|
46
|
-
py_eb_model-1.
|
47
|
-
py_eb_model-1.
|
48
|
-
py_eb_model-1.
|
49
|
-
py_eb_model-1.
|
50
|
-
py_eb_model-1.
|
48
|
+
py_eb_model-1.1.1.dist-info/LICENSE,sha256=I52rGS7W1IwAmYCUfqTpDaSHoFAdt7grcNiBhk-Z3eI,1088
|
49
|
+
py_eb_model-1.1.1.dist-info/METADATA,sha256=o3TxYweK34vDd6CJN2ynv3xpTD0PsWNGyNKYco5g9iQ,5869
|
50
|
+
py_eb_model-1.1.1.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
|
51
|
+
py_eb_model-1.1.1.dist-info/entry_points.txt,sha256=yDLH9wnJ5Fp7ImgyFRSnr3mU6nvaenuKZnbe2rgs8Mk,183
|
52
|
+
py_eb_model-1.1.1.dist-info/top_level.txt,sha256=DGBNh6YW_x4RF_UoLKW3cKqb2SLnmfuEIZlkTewR66A,9
|
53
|
+
py_eb_model-1.1.1.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
|