py-eb-model 1.0.2__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/__init__.py CHANGED
@@ -1,3 +1,4 @@
1
1
  from .models import *
2
2
  from .parser import *
3
- from .reporter import *
3
+ from .reporter import *
4
+ from .writer import *
@@ -0,0 +1,92 @@
1
+ import argparse
2
+ import pkg_resources
3
+ import logging
4
+ import sys
5
+ import os.path
6
+ import re
7
+
8
+ from ..writer import TextPreferenceModelWriter, ABProjectWriter
9
+ from ..parser import PerfXdmParser
10
+ from ..models import PreferenceModel
11
+
12
+ def main():
13
+ version = pkg_resources.require("py_eb_model")[0].version
14
+
15
+ ap = argparse.ArgumentParser()
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")
22
+ ap.add_argument("INPUTS", nargs='+', help = "The path of perf_imp_xxx.xdm.")
23
+ ap.add_argument("OUTPUT", help = "The path of output file.")
24
+
25
+ args = ap.parse_args()
26
+
27
+ logger = logging.getLogger()
28
+
29
+ formatter = logging.Formatter('[%(levelname)s] : %(message)s')
30
+
31
+ stdout_handler = logging.StreamHandler(sys.stderr)
32
+ stdout_handler.setFormatter(formatter)
33
+
34
+ base_path = os.path.dirname(args.OUTPUT)
35
+ log_file = os.path.join(base_path, 'pref_system_importer.log')
36
+
37
+ if os.path.exists(log_file):
38
+ os.remove(log_file)
39
+
40
+ if args.verbose:
41
+ file_handler = logging.FileHandler(log_file)
42
+ file_handler.setFormatter(formatter)
43
+ file_handler.setLevel(logging.DEBUG)
44
+
45
+ logger.setLevel(logging.DEBUG)
46
+
47
+ if args.verbose:
48
+ stdout_handler.setLevel(logging.DEBUG)
49
+ else:
50
+ stdout_handler.setLevel(logging.INFO)
51
+
52
+ if args.verbose:
53
+ logger.addHandler(file_handler)
54
+ logger.addHandler(stdout_handler)
55
+
56
+ format = "file_list"
57
+ if args.ab_project:
58
+ format = "ab_project"
59
+
60
+ try:
61
+ doc = PreferenceModel.getInstance()
62
+
63
+ parser = PerfXdmParser()
64
+ for file in args.INPUTS:
65
+ if args.base_path is not None:
66
+ file_name = os.path.realpath(os.path.join(args.base_path, file))
67
+ else:
68
+ file_name = file
69
+ parser.parse_preference_xdm(file_name, doc)
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
+
83
+ if format == "file_list":
84
+ writer = TextPreferenceModelWriter()
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)
89
+
90
+ except Exception as e:
91
+ logger.error(e)
92
+ raise e
@@ -2,3 +2,4 @@ from .abstract import *
2
2
  from .os_xdm import *
3
3
  from .rte_xdm import *
4
4
  from .eb_doc import *
5
+ from .importer_xdm import *
@@ -1,8 +1,7 @@
1
1
  from abc import ABCMeta
2
- from typing import Dict, List
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:
eb_model/models/eb_doc.py CHANGED
@@ -1,9 +1,29 @@
1
+ from .importer_xdm import SystemDescriptionImporter
1
2
  from .rte_xdm import Rte
2
3
  from .os_xdm import Os
3
4
  from .abstract import EcucContainer, EcucObject
4
5
 
6
+ class AbstractModel(EcucContainer):
7
+ def getFullName(self):
8
+ return self.name
9
+
10
+ def clear(self):
11
+ self.elements = {}
12
+
13
+ def find_object(self, referred_name:str, element:EcucContainer) -> EcucObject:
14
+ name_list = referred_name.split("/")
15
+ #element = EBModel.getInstance()
16
+ for name in name_list:
17
+ if (name == ""):
18
+ continue
19
+ element = element.getElement(name)
20
+ if (element == None):
21
+ return element
22
+ # raise ValueError("The %s of reference <%s> does not exist." % (short_name, referred_name))
23
+ return element
5
24
 
6
- class EBModel(EcucContainer):
25
+
26
+ class EBModel(AbstractModel):
7
27
  __instance = None
8
28
 
9
29
  @staticmethod
@@ -19,24 +39,9 @@ class EBModel(EcucContainer):
19
39
  EcucContainer.__init__(self, None, "")
20
40
  EBModel.__instance = self
21
41
 
22
- def getFullName(self):
23
- return self.name
24
-
25
- def clear(self):
26
- self.elements = {}
27
-
28
42
  def find(self, referred_name: str) -> EcucObject:
29
- name_list = referred_name.split("/")
30
- element = EBModel.getInstance()
31
- for name in name_list:
32
- if (name == ""):
33
- continue
34
- element = element.getElement(name)
35
- if (element == None):
36
- return element
37
- # raise ValueError("The %s of reference <%s> does not exist." % (short_name, referred_name))
38
- return element
39
-
43
+ return self.find_object(referred_name, EBModel.getInstance())
44
+
40
45
  def getOs(self) -> Os:
41
46
  container = EcucContainer(self, "Os")
42
47
  os = Os(container)
@@ -46,5 +51,28 @@ class EBModel(EcucContainer):
46
51
  container = EcucContainer(self, "Rte")
47
52
  rte = Rte(container)
48
53
  return self.find("/Rte/Rte")
49
-
50
-
54
+
55
+ class PreferenceModel(AbstractModel):
56
+ __instance = None
57
+
58
+ @staticmethod
59
+ def getInstance():
60
+ if (PreferenceModel.__instance == None):
61
+ PreferenceModel()
62
+ return PreferenceModel.__instance
63
+
64
+ def __init__(self):
65
+ if (PreferenceModel.__instance != None):
66
+ raise Exception("The PreferenceModel is singleton!")
67
+
68
+ EcucContainer.__init__(self, None, "")
69
+ PreferenceModel.__instance = self
70
+
71
+ container = EcucContainer(self, "ImporterExporterAdditions")
72
+ SystemDescriptionImporter(container, "SystemDescriptionImporters")
73
+
74
+ def find(self, referred_name: str) -> EcucObject:
75
+ return self.find_object(referred_name, PreferenceModel.getInstance())
76
+
77
+ def getSystemDescriptionImporter(self) -> SystemDescriptionImporter:
78
+ return self.find("/ImporterExporterAdditions/SystemDescriptionImporters")
@@ -0,0 +1,8 @@
1
+
2
+ class Link:
3
+ def __init__(self, name, type, locationURI):
4
+ self.name = name
5
+ self.type = type
6
+ self.locationURI = locationURI
7
+
8
+
@@ -0,0 +1,114 @@
1
+ from typing import Dict, List
2
+
3
+ from ..models.eclipse_project import Link
4
+ from ..models.abstract import EcucObject
5
+ import glob
6
+ import os
7
+ import re
8
+ import logging
9
+
10
+ class SystemDescriptionImporter(EcucObject):
11
+ def __init__(self, parent, name):
12
+ super().__init__(parent, name)
13
+
14
+ self.logger = logging.getLogger()
15
+ self.inputFiles = [] # type: List[str]
16
+
17
+ def getInputFiles(self):
18
+ return self.inputFiles
19
+
20
+ def addInputFile(self, value: str):
21
+ self.inputFiles.append(value)
22
+ return self
23
+
24
+ def parseWildcard(self, filename: str) -> List[str]:
25
+ file_list = []
26
+ for file in glob.iglob(filename, recursive=True):
27
+ file_list.append(file)
28
+ return file_list
29
+
30
+ def getParsedInputFiles(self, params = {}) -> List[str]:
31
+ file_list = []
32
+ for input_file in self.inputFiles:
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']:
40
+ m = re.match(r'(.+)\\(\*\.\w+)', input_file)
41
+ if m:
42
+ for file_name in self.parseWildcard(os.path.realpath(os.path.join(params['base_path'], input_file))):
43
+ file_list.append(file_name)
44
+ else:
45
+ file_list.append(os.path.realpath(os.path.join(params['base_path'], input_file)))
46
+ else:
47
+ file_list.append(os.path.realpath(os.path.join(params['base_path'], input_file)))
48
+ else:
49
+ file_list.append(input_file)
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
+
eb_model/models/os_xdm.py CHANGED
@@ -565,8 +565,14 @@ class OsTaskAutostart(EcucObject):
565
565
  def __init__(self, parent, name) -> None:
566
566
  super().__init__(parent, name)
567
567
 
568
- self.osTaskAppModeRef = None
568
+ self.osTaskAppModeRefs = [] # type: List[EcucRefType]
569
569
 
570
+ def getOsTaskAppModeRefList(self):
571
+ return self.osTaskAppModeRefs
572
+
573
+ def addOsTaskAppModeRef(self, value):
574
+ self.osTaskAppModeRefs.append(value)
575
+ return self
570
576
 
571
577
  class OsTaskResourceLock(EcucObject):
572
578
  def __init__(self, parent, name) -> None:
@@ -602,11 +608,13 @@ class OsTask(EcucObject):
602
608
  self.osTaskPeriod = 0.0 # type: float
603
609
  self.osTaskPriority = None # type: int
604
610
  self.osTaskSchedule = ""
611
+ self.OsTaskType = None # type: str
605
612
  self.osStacksize = 0 # type: int
606
613
  self.osMemoryMappingCodeLocationRef = None # type: EcucRefType
607
614
  self.osTaskAccessingApplication = None
608
615
  self.osTaskEventRef = None # type: EcucRefType
609
616
  self.osTaskResourceRefs = [] # type: List[EcucRefType]
617
+ self.osTaskAutostart = None # type: OsTaskAutostart
610
618
 
611
619
  def getOsTaskActivation(self):
612
620
  return self.osTaskActivation
@@ -635,6 +643,14 @@ class OsTask(EcucObject):
635
643
  def setOsTaskSchedule(self, value):
636
644
  self.osTaskSchedule = value
637
645
  return self
646
+
647
+ def getOsTaskType(self):
648
+ return self.OsTaskType
649
+
650
+ def setOsTaskType(self, value):
651
+ self.OsTaskType = value
652
+ return self
653
+
638
654
 
639
655
  def getOsStacksize(self) -> int:
640
656
  return self.osStacksize
@@ -675,6 +691,14 @@ class OsTask(EcucObject):
675
691
  if self.osTaskSchedule == OsTask.FULL:
676
692
  return True
677
693
  return False
694
+
695
+ def getOsTaskAutostart(self):
696
+ return self.osTaskAutostart
697
+
698
+ def setOsTaskAutostart(self, value):
699
+ self.osTaskAutostart = value
700
+ return self
701
+
678
702
 
679
703
 
680
704
  class OsScheduleTableAutostart(EcucContainer):
@@ -321,7 +321,7 @@ class RteSwComponentInstance(AbstractRteInstance):
321
321
  def __init__(self, parent, name) -> None:
322
322
  super().__init__(parent, name)
323
323
 
324
- self.nappedToOsApplicationRef = None
324
+ self.mappedToOsApplicationRef = None # type: EcucRefType
325
325
  self.rteSoftwareComponentInstanceRef = None
326
326
 
327
327
  self.rteEventToIsrMappings = []
@@ -333,10 +333,10 @@ class RteSwComponentInstance(AbstractRteInstance):
333
333
  self.rteNvRamAllocations = []
334
334
 
335
335
  def getMappedToOsApplicationRef(self):
336
- return self.nappedToOsApplicationRef
336
+ return self.mappedToOsApplicationRef
337
337
 
338
338
  def setMappedToOsApplicationRef(self, value):
339
- self.nappedToOsApplicationRef = value
339
+ self.mappedToOsApplicationRef = value
340
340
  return self
341
341
 
342
342
  def getRteSoftwareComponentInstanceRef(self) -> EcucRefType:
@@ -1,2 +1,4 @@
1
1
  from .os_xdm_parser import OsXdmParser
2
2
  from .rte_xdm_parser import RteXdmParser
3
+ from .eb_parser import AbstractEbModelParser
4
+ from .pref_xdm_parser import PerfXdmParser
@@ -5,7 +5,7 @@ import re
5
5
  from abc import ABCMeta
6
6
  from typing import List
7
7
 
8
- from ..models.eb_doc import EBModel
8
+ from ..models.eb_doc import EBModel, PreferenceModel
9
9
  from ..models.abstract import EcucRefType
10
10
 
11
11
  class AbstractEbModelParser(metaclass = ABCMeta):
@@ -33,17 +33,17 @@ class AbstractEbModelParser(metaclass = ABCMeta):
33
33
  return value
34
34
 
35
35
  def _convert_value(self, tag):
36
- if (tag.attrib['type'] == 'INTEGER'):
37
- return int(tag.attrib['value'])
38
- elif (tag.attrib['type'] == "FLOAT"):
39
- return float(tag.attrib['value'])
40
- elif (tag.attrib['type'] == 'BOOLEAN'):
41
- if (tag.attrib['value'] == 'true'):
42
- return True
43
- else:
44
- return False
45
- else:
46
- return tag.attrib['value']
36
+ if 'type' in tag.attrib:
37
+ if (tag.attrib['type'] == 'INTEGER'):
38
+ return int(tag.attrib['value'])
39
+ elif (tag.attrib['type'] == "FLOAT"):
40
+ return float(tag.attrib['value'])
41
+ elif (tag.attrib['type'] == 'BOOLEAN'):
42
+ if (tag.attrib['value'] == 'true'):
43
+ return True
44
+ else:
45
+ return False
46
+ return tag.attrib['value']
47
47
 
48
48
  def read_value(self, parent: ET.Element, name: str) -> str:
49
49
  tag = parent.find(".//d:var[@name='%s']" % name, self.nsmap)
@@ -165,6 +165,9 @@ class AbstractEbModelParser(metaclass = ABCMeta):
165
165
  def parse(self, element: ET.Element, doc: EBModel):
166
166
  pass
167
167
 
168
+ def parse_preference(self, element: ET.Element, doc: PreferenceModel):
169
+ pass
170
+
168
171
  def load_xdm(self, filename: str) -> ET.Element:
169
172
  self.logger.info("Loading <%s>" % filename)
170
173
 
@@ -177,4 +180,8 @@ class AbstractEbModelParser(metaclass = ABCMeta):
177
180
 
178
181
  def parse_xdm(self, filename: str, doc: EBModel):
179
182
  root_tag = self.load_xdm(filename)
180
- self.parse(root_tag, doc)
183
+ self.parse(root_tag, doc)
184
+
185
+ def parse_preference_xdm(self, filename: str, doc: EBModel):
186
+ root_tag = self.load_xdm(filename)
187
+ self.parse_preference(root_tag, doc)
@@ -1,6 +1,6 @@
1
1
  import xml.etree.ElementTree as ET
2
2
  from ..models.eb_doc import EBModel
3
- from ..models.os_xdm import Os, OsAlarm, OsAlarmActivateTask, OsAlarmCallback, OsAlarmIncrementCounter, OsAlarmSetEvent, OsCounter, OsScheduleTable, OsScheduleTableEventSetting, OsScheduleTableExpiryPoint, OsScheduleTableTaskActivation, OsScheduleTblAdjustableExpPoint
3
+ from ..models.os_xdm import Os, OsAlarm, OsAlarmActivateTask, OsAlarmCallback, OsAlarmIncrementCounter, OsAlarmSetEvent, OsCounter, OsScheduleTable, OsScheduleTableEventSetting, OsScheduleTableExpiryPoint, OsScheduleTableTaskActivation, OsScheduleTblAdjustableExpPoint, OsTaskAutostart
4
4
  from ..models.os_xdm import OsTask, OsIsr, OsApplication
5
5
  from .eb_parser import AbstractEbModelParser
6
6
 
@@ -21,17 +21,28 @@ class OsXdmParser(AbstractEbModelParser):
21
21
  self.read_os_counters(element, os)
22
22
  self.read_os_applications(element, os)
23
23
 
24
+ def read_os_task_autostart(self, element: ET.Element, os_task: OsTask):
25
+ ctr_tag = self.find_ctr_tag(element, "OsTaskAutostart")
26
+ if ctr_tag is not None:
27
+ autostart = OsTaskAutostart(os_task, ctr_tag.attrib["name"])
28
+ for app_mode_ref in self.read_ref_value_list(ctr_tag, "OsTaskAppModeRef"):
29
+ autostart.addOsTaskAppModeRef(app_mode_ref)
30
+ os_task.setOsTaskAutostart(autostart)
31
+
24
32
  def read_os_tasks(self, element: ET.Element, os: Os):
25
33
  for ctr_tag in self.find_ctr_tag_list(element, "OsTask"):
26
34
  os_task = OsTask(os, ctr_tag.attrib["name"])
27
35
  os_task.setOsTaskPriority(int(self.read_value(ctr_tag, "OsTaskPriority"))) \
28
36
  .setOsTaskActivation(self.read_value(ctr_tag, "OsTaskActivation")) \
29
37
  .setOsTaskSchedule(self.read_value(ctr_tag, "OsTaskSchedule")) \
38
+ .setOsTaskType(self.read_value(ctr_tag, "OsTaskType")) \
30
39
  .setOsStacksize(int(self.read_optional_value(ctr_tag, "OsStacksize", 0)))
31
40
 
32
41
  for resource_ref in self.read_ref_value_list(ctr_tag, "OsTaskResourceRef"):
33
42
  os_task.addOsTaskResourceRef(resource_ref)
34
43
 
44
+ self.read_os_task_autostart(ctr_tag, os_task)
45
+
35
46
  self.logger.debug("Read OsTask <%s>" % os_task.getName())
36
47
  os.addOsTask(os_task)
37
48
 
@@ -0,0 +1,25 @@
1
+ import xml.etree.ElementTree as ET
2
+ import logging
3
+ from ..models.eb_doc import PreferenceModel
4
+ from ..models.importer_xdm import SystemDescriptionImporter
5
+ from . import AbstractEbModelParser
6
+
7
+ class PerfXdmParser(AbstractEbModelParser):
8
+ def __init__(self, ) -> None:
9
+ super().__init__()
10
+
11
+ self.logger = logging.getLogger()
12
+
13
+ def parse_input_files(self, element: ET.Element, importer: SystemDescriptionImporter):
14
+ for ctr_tag in self.find_ctr_tag_list(element, "InputFiles"):
15
+ file_name = self.read_value(ctr_tag, "FileName")
16
+ self.logger.debug("Add the file <%s>" % file_name)
17
+ importer.addInputFile(file_name)
18
+
19
+ def parse_preference(self, element: ET.Element, doc: PreferenceModel):
20
+ importer = doc.getSystemDescriptionImporter()
21
+
22
+ for ctr_tag in self.find_ctr_tag_list(element, "SystemDescriptionImporters"):
23
+ self.logger.info("Parse SystemDescriptionImporters: <%s>" % ctr_tag.attrib["name"])
24
+ self.parse_input_files(ctr_tag, importer)
25
+ #importer.addInputFile()
@@ -1,5 +1,5 @@
1
1
  import pytest
2
- from ...models.eb_doc import EBModel
2
+ from ...models.eb_doc import EBModel, PreferenceModel
3
3
 
4
4
  class TestEBModel:
5
5
 
@@ -28,3 +28,16 @@ class TestEBModel:
28
28
  document = EBModel.getInstance()
29
29
  rte = document.getRte()
30
30
  assert (rte.getFullName() == "/Rte/Rte")
31
+
32
+ class TestPreferenceModel:
33
+
34
+ def test_mode_get_system_description_importer(self):
35
+ document = PreferenceModel.getInstance()
36
+ importer = document.getSystemDescriptionImporter()
37
+ assert (importer.getFullName() == "/ImporterExporterAdditions/SystemDescriptionImporters")
38
+
39
+ importer = document.find("/ImporterExporterAdditions/SystemDescriptionImporters")
40
+ assert (importer.getFullName() == "/ImporterExporterAdditions/SystemDescriptionImporters")
41
+
42
+ importer = document.getSystemDescriptionImporter()
43
+ assert (importer.getFullName() == "/ImporterExporterAdditions/SystemDescriptionImporters")
@@ -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")
@@ -0,0 +1,2 @@
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)
@@ -0,0 +1,28 @@
1
+ import logging
2
+ from typing import List
3
+
4
+ from ..models.eb_doc import SystemDescriptionImporter
5
+
6
+ class TextWriter:
7
+ def __init__(self):
8
+ self.logger = logging.getLogger()
9
+
10
+ def write(self, filename: str, lines: List[str]):
11
+ with open(filename, "w") as f_out:
12
+ for line in lines:
13
+ f_out.write("%s\n" % line)
14
+
15
+ class TextPreferenceModelWriter(TextWriter):
16
+ def __init__(self):
17
+ super().__init__()
18
+
19
+ def writer_import_files(self, filename: str, importer: SystemDescriptionImporter, params = {'base_path': None, 'wildcard': None, "tresos_output_base_dir": None}):
20
+ self.logger.info("Generate import files list <%s>" % filename)
21
+ lines = []
22
+ for file in sorted(importer.getParsedInputFiles(params)):
23
+ if file in lines:
24
+ self.logger.warning("file <%s> is duplicated." % file)
25
+ else:
26
+ lines.append(file)
27
+
28
+ self.write(filename, lines)
@@ -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
+ ![](doc/os-xdm-xlsx/os_isr_in_excel.png)
50
+
51
+ 1. OsTasks
52
+
53
+ ![](doc/os-xdm-xlsx/os_task_in_excel.png)
54
+
55
+ 3. OsScheduleTable
56
+
57
+ ![](doc/os-xdm-xlsx/os_schedule_table_in_excel.png)
58
+
59
+ 4. OsCounter
60
+
61
+ ![](doc/os-xdm-xlsx/os_counter_in_excel.png)
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,16 +1,20 @@
1
- eb_model/__init__.py,sha256=u3VUin2V_1eExLd9NIpw_LGHIAwaG2vEoyhssZurrvM,69
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=M46tHz97GTTud0dCtOhFVZ04B3yzThBmix7OSg00K_c,3315
4
5
  eb_model/cli/rte_xdm_2_xls_cli.py,sha256=83uzE2Vk0h267gWxF9mnWN3Bh69RJpYyKULFXpxTByY,2127
5
- eb_model/models/__init__.py,sha256=TH1OtmIdLdd_sLh9o4rczuRDL68OXxdKjDVuxj4Lfsw,95
6
- eb_model/models/abstract.py,sha256=4jy328yy2sedIHNwfxjzW3CnVsnTCoskatT8JXjv-rE,2402
7
- eb_model/models/eb_doc.py,sha256=wWMHdLYpyvmEVlgNLzFLvC8C_uGnlPP4xnx_DlkslY4,1417
8
- eb_model/models/os_xdm.py,sha256=Wk_B3yBvXwZpxwKyTKJBIBhr4ovpiglGCq2XEmYX6gs,31678
9
- eb_model/models/rte_xdm.py,sha256=3fygp2zmvVL9enWqvrERAp5sexNowbsscCKZbIdZiKU,19372
10
- eb_model/parser/__init__.py,sha256=aQxwzw9OSziRSoZERED_vDxUUGU5GG0yhwMn14ugACw,82
11
- eb_model/parser/eb_parser.py,sha256=H5NTDdM0DaGiHsZ6VjaA1pKla5mDePmTDp1jjbeFAbE,7057
6
+ eb_model/models/__init__.py,sha256=7_WxCwRdVavLbPzepHWNar3O-rOxhLwmVYWd2pqm2kI,124
7
+ eb_model/models/abstract.py,sha256=9Bvz75pwvSv1Txt68t-01zErY78aWrlis390Mzmfvvw,2394
8
+ eb_model/models/eb_doc.py,sha256=hPsGdNHlm3vl-ys3B3NGrlJRrWAWPhRvFJrN3fLQTW8,2569
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
11
+ eb_model/models/os_xdm.py,sha256=HrAhFiPkbkE_YBihG2S5lQTTU9IQla7O15E8guKLDXg,32439
12
+ eb_model/models/rte_xdm.py,sha256=73hBsQ7pUePA9ewFI2d50iImI_FA-jzFQFlnp0K6WTs,19407
13
+ eb_model/parser/__init__.py,sha256=7VOmPr4dng_TrOyDZFu2_s3r0BJZQGiOUxALMY8EnqI,170
14
+ eb_model/parser/eb_parser.py,sha256=XAJZ_agd54C5R4UAAlHfwaVWYFQRSXuTjM_ijcpVU4E,7375
12
15
  eb_model/parser/eb_parser_factory.py,sha256=zqsqq52uImU4-WcS5dvHfhM95hiEPAGRtNzVik8i8wc,971
13
- eb_model/parser/os_xdm_parser.py,sha256=5qF8LouRHjA95YjpXtJwa7s2Vm1eIwvp49FMwc4oacs,9032
16
+ eb_model/parser/os_xdm_parser.py,sha256=xnA1C91Jpd2MGFvdV4Xu03vZLh6IgsUCarEVRmh8_mQ,9635
17
+ eb_model/parser/pref_xdm_parser.py,sha256=khzgD_igMauH7H3OXdFmFc-HspLq8U51wC6CAs6jJHc,1097
14
18
  eb_model/parser/rte_xdm_parser.py,sha256=ywAJiBTgI2WifB-rSdoh6PWvRZ4hSSdy4hmdilSTfU0,4027
15
19
  eb_model/reporter/__init__.py,sha256=H8D_23UwJi1Ph6yjBfZhxWVbu9ci5_O4471gqXGiZCM,36
16
20
  eb_model/reporter/markdown.py,sha256=NhcJOFQ_BVbkgGe66uAT7KUPIchWU4kfVMtMLQtbK-w,1647
@@ -20,8 +24,12 @@ eb_model/reporter/excel_reporter/os_xdm.py,sha256=n1e-tU04s0oh3v31OUKgkIju6BUAtC
20
24
  eb_model/reporter/excel_reporter/rte_xdm.py,sha256=JweusBQJSg1_jaFbQV3sJnVMALMj3VuEkVf15Pw-Ir4,3936
21
25
  eb_model/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
26
  eb_model/tests/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
- eb_model/tests/models/test_eb_model.py,sha256=Xk7RAS4m038IhZ0Y1TQqVoJ-dWgJVIfXVJilWvVzXCw,962
27
+ eb_model/tests/models/test_eb_model.py,sha256=3fpIHhzQlf9KZjm4fZxcSTT4Zio6YhTrcn9UBvlhOfo,1632
24
28
  eb_model/tests/models/test_ecuc_container.py,sha256=lZmtXwPMz9T52WFduTgFy16fO2agjSW-Rl2cVypM86s,722
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
25
33
  py_eb_model/__init__.py,sha256=u3VUin2V_1eExLd9NIpw_LGHIAwaG2vEoyhssZurrvM,69
26
34
  py_eb_model/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
27
35
  py_eb_model/cli/os_xdm_2_xls_cli.py,sha256=BzeFhyWHbG57qieDNESaXYggszHSy17uwCeXvEfrbCQ,1629
@@ -37,9 +45,9 @@ py_eb_model/reporter/markdown.py,sha256=NhcJOFQ_BVbkgGe66uAT7KUPIchWU4kfVMtMLQtb
37
45
  py_eb_model/reporter/excel_reporter/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
46
  py_eb_model/reporter/excel_reporter/abstract.py,sha256=BOuLhWwwTwqBzErtmwPrelB1iByMfZP9haFmg9ayFQw,1488
39
47
  py_eb_model/reporter/excel_reporter/os_xdm.py,sha256=WGMxK0PYxi9J5fUZ-EeiiM8NBpIg2WyxRsrN-gK37YE,1589
40
- py_eb_model-1.0.2.dist-info/LICENSE,sha256=I52rGS7W1IwAmYCUfqTpDaSHoFAdt7grcNiBhk-Z3eI,1088
41
- py_eb_model-1.0.2.dist-info/METADATA,sha256=Fzh5KTLcGdBnJALQrNXQKEiw0Qv-iTlCLcw0Zz6u7NM,2460
42
- py_eb_model-1.0.2.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
43
- py_eb_model-1.0.2.dist-info/entry_points.txt,sha256=vC-sGaF_j37QgkuYsJooGZBN1jnHYWQC4jehliu37fY,119
44
- py_eb_model-1.0.2.dist-info/top_level.txt,sha256=DGBNh6YW_x4RF_UoLKW3cKqb2SLnmfuEIZlkTewR66A,9
45
- py_eb_model-1.0.2.dist-info/RECORD,,
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,4 +1,5 @@
1
1
  [console_scripts]
2
+ PrefSystemImporter = eb_model.cli.pref_system_importer_cli:main
2
3
  os-xdm-xlsx = eb_model.cli.os_xdm_2_xls_cli:main
3
4
  rte-xdm-xlsx = eb_model.cli.rte_xdm_2_xls_cli:main
4
5
 
@@ -1,97 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: py-eb-model
3
- Version: 1.0.2
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
- ![](doc/os-xdm-xlsx/os_isr_in_excel.png)
50
-
51
- 1. OsTasks
52
-
53
- ![](doc/os-xdm-xlsx/os_task_in_excel.png)
54
-
55
- 3. OsScheduleTable
56
-
57
- ![](doc/os-xdm-xlsx/os_schedule_table_in_excel.png)
58
-
59
- 4. OsCounter
60
-
61
- ![](doc/os-xdm-xlsx/os_counter_in_excel.png)
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
-
80
- # 4. Change History
81
-
82
- **Version 0.8.0**
83
-
84
- 1. Create the basic model for EB xdm. (Issue #1)
85
- 2. Support to extract the Os Tasks/Isrs from EB xdm and store them in the excel files. (Issue #1)
86
-
87
- **Version 1.0.1**
88
-
89
- 1. Change the attribute to start with lowercase
90
- 2. *read_ref_value* and *read_optional_ref_value* method returns EcucRefType.
91
- 3. Read the OsScheduleTable and export to excel
92
- 4. Read the OsCounter and export to excel
93
-
94
- **Version 1.0.2**
95
-
96
- 1. Fix the setOsAlarmCallbackName bug
97
-