odxtools 10.1.1__py3-none-any.whl → 10.2.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.
- odxtools/addrdeffilter.py +33 -0
- odxtools/addrdefphyssegment.py +33 -0
- odxtools/checksum.py +67 -0
- odxtools/checksumresult.py +7 -0
- odxtools/database.py +24 -4
- odxtools/datablock.py +153 -0
- odxtools/datafile.py +23 -0
- odxtools/dataformat.py +39 -0
- odxtools/dataformatselection.py +9 -0
- odxtools/description.py +2 -5
- odxtools/diagdatadictionaryspec.py +1 -3
- odxtools/diaglayers/diaglayer.py +31 -11
- odxtools/diaglayers/ecuvariant.py +12 -19
- odxtools/diaglayers/hierarchyelement.py +5 -5
- odxtools/diaglayers/protocol.py +14 -0
- odxtools/direction.py +7 -0
- odxtools/ecumem.py +71 -0
- odxtools/ecumemconnector.py +136 -0
- odxtools/encryptcompressmethod.py +39 -0
- odxtools/encryptcompressmethodtype.py +13 -0
- odxtools/expectedident.py +40 -0
- odxtools/externflashdata.py +34 -0
- odxtools/filter.py +32 -0
- odxtools/flash.py +88 -0
- odxtools/flashclass.py +32 -0
- odxtools/flashdata.py +70 -0
- odxtools/fwchecksum.py +7 -0
- odxtools/fwsignature.py +7 -0
- odxtools/identdesc.py +54 -0
- odxtools/identvalue.py +32 -0
- odxtools/identvaluetype.py +14 -0
- odxtools/internflashdata.py +33 -0
- odxtools/loadfile.py +1 -1
- odxtools/mem.py +80 -0
- odxtools/modification.py +3 -2
- odxtools/negoffset.py +21 -0
- odxtools/odxlink.py +4 -2
- odxtools/ownident.py +38 -0
- odxtools/physicaltype.py +12 -10
- odxtools/physmem.py +52 -0
- odxtools/physsegment.py +42 -0
- odxtools/posoffset.py +21 -0
- odxtools/security.py +42 -0
- odxtools/securitymethod.py +7 -0
- odxtools/segment.py +63 -0
- odxtools/session.py +88 -0
- odxtools/sessiondesc.py +101 -0
- odxtools/sessionsubelemtype.py +14 -0
- odxtools/sizedeffilter.py +33 -0
- odxtools/sizedefphyssegment.py +33 -0
- odxtools/specialdata.py +2 -1
- odxtools/subcomponentparamconnector.py +1 -1
- odxtools/targetaddroffset.py +13 -0
- odxtools/templates/comparam-spec.odx-c.xml.jinja2 +1 -0
- odxtools/templates/comparam-subset.odx-cs.xml.jinja2 +1 -0
- odxtools/templates/diag_layer_container.odx-d.xml.jinja2 +2 -1
- odxtools/templates/flash.odx-f.xml.jinja2 +42 -0
- odxtools/templates/macros/printAdminData.xml.jinja2 +4 -4
- odxtools/templates/macros/printAudience.xml.jinja2 +3 -3
- odxtools/templates/macros/printChecksum.xml.jinja2 +36 -0
- odxtools/templates/macros/printComparam.xml.jinja2 +1 -1
- odxtools/templates/macros/printComparamRef.xml.jinja2 +1 -3
- odxtools/templates/macros/printCompuMethod.xml.jinja2 +1 -1
- odxtools/templates/macros/printDOP.xml.jinja2 +3 -3
- odxtools/templates/macros/printDatablock.xml.jinja2 +78 -0
- odxtools/templates/macros/printDiagComm.xml.jinja2 +2 -2
- odxtools/templates/macros/printDiagLayer.xml.jinja2 +2 -1
- odxtools/templates/macros/printDiagVariable.xml.jinja2 +4 -4
- odxtools/templates/macros/printDynDefinedSpec.xml.jinja2 +3 -3
- odxtools/templates/macros/printDynamicEndmarkerField.xml.jinja2 +2 -2
- odxtools/templates/macros/printDynamicLengthField.xml.jinja2 +2 -2
- odxtools/templates/macros/printEcuMem.xml.jinja2 +24 -0
- odxtools/templates/macros/printEcuMemConnector.xml.jinja2 +58 -0
- odxtools/templates/macros/printEndOfPdu.xml.jinja2 +1 -1
- odxtools/templates/macros/printEnvDataDesc.xml.jinja2 +1 -1
- odxtools/templates/macros/printExpectedIdent.xml.jinja2 +21 -0
- odxtools/templates/macros/printFlashdata.xml.jinja2 +43 -0
- odxtools/templates/macros/printIdentDesc.xml.jinja2 +17 -0
- odxtools/templates/macros/printMem.xml.jinja2 +35 -0
- odxtools/templates/macros/printMux.xml.jinja2 +3 -3
- odxtools/templates/macros/printOdxCategory.xml.jinja2 +4 -4
- odxtools/templates/macros/printOwnIdent.xml.jinja2 +17 -0
- odxtools/templates/macros/printParam.xml.jinja2 +4 -4
- odxtools/templates/macros/printParentRef.xml.jinja2 +1 -5
- odxtools/templates/macros/printPhysMem.xml.jinja2 +20 -0
- odxtools/templates/macros/printPhysSegment.xml.jinja2 +33 -0
- odxtools/templates/macros/printPreConditionStateRef.xml.jinja2 +1 -1
- odxtools/templates/macros/printProtStack.xml.jinja2 +1 -1
- odxtools/templates/macros/printProtocol.xml.jinja2 +1 -1
- odxtools/templates/macros/printSecurity.xml.jinja2 +37 -0
- odxtools/templates/macros/printSegment.xml.jinja2 +31 -0
- odxtools/templates/macros/printService.xml.jinja2 +3 -3
- odxtools/templates/macros/printSession.xml.jinja2 +45 -0
- odxtools/templates/macros/printSessionDesc.xml.jinja2 +40 -0
- odxtools/templates/macros/printSingleEcuJob.xml.jinja2 +3 -3
- odxtools/templates/macros/printSpecialData.xml.jinja2 +2 -2
- odxtools/templates/macros/printStateTransitionRef.xml.jinja2 +1 -1
- odxtools/templates/macros/printStaticField.xml.jinja2 +1 -1
- odxtools/templates/macros/printSubComponent.xml.jinja2 +3 -3
- odxtools/templates/macros/printTable.xml.jinja2 +6 -6
- odxtools/templates/macros/printUnitSpec.xml.jinja2 +2 -2
- odxtools/text.py +2 -6
- odxtools/utils.py +22 -1
- odxtools/validityfor.py +30 -0
- odxtools/version.py +2 -2
- odxtools/writepdxfile.py +70 -21
- {odxtools-10.1.1.dist-info → odxtools-10.2.1.dist-info}/METADATA +1 -1
- {odxtools-10.1.1.dist-info → odxtools-10.2.1.dist-info}/RECORD +112 -55
- {odxtools-10.1.1.dist-info → odxtools-10.2.1.dist-info}/WHEEL +1 -1
- {odxtools-10.1.1.dist-info → odxtools-10.2.1.dist-info}/entry_points.txt +0 -0
- {odxtools-10.1.1.dist-info → odxtools-10.2.1.dist-info}/licenses/LICENSE +0 -0
- {odxtools-10.1.1.dist-info → odxtools-10.2.1.dist-info}/top_level.txt +0 -0
@@ -25,7 +25,7 @@
|
|
25
25
|
{%- macro printSpecialDataGroup(sdg) %}
|
26
26
|
<SDG {{-make_xml_attrib("SI", sdg.semantic_info)}}>
|
27
27
|
{%- if sdg.sdg_caption_ref %}
|
28
|
-
<SDG-CAPTION-REF
|
28
|
+
<SDG-CAPTION-REF {{make_ref_attribs(sdg.sdg_caption_ref)}} />
|
29
29
|
{%- elif sdg.sdg_caption %}
|
30
30
|
{{- printSdgCaption(sdg.sdg_caption) | indent(1, first=True) }}
|
31
31
|
{%- endif %}
|
@@ -49,4 +49,4 @@
|
|
49
49
|
{%- endfor %}
|
50
50
|
</SDGS>
|
51
51
|
{%- endif %}
|
52
|
-
{%- endmacro %}
|
52
|
+
{#- #}{%- endmacro %}
|
@@ -8,7 +8,7 @@
|
|
8
8
|
{%- macro printStaticField(sf) -%}
|
9
9
|
<STATIC-FIELD {{-peid.printElementIdAttribs(sf)}}>
|
10
10
|
{{ peid.printElementIdSubtags(sf)|indent(1) }}
|
11
|
-
<BASIC-STRUCTURE-REF
|
11
|
+
<BASIC-STRUCTURE-REF {{make_ref_attribs(sf.structure_ref)}} />
|
12
12
|
<FIXED-NUMBER-OF-ITEMS>{{sf.fixed_number_of_items}}</FIXED-NUMBER-OF-ITEMS>
|
13
13
|
<ITEM-BYTE-SIZE>{{sf.item_byte_size}}</ITEM-BYTE-SIZE>
|
14
14
|
</STATIC-FIELD>
|
@@ -40,7 +40,7 @@
|
|
40
40
|
{%- macro printTableRowConnector(conn) %}
|
41
41
|
<TABLE-ROW-CONNECTOR>
|
42
42
|
{{ peid.printElementIdSubtags(conn)|indent(2) }}
|
43
|
-
<TABLE-REF
|
43
|
+
<TABLE-REF {{make_ref_attribs(conn.table_ref)}} />
|
44
44
|
<TABLE-ROW-SNREF {{- make_xml_attrib("SHORT-NAME", conn.table_row_snref ) }} />
|
45
45
|
</TABLE-ROW-CONNECTOR>
|
46
46
|
{%- endmacro %}
|
@@ -48,7 +48,7 @@
|
|
48
48
|
{%- macro printEnvDataConnector(conn) %}
|
49
49
|
<ENV-DATA-CONNECTOR>
|
50
50
|
{{ peid.printElementIdSubtags(conn)|indent(2) }}
|
51
|
-
<ENV-DATA-DESC-REF
|
51
|
+
<ENV-DATA-DESC-REF {{make_ref_attribs(conn.env_data_desc_ref)}} />
|
52
52
|
<ENV-DATA-SNREF {{- make_xml_attrib("SHORT-NAME", conn.env_data_snref ) }} />
|
53
53
|
</ENV-DATA-CONNECTOR>
|
54
54
|
{%- endmacro %}
|
@@ -56,7 +56,7 @@
|
|
56
56
|
{%- macro printDtcConnector(conn) %}
|
57
57
|
<DTC-CONNECTOR>
|
58
58
|
{{ peid.printElementIdSubtags(conn)|indent(2) }}
|
59
|
-
<DTC-DOP-REF
|
59
|
+
<DTC-DOP-REF {{make_ref_attribs(conn.dtc_dop_ref)}} />
|
60
60
|
<DOP-SNREF {{- make_xml_attrib("SHORT-NAME", conn.dtc_snref ) }} />
|
61
61
|
</DTC-CONNECTOR>
|
62
62
|
{%- endmacro %}
|
@@ -16,7 +16,7 @@
|
|
16
16
|
{{-make_xml_attrib("SEMANTIC", table.semantic)}}>
|
17
17
|
{{ peid.printElementIdSubtags(table)|indent(1) }}
|
18
18
|
{%- if table.key_dop_ref %}
|
19
|
-
<KEY-DOP-REF
|
19
|
+
<KEY-DOP-REF {{make_ref_attribs(table.key_dop_ref)}} />
|
20
20
|
{%- endif %}
|
21
21
|
{%- for table_row in table.table_rows_raw %}
|
22
22
|
{%- if hasattr(table_row, "key") %}
|
@@ -25,13 +25,13 @@
|
|
25
25
|
{{-peid.printElementIdSubtags(table_row)}}
|
26
26
|
<KEY>{{table_row.key|e}}</KEY>
|
27
27
|
{%- if table_row.dop_ref is not none %}
|
28
|
-
<DATA-OBJECT-PROP-REF
|
28
|
+
<DATA-OBJECT-PROP-REF {{make_ref_attribs(table_row.dop_ref)}} />
|
29
29
|
{%- endif %}
|
30
30
|
{%- if table_row.dop_snref is not none %}
|
31
31
|
<DATA-OBJECT-PROP-SNREF SHORT-NAME="{{ table_row.dop_snref }}" />
|
32
32
|
{%- endif %}
|
33
33
|
{%- if table_row.structure_ref is not none %}
|
34
|
-
<STRUCTURE-REF
|
34
|
+
<STRUCTURE-REF {{make_ref_attribs(table_row.structure_ref)}} />
|
35
35
|
{%- endif %}
|
36
36
|
{%- if table_row.structure_snref is not none %}
|
37
37
|
<STRUCTURE-SNREF SHORT-NAME="{{ table_row.structure_snref }}" />
|
@@ -43,7 +43,7 @@
|
|
43
43
|
{%- if table_row.functional_class_refs %}
|
44
44
|
<FUNCT-CLASS-REFS>
|
45
45
|
{%- for fc_ref in table_row.functional_class_refs %}
|
46
|
-
<FUNCT-CLASS-REF
|
46
|
+
<FUNCT-CLASS-REF {{make_ref_attribs(fc_ref)}} />
|
47
47
|
{%- endfor %}
|
48
48
|
</FUNCT-CLASS-REFS>
|
49
49
|
{%- endif %}
|
@@ -66,7 +66,7 @@
|
|
66
66
|
{%- endif %}
|
67
67
|
</TABLE-ROW>
|
68
68
|
{%- else %}
|
69
|
-
<TABLE-ROW-REF
|
69
|
+
<TABLE-ROW-REF {{make_ref_attribs(table_row)}} />
|
70
70
|
{%- endif %}
|
71
71
|
{%- endfor %}
|
72
72
|
{%- if table_diag_comm_connectors %}
|
@@ -75,7 +75,7 @@
|
|
75
75
|
<TABLE-DIAG-COMM-CONNECTOR>
|
76
76
|
<SEMANTIC>{{tdcc.semantic}}</SEMANTIC>
|
77
77
|
{%- if tdcc.diag_comm_ref %}
|
78
|
-
<DIAG-COMM-REF
|
78
|
+
<DIAG-COMM-REF {{make_ref_attribs(tdcc.diag_comm_ref)}} />
|
79
79
|
{%- elif tdcc.diag_comm_snref %}
|
80
80
|
<DIAG-COMM-SNREF SHORT-NAME="{{ tdcc.diag_comm_snref }}" />
|
81
81
|
{%- endif %}
|
@@ -49,7 +49,7 @@
|
|
49
49
|
<OFFSET-SI-TO-UNIT>{{ unit.offset_si_to_unit }}</OFFSET-SI-TO-UNIT>
|
50
50
|
{%- endif %}
|
51
51
|
{%- if unit.physical_dimension_ref %}
|
52
|
-
<PHYSICAL-DIMENSION-REF
|
52
|
+
<PHYSICAL-DIMENSION-REF {{make_ref_attribs(unit.physical_dimension_ref)}} />
|
53
53
|
{%- endif %}
|
54
54
|
</UNIT>
|
55
55
|
{%- endmacro -%}
|
@@ -61,7 +61,7 @@
|
|
61
61
|
{%- if group.unit_refs %}
|
62
62
|
<UNIT-REFS>
|
63
63
|
{%- for ref in group.unit_refs %}
|
64
|
-
<UNIT-REF
|
64
|
+
<UNIT-REF {{make_ref_attribs(ref)}} />
|
65
65
|
{%- endfor %}
|
66
66
|
</UNIT-REFS>
|
67
67
|
{%- endif %}
|
odxtools/text.py
CHANGED
@@ -2,6 +2,7 @@ from dataclasses import dataclass
|
|
2
2
|
from xml.etree import ElementTree
|
3
3
|
|
4
4
|
from .odxdoccontext import OdxDocContext
|
5
|
+
from .utils import strip_indent
|
5
6
|
|
6
7
|
|
7
8
|
@dataclass(kw_only=True)
|
@@ -16,12 +17,7 @@ class Text:
|
|
16
17
|
for e in et_element:
|
17
18
|
raw_string += ElementTree.tostring(e, encoding="unicode")
|
18
19
|
|
19
|
-
|
20
|
-
# extracted lines
|
21
|
-
stripped_lines = [x.strip() for x in raw_string.split("\n")]
|
22
|
-
|
23
|
-
text = "\n".join(stripped_lines).strip()
|
24
|
-
|
20
|
+
text = strip_indent(raw_string)
|
25
21
|
text_identifier = et_element.get("TI")
|
26
22
|
|
27
23
|
return Text(text=text, text_identifier=text_identifier)
|
odxtools/utils.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# SPDX-License-Identifier: MIT
|
2
2
|
import dataclasses
|
3
3
|
import re
|
4
|
-
from typing import TYPE_CHECKING, Any, Optional
|
4
|
+
from typing import TYPE_CHECKING, Any, Optional, overload
|
5
5
|
from xml.etree import ElementTree
|
6
6
|
|
7
7
|
from .exceptions import odxraise
|
@@ -12,6 +12,27 @@ if TYPE_CHECKING:
|
|
12
12
|
from .snrefcontext import SnRefContext
|
13
13
|
|
14
14
|
|
15
|
+
@overload
|
16
|
+
def strip_indent(text: str) -> str:
|
17
|
+
...
|
18
|
+
|
19
|
+
|
20
|
+
@overload
|
21
|
+
def strip_indent(text: None) -> None:
|
22
|
+
...
|
23
|
+
|
24
|
+
|
25
|
+
def strip_indent(text: str | None) -> str | None:
|
26
|
+
"""Remove the leading and trailing space characters of all lines of a string.
|
27
|
+
|
28
|
+
Note that non-space whitespace characters (tabulators, etc) are unaffected
|
29
|
+
"""
|
30
|
+
if text is None:
|
31
|
+
return None
|
32
|
+
|
33
|
+
return "\n".join([x.strip(" \r") for x in text.split("\n")])
|
34
|
+
|
35
|
+
|
15
36
|
def read_hex_binary(et_element: ElementTree.Element | None) -> int | None:
|
16
37
|
"""Convert the contents of an xsd:hexBinary to an integer
|
17
38
|
"""
|
odxtools/validityfor.py
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# SPDX-License-Identifier: MIT
|
2
|
+
from dataclasses import dataclass
|
3
|
+
from typing import cast
|
4
|
+
from xml.etree import ElementTree
|
5
|
+
|
6
|
+
from .exceptions import odxraise, odxrequire
|
7
|
+
from .odxdoccontext import OdxDocContext
|
8
|
+
from .sessionsubelemtype import SessionSubElemType
|
9
|
+
|
10
|
+
|
11
|
+
@dataclass(kw_only=True)
|
12
|
+
class ValidityFor:
|
13
|
+
value: str
|
14
|
+
value_type: SessionSubElemType
|
15
|
+
|
16
|
+
@staticmethod
|
17
|
+
def from_et(et_element: ElementTree.Element, context: OdxDocContext) -> "ValidityFor":
|
18
|
+
value = et_element.text or ""
|
19
|
+
|
20
|
+
value_type_str = odxrequire(et_element.get("TYPE"))
|
21
|
+
try:
|
22
|
+
value_type = SessionSubElemType(value_type_str)
|
23
|
+
except ValueError:
|
24
|
+
value_type = cast(SessionSubElemType, None)
|
25
|
+
odxraise(f"Encountered unknown SESSION-SUB-ELEM-TYPE type '{value_type_str}'")
|
26
|
+
|
27
|
+
return ValidityFor(
|
28
|
+
value=value,
|
29
|
+
value_type=value_type,
|
30
|
+
)
|
odxtools/version.py
CHANGED
odxtools/writepdxfile.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# SPDX-License-Identifier: MIT
|
2
2
|
import datetime
|
3
|
+
import html
|
3
4
|
import inspect
|
4
5
|
import mimetypes
|
5
6
|
import os
|
@@ -12,10 +13,9 @@ import jinja2
|
|
12
13
|
import odxtools
|
13
14
|
|
14
15
|
from .database import Database
|
16
|
+
from .odxlink import DocType, OdxDocFragment, OdxLinkRef
|
15
17
|
from .odxtypes import bool_to_odxstr
|
16
18
|
|
17
|
-
odxdatabase: Database | None = None
|
18
|
-
|
19
19
|
|
20
20
|
def jinja2_odxraise_helper(msg: str) -> None:
|
21
21
|
raise Exception(msg)
|
@@ -25,7 +25,7 @@ def make_xml_attrib(attrib_name: str, attrib_val: Any | None) -> str:
|
|
25
25
|
if attrib_val is None:
|
26
26
|
return ""
|
27
27
|
|
28
|
-
return f' {attrib_name}="{attrib_val}"'
|
28
|
+
return f' {attrib_name}="{html.escape(attrib_val)}"'
|
29
29
|
|
30
30
|
|
31
31
|
def make_bool_xml_attrib(attrib_name: str, attrib_val: bool | None) -> str:
|
@@ -35,6 +35,39 @@ def make_bool_xml_attrib(attrib_name: str, attrib_val: bool | None) -> str:
|
|
35
35
|
return make_xml_attrib(attrib_name, bool_to_odxstr(attrib_val))
|
36
36
|
|
37
37
|
|
38
|
+
def set_category_docfrag(jinja_vars: dict[str, Any], category_short_name: str,
|
39
|
+
category_type: str) -> str:
|
40
|
+
jinja_vars["cur_docfrags"] = [OdxDocFragment(category_short_name, DocType(category_type))]
|
41
|
+
|
42
|
+
return ""
|
43
|
+
|
44
|
+
|
45
|
+
def set_layer_docfrag(jinja_vars: dict[str, Any], layer_short_name: str | None) -> str:
|
46
|
+
cur_docfrags = jinja_vars["cur_docfrags"]
|
47
|
+
|
48
|
+
if layer_short_name is None:
|
49
|
+
cur_docfrags = cur_docfrags[:1]
|
50
|
+
return ""
|
51
|
+
|
52
|
+
if len(cur_docfrags) == 1:
|
53
|
+
cur_docfrags.append(OdxDocFragment(layer_short_name, DocType.LAYER))
|
54
|
+
else:
|
55
|
+
cur_docfrags[1] = OdxDocFragment(layer_short_name, DocType.LAYER)
|
56
|
+
|
57
|
+
return ""
|
58
|
+
|
59
|
+
|
60
|
+
def make_ref_attribs(jinja_vars: dict[str, Any], ref: OdxLinkRef) -> str:
|
61
|
+
cur_docfrags = jinja_vars["cur_docfrags"]
|
62
|
+
|
63
|
+
for ref_frag in ref.ref_docs:
|
64
|
+
if ref_frag in cur_docfrags:
|
65
|
+
return f"ID-REF=\"{ref.ref_id}\""
|
66
|
+
|
67
|
+
docfrag = ref.ref_docs[-1]
|
68
|
+
return f"ID-REF=\"{ref.ref_id}\" DOCREF=\"{docfrag.doc_name}\" DOCTYPE=\"{docfrag.doc_type.value}\""
|
69
|
+
|
70
|
+
|
38
71
|
__module_filename = inspect.getsourcefile(odxtools)
|
39
72
|
assert isinstance(__module_filename, str)
|
40
73
|
__templates_dir = os.path.sep.join([os.path.dirname(__module_filename), "templates"])
|
@@ -48,10 +81,6 @@ def write_pdx_file(
|
|
48
81
|
"""
|
49
82
|
Write an internalized database to a PDX file.
|
50
83
|
"""
|
51
|
-
global odxdatabase
|
52
|
-
|
53
|
-
odxdatabase = database
|
54
|
-
|
55
84
|
file_index = []
|
56
85
|
with zipfile.ZipFile(output_file_name, mode="w", compression=zipfile.ZIP_DEFLATED) as zf:
|
57
86
|
|
@@ -128,9 +157,14 @@ def write_pdx_file(
|
|
128
157
|
jinja_env.globals["make_xml_attrib"] = make_xml_attrib
|
129
158
|
jinja_env.globals["make_bool_xml_attrib"] = make_bool_xml_attrib
|
130
159
|
|
131
|
-
|
132
|
-
|
133
|
-
|
160
|
+
jinja_vars: dict[str, Any] = {}
|
161
|
+
jinja_vars["odxtools_version"] = odxtools.__version__
|
162
|
+
jinja_vars["database"] = database
|
163
|
+
|
164
|
+
jinja_env.globals["set_category_docfrag"] = lambda cname, ctype: set_category_docfrag(
|
165
|
+
jinja_vars, cname, ctype)
|
166
|
+
jinja_env.globals["set_layer_docfrag"] = lambda lname: set_layer_docfrag(jinja_vars, lname)
|
167
|
+
jinja_env.globals["make_ref_attribs"] = lambda ref: make_ref_attribs(jinja_vars, ref)
|
134
168
|
|
135
169
|
# write the communication parameter subsets
|
136
170
|
comparam_subset_tpl = jinja_env.get_template("comparam-subset.odx-cs.xml.jinja2")
|
@@ -139,13 +173,13 @@ def write_pdx_file(
|
|
139
173
|
zf_file_cdate = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S")
|
140
174
|
zf_mime_type = "application/x-asam.odx.odx-cs"
|
141
175
|
|
142
|
-
|
176
|
+
jinja_vars["comparam_subset"] = comparam_subset
|
143
177
|
|
144
178
|
file_index.append((zf_file_name, zf_file_cdate, zf_mime_type))
|
145
179
|
|
146
|
-
zf.writestr(zf_file_name, comparam_subset_tpl.render(**
|
180
|
+
zf.writestr(zf_file_name, comparam_subset_tpl.render(**jinja_vars))
|
147
181
|
|
148
|
-
del
|
182
|
+
del jinja_vars["comparam_subset"]
|
149
183
|
|
150
184
|
# write the communication parameter specs
|
151
185
|
comparam_spec_tpl = jinja_env.get_template("comparam-spec.odx-c.xml.jinja2")
|
@@ -154,18 +188,18 @@ def write_pdx_file(
|
|
154
188
|
zf_file_cdate = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S")
|
155
189
|
zf_mime_type = "application/x-asam.odx.odx-c"
|
156
190
|
|
157
|
-
|
191
|
+
jinja_vars["comparam_spec"] = comparam_spec
|
158
192
|
|
159
193
|
file_index.append((zf_file_name, zf_file_cdate, zf_mime_type))
|
160
194
|
|
161
|
-
zf.writestr(zf_file_name, comparam_spec_tpl.render(**
|
195
|
+
zf.writestr(zf_file_name, comparam_spec_tpl.render(**jinja_vars))
|
162
196
|
|
163
|
-
del
|
197
|
+
del jinja_vars["comparam_spec"]
|
164
198
|
|
165
199
|
# write the actual diagnostic data.
|
166
200
|
dlc_tpl = jinja_env.get_template("diag_layer_container.odx-d.xml.jinja2")
|
167
201
|
for dlc in database.diag_layer_containers:
|
168
|
-
|
202
|
+
jinja_vars["dlc"] = dlc
|
169
203
|
|
170
204
|
file_name = f"{dlc.short_name}.odx-d"
|
171
205
|
file_cdate = datetime.datetime.now()
|
@@ -173,13 +207,28 @@ def write_pdx_file(
|
|
173
207
|
mime_type = "application/x-asam.odx.odx-d"
|
174
208
|
|
175
209
|
file_index.append((file_name, creation_date, mime_type))
|
176
|
-
zf.writestr(file_name, dlc_tpl.render(**
|
177
|
-
del
|
210
|
+
zf.writestr(file_name, dlc_tpl.render(**jinja_vars))
|
211
|
+
del jinja_vars["dlc"]
|
212
|
+
|
213
|
+
# write the flash description objects
|
214
|
+
flash_tpl = jinja_env.get_template("flash.odx-f.xml.jinja2")
|
215
|
+
for flash in database.flashs:
|
216
|
+
zf_file_name = f"{flash.short_name}.odx-f"
|
217
|
+
zf_file_cdate = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S")
|
218
|
+
zf_mime_type = "application/x-asam.odx.odx-f"
|
219
|
+
|
220
|
+
jinja_vars["flash"] = flash
|
221
|
+
|
222
|
+
file_index.append((zf_file_name, zf_file_cdate, zf_mime_type))
|
223
|
+
|
224
|
+
zf.writestr(zf_file_name, flash_tpl.render(**jinja_vars))
|
225
|
+
|
226
|
+
del jinja_vars["flash"]
|
178
227
|
|
179
228
|
# write the index.xml file
|
180
|
-
|
229
|
+
jinja_vars["file_index"] = file_index
|
181
230
|
index_tpl = jinja_env.get_template("index.xml.jinja2")
|
182
|
-
text = index_tpl.render(**
|
231
|
+
text = index_tpl.render(**jinja_vars)
|
183
232
|
zf.writestr("index.xml", text)
|
184
233
|
|
185
234
|
return True
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: odxtools
|
3
|
-
Version: 10.
|
3
|
+
Version: 10.2.1
|
4
4
|
Summary: Utilities to work with the ODX standard for automotive diagnostics
|
5
5
|
Author-email: Katrin Bauer <katrin.bauer@mbition.io>, Andreas Lauser <andreas.lauser@mbition.io>, Ayoub Kaanich <kayoub5@live.com>
|
6
6
|
Maintainer-email: Andreas Lauser <andreas.lauser@mbition.io>, Ayoub Kaanich <kayoub5@live.com>
|