g3projects 0.2.1__tar.gz → 0.2.3__tar.gz
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.
Potentially problematic release.
This version of g3projects might be problematic. Click here for more details.
- {g3projects-0.2.1 → g3projects-0.2.3}/PKG-INFO +1 -1
- {g3projects-0.2.1 → g3projects-0.2.3}/pyproject.toml +1 -1
- {g3projects-0.2.1 → g3projects-0.2.3}/src/g3projects/logical/_logical.py +12 -3
- {g3projects-0.2.1 → g3projects-0.2.3}/src/g3projects/main/_main.py +2 -2
- {g3projects-0.2.1 → g3projects-0.2.3}/src/g3projects/physical/_physical.py +25 -16
- {g3projects-0.2.1 → g3projects-0.2.3}/src/g3projects.egg-info/PKG-INFO +1 -1
- {g3projects-0.2.1 → g3projects-0.2.3}/LICENCE +0 -0
- {g3projects-0.2.1 → g3projects-0.2.3}/README.md +0 -0
- {g3projects-0.2.1 → g3projects-0.2.3}/setup.cfg +0 -0
- {g3projects-0.2.1 → g3projects-0.2.3}/src/g3projects/__init__.py +0 -0
- {g3projects-0.2.1 → g3projects-0.2.3}/src/g3projects/logical/__init__.py +0 -0
- {g3projects-0.2.1 → g3projects-0.2.3}/src/g3projects/logical/templates/ansic_prg.tpl +0 -0
- {g3projects-0.2.1 → g3projects-0.2.3}/src/g3projects/logical/templates/autogenerated_block.tpl +0 -0
- {g3projects-0.2.1 → g3projects-0.2.3}/src/g3projects/logical/templates/config_txt.tpl +0 -0
- {g3projects-0.2.1 → g3projects-0.2.3}/src/g3projects/logical/templates/main_c.tpl +0 -0
- {g3projects-0.2.1 → g3projects-0.2.3}/src/g3projects/logical/templates/main_c_system.tpl +0 -0
- {g3projects-0.2.1 → g3projects-0.2.3}/src/g3projects/logical/templates/package_pkg_logical.tpl +0 -0
- {g3projects-0.2.1 → g3projects-0.2.3}/src/g3projects/logical/templates/package_pkg_project.tpl +0 -0
- {g3projects-0.2.1 → g3projects-0.2.3}/src/g3projects/logical/templates/package_pkg_system.tpl +0 -0
- {g3projects-0.2.1 → g3projects-0.2.3}/src/g3projects/logical/templates/variables_var.tpl +0 -0
- {g3projects-0.2.1 → g3projects-0.2.3}/src/g3projects/logical/templates/variables_var_system.tpl +0 -0
- {g3projects-0.2.1 → g3projects-0.2.3}/src/g3projects/main/__init__.py +0 -0
- {g3projects-0.2.1 → g3projects-0.2.3}/src/g3projects/physical/__init__.py +0 -0
- {g3projects-0.2.1 → g3projects-0.2.3}/src/g3projects/physical/templates/config_pkg.tpl +0 -0
- {g3projects-0.2.1 → g3projects-0.2.3}/src/g3projects/physical/templates/config_sfdomain.tpl +0 -0
- {g3projects-0.2.1 → g3projects-0.2.3}/src/g3projects/physical/templates/cpu_pkg.tpl +0 -0
- {g3projects-0.2.1 → g3projects-0.2.3}/src/g3projects/physical/templates/hardware_hw.tpl +0 -0
- {g3projects-0.2.1 → g3projects-0.2.3}/src/g3projects/physical/templates/iomap_iom.tpl +0 -0
- {g3projects-0.2.1 → g3projects-0.2.3}/src/g3projects/physical/templates/physical_pkg.tpl +0 -0
- {g3projects-0.2.1 → g3projects-0.2.3}/src/g3projects/physical/templates/zone_sw.tpl +0 -0
- {g3projects-0.2.1 → g3projects-0.2.3}/src/g3projects/py.typed +0 -0
- {g3projects-0.2.1 → g3projects-0.2.3}/src/g3projects/utils/__init__.py +0 -0
- {g3projects-0.2.1 → g3projects-0.2.3}/src/g3projects/utils/_utils.py +0 -0
- {g3projects-0.2.1 → g3projects-0.2.3}/src/g3projects.egg-info/SOURCES.txt +0 -0
- {g3projects-0.2.1 → g3projects-0.2.3}/src/g3projects.egg-info/dependency_links.txt +0 -0
- {g3projects-0.2.1 → g3projects-0.2.3}/src/g3projects.egg-info/entry_points.txt +0 -0
- {g3projects-0.2.1 → g3projects-0.2.3}/src/g3projects.egg-info/requires.txt +0 -0
- {g3projects-0.2.1 → g3projects-0.2.3}/src/g3projects.egg-info/top_level.txt +0 -0
|
@@ -45,7 +45,6 @@ def delete_config_keys_with_default_values(
|
|
|
45
45
|
for *_, path, device_data in system_data.iter_devices_system():
|
|
46
46
|
# find devType struct
|
|
47
47
|
if not (dev_type := device_data.get('control', {}).get('devType')):
|
|
48
|
-
print(device_data['general']['name'])
|
|
49
48
|
continue
|
|
50
49
|
struct_path, typ_struct = g3core.find_struct(dev_type)
|
|
51
50
|
try:
|
|
@@ -101,7 +100,11 @@ def get_fb_declaration(
|
|
|
101
100
|
varname = device_data['general']['varname']
|
|
102
101
|
fb_name = SWSystemDictWrapper.get_device_control_fb(device_data)
|
|
103
102
|
elif device_domain == 'test':
|
|
104
|
-
varname = device_data['general']
|
|
103
|
+
varname = device_data['general'].get('varname_test')
|
|
104
|
+
if not varname:
|
|
105
|
+
name = device_data['general']['name']
|
|
106
|
+
logger.warning('Test domain varname is missing for %s', name)
|
|
107
|
+
return ''
|
|
105
108
|
fb_name = SWSystemDictWrapper.get_device_test_fb(device_data)
|
|
106
109
|
else:
|
|
107
110
|
raise ValueError(f'Invalid device domain: {device_domain}')
|
|
@@ -173,6 +176,8 @@ def get_dev_struct_declaration(
|
|
|
173
176
|
dev_struct_type = device_data['control'].get('devType')
|
|
174
177
|
config = device_data['control']['config']
|
|
175
178
|
elif device_domain == 'test':
|
|
179
|
+
if not device_data['general'].get('varname_test'):
|
|
180
|
+
return ''
|
|
176
181
|
varname = device_data['general']['varname_test']
|
|
177
182
|
dev_struct_type = device_data['test'].get('devType')
|
|
178
183
|
config = device_data['test']['config']
|
|
@@ -205,13 +210,15 @@ def get_fb_assignment(
|
|
|
205
210
|
varname = device_data['general']['varname']
|
|
206
211
|
connected_fbs = device_data['control'].get('connector')
|
|
207
212
|
elif device_domain == 'test':
|
|
213
|
+
if not device_data['general'].get('varname_test'):
|
|
214
|
+
return ''
|
|
208
215
|
varname_control = device_data['general']['varname']
|
|
209
216
|
varname = device_data['general']['varname_test']
|
|
210
217
|
connected_fbs = device_data['test'].get('connector')
|
|
211
218
|
else:
|
|
212
219
|
raise ValueError(f'Invalid device domain: {device_domain}')
|
|
213
220
|
if not connected_fbs:
|
|
214
|
-
return
|
|
221
|
+
return ''
|
|
215
222
|
fb_assignment_lines = []
|
|
216
223
|
for conn_name, conn_fb in connected_fbs.items():
|
|
217
224
|
if conn_fb:
|
|
@@ -235,6 +242,8 @@ def get_fb_call(
|
|
|
235
242
|
varname = device_data['general']['varname']
|
|
236
243
|
fb_name = SWSystemDictWrapper.get_device_control_fb(device_data)
|
|
237
244
|
elif device_domain == 'test':
|
|
245
|
+
if not device_data['general'].get('varname_test'):
|
|
246
|
+
return ''
|
|
238
247
|
varname = device_data['general']['varname_test']
|
|
239
248
|
fb_name = SWSystemDictWrapper.get_device_test_fb(device_data)
|
|
240
249
|
else:
|
|
@@ -67,10 +67,10 @@ def generate_project_files(
|
|
|
67
67
|
system_config_path: str,
|
|
68
68
|
gen_physical: bool = True,
|
|
69
69
|
gen_logical: bool = True,
|
|
70
|
-
|
|
70
|
+
gen_test: bool = False
|
|
71
71
|
) -> None:
|
|
72
72
|
if gen_logical:
|
|
73
|
-
generate_logical_files(system_config_path)
|
|
73
|
+
generate_logical_files(system_config_path, gen_test)
|
|
74
74
|
if gen_physical:
|
|
75
75
|
generate_physical_files(system_config_path)
|
|
76
76
|
|
|
@@ -74,7 +74,7 @@ def get_cpu_module_name_default(module_name) -> str:
|
|
|
74
74
|
|
|
75
75
|
# Hardware.hw #
|
|
76
76
|
|
|
77
|
-
def create_hw_isles(config_hw: dict) -> HardwareIsle | None:
|
|
77
|
+
def create_hw_isles(config_hw: dict, **kwargs) -> HardwareIsle | None:
|
|
78
78
|
isles: list[HardwareIsle] = []
|
|
79
79
|
for isle_data in config_hw:
|
|
80
80
|
module_type = isle_data['head']['type']
|
|
@@ -82,7 +82,8 @@ def create_hw_isles(config_hw: dict) -> HardwareIsle | None:
|
|
|
82
82
|
name_suffix = isle_data['head']['name_suffix']
|
|
83
83
|
head = HardwareModule.new(
|
|
84
84
|
type_=module_type,
|
|
85
|
-
name_suffix=f"{cabinet}_{name_suffix}"
|
|
85
|
+
name_suffix=f"{cabinet}_{name_suffix}",
|
|
86
|
+
**kwargs
|
|
86
87
|
)
|
|
87
88
|
tail = []
|
|
88
89
|
for module_data in isle_data['tail']:
|
|
@@ -91,7 +92,8 @@ def create_hw_isles(config_hw: dict) -> HardwareIsle | None:
|
|
|
91
92
|
name_suffix = module_data['name_suffix']
|
|
92
93
|
module = HardwareModule.new(
|
|
93
94
|
type_=module_type,
|
|
94
|
-
name_suffix=f"{cabinet}_{name_suffix}"
|
|
95
|
+
name_suffix=f"{cabinet}_{name_suffix}",
|
|
96
|
+
**kwargs
|
|
95
97
|
)
|
|
96
98
|
tail.append(module)
|
|
97
99
|
isles.append(HardwareIsle(head, *tail))
|
|
@@ -118,30 +120,37 @@ def create_hw_isles(config_hw: dict) -> HardwareIsle | None:
|
|
|
118
120
|
def generate_hardware_hw_contents(
|
|
119
121
|
config_hw: dict, system_name: str, cp1584_name: str
|
|
120
122
|
) -> str:
|
|
121
|
-
|
|
123
|
+
kwargs = {
|
|
124
|
+
'cpuname': cp1584_name,
|
|
125
|
+
'cpuhostname': system_name,
|
|
126
|
+
'cpuconfigurationid': system_name
|
|
127
|
+
}
|
|
128
|
+
if not (hw_isle := create_hw_isles(config_hw, **kwargs)):
|
|
122
129
|
return ''
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
contents_formatted = contents.replace(
|
|
126
|
-
r'{{ cpuname }}', cp1584_name
|
|
127
|
-
)
|
|
128
|
-
contents_formatted = contents_formatted.replace(
|
|
129
|
-
r'{{ cpuhostname }}', f'{system_name}_plc'
|
|
130
|
-
)
|
|
131
|
-
contents_formatted = contents_formatted.replace(
|
|
132
|
-
r'{{ cpuconfigurationid }}', f'cfg_{system_name}'
|
|
133
|
-
)
|
|
134
|
-
return contents_formatted
|
|
130
|
+
return hw_isle.to_str()
|
|
131
|
+
|
|
135
132
|
|
|
136
133
|
# END Hardware.hw #
|
|
137
134
|
|
|
138
135
|
|
|
139
136
|
# Iomap.iom #
|
|
140
137
|
|
|
138
|
+
|
|
141
139
|
def generate_iomap_iom_contents(system: SWSystemDictWrapper) -> list[str]:
|
|
142
140
|
iomap_lines = []
|
|
143
141
|
for zone, _, device_path, device_data in system.iter_devices_system():
|
|
144
142
|
if zone == 'Common':
|
|
143
|
+
if 'control' in device_data:
|
|
144
|
+
if 'config' in device_data['control']:
|
|
145
|
+
if 'name' in device_data['control']['config']:
|
|
146
|
+
if 'SystemSafety' in device_data['control']['config']['name']:
|
|
147
|
+
for key, value in device_data['control'].get('iomap', {}).items():
|
|
148
|
+
device_varname = system.get_device_varname(device_data)
|
|
149
|
+
device = f'fb{device_varname}'
|
|
150
|
+
#zone_taskname = device_data['control']['config']['system']
|
|
151
|
+
zone_taskname = "System"
|
|
152
|
+
iomap_line = f'::{zone_taskname}:{device}.{key} AT {value};'
|
|
153
|
+
iomap_lines.append(indent(iomap_line, ' '))
|
|
145
154
|
continue
|
|
146
155
|
zone_taskname = system.get_zone_taskname(zone)
|
|
147
156
|
for key, value in device_data['control'].get('iomap', {}).items():
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{g3projects-0.2.1 → g3projects-0.2.3}/src/g3projects/logical/templates/autogenerated_block.tpl
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{g3projects-0.2.1 → g3projects-0.2.3}/src/g3projects/logical/templates/package_pkg_logical.tpl
RENAMED
|
File without changes
|
{g3projects-0.2.1 → g3projects-0.2.3}/src/g3projects/logical/templates/package_pkg_project.tpl
RENAMED
|
File without changes
|
{g3projects-0.2.1 → g3projects-0.2.3}/src/g3projects/logical/templates/package_pkg_system.tpl
RENAMED
|
File without changes
|
|
File without changes
|
{g3projects-0.2.1 → g3projects-0.2.3}/src/g3projects/logical/templates/variables_var_system.tpl
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|