g3projects 0.2.2__tar.gz → 0.2.4__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.
Files changed (38) hide show
  1. {g3projects-0.2.2 → g3projects-0.2.4}/PKG-INFO +1 -1
  2. {g3projects-0.2.2 → g3projects-0.2.4}/pyproject.toml +1 -1
  3. {g3projects-0.2.2 → g3projects-0.2.4}/src/g3projects/main/_main.py +24 -3
  4. {g3projects-0.2.2 → g3projects-0.2.4}/src/g3projects/physical/_physical.py +19 -5
  5. {g3projects-0.2.2 → g3projects-0.2.4}/src/g3projects/physical/templates/config_sfdomain.tpl +1 -1
  6. {g3projects-0.2.2 → g3projects-0.2.4}/src/g3projects.egg-info/PKG-INFO +1 -1
  7. {g3projects-0.2.2 → g3projects-0.2.4}/LICENCE +0 -0
  8. {g3projects-0.2.2 → g3projects-0.2.4}/README.md +0 -0
  9. {g3projects-0.2.2 → g3projects-0.2.4}/setup.cfg +0 -0
  10. {g3projects-0.2.2 → g3projects-0.2.4}/src/g3projects/__init__.py +0 -0
  11. {g3projects-0.2.2 → g3projects-0.2.4}/src/g3projects/logical/__init__.py +0 -0
  12. {g3projects-0.2.2 → g3projects-0.2.4}/src/g3projects/logical/_logical.py +0 -0
  13. {g3projects-0.2.2 → g3projects-0.2.4}/src/g3projects/logical/templates/ansic_prg.tpl +0 -0
  14. {g3projects-0.2.2 → g3projects-0.2.4}/src/g3projects/logical/templates/autogenerated_block.tpl +0 -0
  15. {g3projects-0.2.2 → g3projects-0.2.4}/src/g3projects/logical/templates/config_txt.tpl +0 -0
  16. {g3projects-0.2.2 → g3projects-0.2.4}/src/g3projects/logical/templates/main_c.tpl +0 -0
  17. {g3projects-0.2.2 → g3projects-0.2.4}/src/g3projects/logical/templates/main_c_system.tpl +0 -0
  18. {g3projects-0.2.2 → g3projects-0.2.4}/src/g3projects/logical/templates/package_pkg_logical.tpl +0 -0
  19. {g3projects-0.2.2 → g3projects-0.2.4}/src/g3projects/logical/templates/package_pkg_project.tpl +0 -0
  20. {g3projects-0.2.2 → g3projects-0.2.4}/src/g3projects/logical/templates/package_pkg_system.tpl +0 -0
  21. {g3projects-0.2.2 → g3projects-0.2.4}/src/g3projects/logical/templates/variables_var.tpl +0 -0
  22. {g3projects-0.2.2 → g3projects-0.2.4}/src/g3projects/logical/templates/variables_var_system.tpl +0 -0
  23. {g3projects-0.2.2 → g3projects-0.2.4}/src/g3projects/main/__init__.py +0 -0
  24. {g3projects-0.2.2 → g3projects-0.2.4}/src/g3projects/physical/__init__.py +0 -0
  25. {g3projects-0.2.2 → g3projects-0.2.4}/src/g3projects/physical/templates/config_pkg.tpl +0 -0
  26. {g3projects-0.2.2 → g3projects-0.2.4}/src/g3projects/physical/templates/cpu_pkg.tpl +0 -0
  27. {g3projects-0.2.2 → g3projects-0.2.4}/src/g3projects/physical/templates/hardware_hw.tpl +0 -0
  28. {g3projects-0.2.2 → g3projects-0.2.4}/src/g3projects/physical/templates/iomap_iom.tpl +0 -0
  29. {g3projects-0.2.2 → g3projects-0.2.4}/src/g3projects/physical/templates/physical_pkg.tpl +0 -0
  30. {g3projects-0.2.2 → g3projects-0.2.4}/src/g3projects/physical/templates/zone_sw.tpl +0 -0
  31. {g3projects-0.2.2 → g3projects-0.2.4}/src/g3projects/py.typed +0 -0
  32. {g3projects-0.2.2 → g3projects-0.2.4}/src/g3projects/utils/__init__.py +0 -0
  33. {g3projects-0.2.2 → g3projects-0.2.4}/src/g3projects/utils/_utils.py +0 -0
  34. {g3projects-0.2.2 → g3projects-0.2.4}/src/g3projects.egg-info/SOURCES.txt +0 -0
  35. {g3projects-0.2.2 → g3projects-0.2.4}/src/g3projects.egg-info/dependency_links.txt +0 -0
  36. {g3projects-0.2.2 → g3projects-0.2.4}/src/g3projects.egg-info/entry_points.txt +0 -0
  37. {g3projects-0.2.2 → g3projects-0.2.4}/src/g3projects.egg-info/requires.txt +0 -0
  38. {g3projects-0.2.2 → g3projects-0.2.4}/src/g3projects.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: g3projects
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: System G3 Project PLC files generator
5
5
  Author: Elektroline a.s.
6
6
  Project-URL: Homepage, https://gitlab.elektroline.cz/plc/systemg3-py/SystemG3ProjectBuilder
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "g3projects"
3
- version = "0.2.2"
3
+ version = "0.2.4"
4
4
  description = "System G3 Project PLC files generator"
5
5
  readme = "README.md"
6
6
  license = {file = "LICENSE"}
@@ -46,6 +46,24 @@ def parse_arguments() -> argparse.Namespace:
46
46
  'to the control devices. This option requires --gen-logical.'
47
47
  )
48
48
  )
49
+ parser.add_argument(
50
+ "--ftp1-pswd-hash",
51
+ type=str,
52
+ required=False,
53
+ help="'ftp' user password hash for PLC FTP server",
54
+ )
55
+ parser.add_argument(
56
+ "--ftp2-pswd-hash",
57
+ type=str,
58
+ required=False,
59
+ help="'ellmaster' user password hash for PLC FTP server",
60
+ )
61
+ parser.add_argument(
62
+ "--sfdomain_pswd_hash",
63
+ type=str,
64
+ required=False,
65
+ help="SafeDomain password hash",
66
+ )
49
67
  parser.add_argument(
50
68
  '--log-level',
51
69
  type=str,
@@ -67,12 +85,15 @@ def generate_project_files(
67
85
  system_config_path: str,
68
86
  gen_physical: bool = True,
69
87
  gen_logical: bool = True,
70
- gen_test: bool = False
88
+ gen_test: bool = False,
89
+ ftp1_pswd_hash: str = '',
90
+ ftp2_pswd_hash: str = '',
91
+ sfdomain_pswd_hash: str = ''
71
92
  ) -> None:
72
93
  if gen_logical:
73
94
  generate_logical_files(system_config_path, gen_test)
74
95
  if gen_physical:
75
- generate_physical_files(system_config_path)
96
+ generate_physical_files(system_config_path, ftp1_pswd_hash, ftp2_pswd_hash, sfdomain_pswd_hash)
76
97
 
77
98
 
78
99
  def main() -> None:
@@ -82,5 +103,5 @@ def main() -> None:
82
103
  format='[%(name)s] %(levelname)s:%(message)s'
83
104
  )
84
105
  generate_project_files(
85
- args.system_config, args.gen_physical, args.gen_logical, args.gen_test
106
+ args.system_config, args.gen_physical, args.gen_logical, args.gen_test, args.ftp1_pswd_hash, args.ftp2_pswd_hash, args.sfdomain_pswd_hash
86
107
  )
@@ -118,12 +118,14 @@ def create_hw_isles(config_hw: dict, **kwargs) -> HardwareIsle | None:
118
118
 
119
119
 
120
120
  def generate_hardware_hw_contents(
121
- config_hw: dict, system_name: str, cp1584_name: str
121
+ config_hw: dict, system_name: str, cp1584_name: str, ftp1_pswd_hash: str, ftp2_pswd_hash: str
122
122
  ) -> str:
123
123
  kwargs = {
124
124
  'cpuname': cp1584_name,
125
125
  'cpuhostname': system_name,
126
- 'cpuconfigurationid': system_name
126
+ 'cpuconfigurationid': system_name,
127
+ 'ftpuserpassword1': ftp1_pswd_hash,
128
+ 'ftpuserpassword2': ftp2_pswd_hash
127
129
  }
128
130
  if not (hw_isle := create_hw_isles(config_hw, **kwargs)):
129
131
  return ''
@@ -135,10 +137,22 @@ def generate_hardware_hw_contents(
135
137
 
136
138
  # Iomap.iom #
137
139
 
140
+
138
141
  def generate_iomap_iom_contents(system: SWSystemDictWrapper) -> list[str]:
139
142
  iomap_lines = []
140
143
  for zone, _, device_path, device_data in system.iter_devices_system():
141
144
  if zone == 'Common':
145
+ if 'control' in device_data:
146
+ if 'config' in device_data['control']:
147
+ if 'name' in device_data['control']['config']:
148
+ if 'SystemSafety' in device_data['control']['config']['name']:
149
+ for key, value in device_data['control'].get('iomap', {}).items():
150
+ device_varname = system.get_device_varname(device_data)
151
+ device = f'fb{device_varname}'
152
+ #zone_taskname = device_data['control']['config']['system']
153
+ zone_taskname = "System"
154
+ iomap_line = f'::{zone_taskname}:{device}.{key} AT {value};'
155
+ iomap_lines.append(indent(iomap_line, ' '))
142
156
  continue
143
157
  zone_taskname = system.get_zone_taskname(zone)
144
158
  for key, value in device_data['control'].get('iomap', {}).items():
@@ -163,7 +177,7 @@ def generate_iomap_iom_contents(system: SWSystemDictWrapper) -> list[str]:
163
177
  # END Iomap.iom #
164
178
 
165
179
 
166
- def generate_physical_files(system_config_path: str) -> None:
180
+ def generate_physical_files(system_config_path: str, ftp1_pswd_hash: str, ftp2_pswd_hash: str, sfdomain_pswd_hash: str) -> None:
167
181
  system = get_system_dict(system_config_path)
168
182
  sw_system_wrapper = SWSystemDictWrapper(system['Software'])
169
183
  project_name = sw_system_wrapper.get_project_name()
@@ -188,7 +202,7 @@ def generate_physical_files(system_config_path: str) -> None:
188
202
  'cp1584', system['Hardware'] # type: ignore
189
203
  )
190
204
  hardware_hw = generate_hardware_hw_contents(
191
- system['Hardware'], system_name, cpu_name # type: ignore
205
+ system['Hardware'], system_name, cpu_name, ftp1_pswd_hash, ftp2_pswd_hash # type: ignore
192
206
  )
193
207
  except ValueError:
194
208
  logger.warning(
@@ -237,7 +251,7 @@ def generate_physical_files(system_config_path: str) -> None:
237
251
  write_to_file(
238
252
  mapp_safety_path_dst,
239
253
  'Config.sfdomain',
240
- format_template(env, 'config_sfdomain.tpl', sl8101_name=sl_name)
254
+ format_template(env, 'config_sfdomain.tpl', sl8101_name=sl_name, sfdomainpassword=sfdomain_pswd_hash)
241
255
  )
242
256
  # create IoMap.iom file
243
257
  iomap = generate_iomap_iom_contents(sw_system_wrapper)
@@ -10,7 +10,7 @@
10
10
  <Property ID="SafeLOGICName" Value="{{ sl8101_name }}" />
11
11
  <Property ID="SafeLOGICProductId" Value="X20cSL8101" />
12
12
  <Property ID="SafeLOGICModulePath" Value="IF3.ST32" />
13
- <Property ID="Password" Value="e10adc3949ba59abbe56e057f20f883e" />
13
+ <Property ID="Password" Value="{{ sfdomainpassword }}" />
14
14
  <Property ID="SafeProject" Value="safeZone" />
15
15
  </Group>
16
16
  <Group ID="DefaultFiles">
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: g3projects
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: System G3 Project PLC files generator
5
5
  Author: Elektroline a.s.
6
6
  Project-URL: Homepage, https://gitlab.elektroline.cz/plc/systemg3-py/SystemG3ProjectBuilder
File without changes
File without changes
File without changes