ScriptCollection 4.0.59__py3-none-any.whl → 4.0.62__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.

Potentially problematic release.


This version of ScriptCollection might be problematic. Click here for more details.

@@ -36,7 +36,7 @@ from .ProgramRunnerBase import ProgramRunnerBase
36
36
  from .ProgramRunnerPopen import ProgramRunnerPopen
37
37
  from .SCLog import SCLog, LogLevel
38
38
 
39
- version = "4.0.59"
39
+ version = "4.0.62"
40
40
  __version__ = version
41
41
 
42
42
 
@@ -83,6 +83,7 @@ class TFCPS_MergeToStable:
83
83
 
84
84
 
85
85
  self.sc.log.log("Release artifacts...")
86
+ repository:str=self.createRelease_configuration.repository
86
87
  project_version:str=self.tFCPS_Tools_General.get_version_of_project(repository)
87
88
  for codeunit in self.tFCPS_Tools_General.get_codeunits(self.createRelease_configuration.repository):
88
89
  self.sc.git_checkout(self.createRelease_configuration.repository, self.createRelease_configuration.source_branch, True,True)
@@ -107,7 +108,6 @@ class TFCPS_MergeToStable:
107
108
  # update codeunit-reference
108
109
  self.sc.log.log(f"Release artifacts of codeunit {codeunit}...")
109
110
  reference_folder:str=os.path.join(reference_repo,"ReferenceContent")
110
- repository:str=self.createRelease_configuration.repository
111
111
  projectname:str=os.path.basename(repository)
112
112
  public_repository_url:str=self.createRelease_configuration.common_remote_url
113
113
  main_branch_name:str=self.createRelease_configuration.source_branch
@@ -791,7 +791,7 @@ class TFCPS_Tools_General:
791
791
  @GeneralUtilities.check_arguments
792
792
  def do_npm_install(self, package_json_folder: str, npm_force: bool,use_cache:bool) -> None:
793
793
  target_folder:str=os.path.join(package_json_folder,"node_modules")
794
- update:bool=not os.path.isdir(target_folder) or GeneralUtilities.folder_is_empty(target_folder) or not use_cache
794
+ update:bool=not os.path.isdir(target_folder) or GeneralUtilities.folder_is_empty(target_folder) or not use_cache
795
795
  if update:
796
796
  self.__sc.log.log("Do npm-install...")
797
797
  argument1 = "install"
@@ -1263,6 +1263,10 @@ class TFCPS_Tools_General:
1263
1263
  docker_project_name = f"{codeunit_name}_{example_name}".lower()
1264
1264
  self.__sc.log.log("Stop docker-container...")
1265
1265
  self.__sc.run_program("docker", f"compose --project-name {docker_project_name} down", folder)
1266
+ if remove_old_container:
1267
+ pass#TODO
1268
+ if remove_volumes_folder:
1269
+ pass#TODO
1266
1270
 
1267
1271
  @GeneralUtilities.check_arguments
1268
1272
  def update_submodule(self, repository_folder: str, submodule_name: str, local_branch: str = "main", remote_branch: str = "main", remote: str = "origin"):
@@ -1280,3 +1284,60 @@ class TFCPS_Tools_General:
1280
1284
 
1281
1285
  - Updated geo-ip-database.
1282
1286
  """)
1287
+
1288
+ def set_latest_version_for_clone_repository_as_resource(self,repository_folder:str, resourcename: str, github_link: str, branch: str = "main"):
1289
+
1290
+ resrepo_commit_id_folder: str = os.path.join(repository_folder, "Other", "Resources", f"{resourcename}Version")
1291
+ resrepo_commit_id_file: str = os.path.join(resrepo_commit_id_folder, f"{resourcename}Version.txt")
1292
+ current_version: str = GeneralUtilities.read_text_from_file(resrepo_commit_id_file)
1293
+
1294
+ stdOut = [l.split("\t") for l in GeneralUtilities.string_to_lines(self.__sc.run_program("git", f"ls-remote {github_link}")[1])]
1295
+ stdOut = [l for l in stdOut if l[1] == f"refs/heads/{branch}"]
1296
+ GeneralUtilities.assert_condition(len(stdOut) == 1)
1297
+ latest_version: str = stdOut[0][0]
1298
+ if current_version != latest_version:
1299
+ GeneralUtilities.write_text_to_file(resrepo_commit_id_file, latest_version)
1300
+
1301
+ @GeneralUtilities.check_arguments
1302
+ def get_dependencies_which_are_ignored_from_updates(self, codeunit_folder: str, print_warnings_for_ignored_dependencies: bool) -> list[str]:
1303
+ self.assert_is_codeunit_folder(codeunit_folder)
1304
+ namespaces = {'cps': 'https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/tree/main/Conventions/RepositoryStructure/CommonProjectStructure', 'xsi': 'http://www.w3.org/2001/XMLSchema-instance'}
1305
+ codeunit_name = os.path.basename(codeunit_folder)
1306
+ codeunit_file = os.path.join(codeunit_folder, f"{codeunit_name}.codeunit.xml")
1307
+ root: etree._ElementTree = etree.parse(codeunit_file)
1308
+ ignoreddependencies = root.xpath('//cps:codeunit/cps:properties/cps:updatesettings/cps:ignoreddependencies/cps:ignoreddependency', namespaces=namespaces)
1309
+ result = [x.text.replace("\\n", GeneralUtilities.empty_string).replace("\\r", GeneralUtilities.empty_string).replace("\n", GeneralUtilities.empty_string).replace("\r", GeneralUtilities.empty_string).strip() for x in ignoreddependencies]
1310
+ if print_warnings_for_ignored_dependencies and len(result) > 0:
1311
+ self.__sc.log.log(f"Codeunit {codeunit_name} contains the following dependencies which will are ignoed for automatic updates: "+', '.join(result), LogLevel.Warning)
1312
+ return result
1313
+
1314
+ @GeneralUtilities.check_arguments
1315
+ def update_dependencies_of_package_json(self, folder_of_package_json: str) -> None:
1316
+ #TODO move this to TFCPS_CodeUnitSpecific_NodeJS_Functions
1317
+ if self.is_codeunit_folder(folder_of_package_json):
1318
+ ignored_dependencies = self.get_dependencies_which_are_ignored_from_updates(folder_of_package_json, True)
1319
+ else:
1320
+ ignored_dependencies = []
1321
+ # TODO consider ignored_dependencies
1322
+ result = self.__sc.run_with_epew("npm", "outdated", folder_of_package_json, throw_exception_if_exitcode_is_not_zero=False)
1323
+ if result[0] == 0:
1324
+ return # all dependencies up to date
1325
+ elif result[0] == 1:
1326
+ package_json_content = None
1327
+ package_json_file = f"{folder_of_package_json}/package.json"
1328
+ with open(package_json_file, "r", encoding="utf-8") as package_json_file_object:
1329
+ package_json_content = json.load(package_json_file_object)
1330
+ lines = GeneralUtilities.string_to_lines(result[1])[1:][:-1]
1331
+ for line in lines:
1332
+ normalized_line_splitted = ' '.join(line.split()).split(" ")
1333
+ package = normalized_line_splitted[0]
1334
+ latest_version = normalized_line_splitted[3]
1335
+ if package in package_json_content["dependencies"]:
1336
+ package_json_content["dependencies"][package] = latest_version
1337
+ if package in package_json_content["devDependencies"]:
1338
+ package_json_content["devDependencies"][package] = latest_version
1339
+ with open(package_json_file, "w", encoding="utf-8") as package_json_file_object:
1340
+ json.dump(package_json_content, package_json_file_object, indent=4)
1341
+ self.do_npm_install(folder_of_package_json, True,True)#TODO use_cache might be dangerous here
1342
+ else:
1343
+ self.__sc.log.log("Update dependencies resulted in an error.", LogLevel.Error)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ScriptCollection
3
- Version: 4.0.59
3
+ Version: 4.0.62
4
4
  Summary: The ScriptCollection is the place for reusable scripts.
5
5
  Home-page: https://github.com/anionDev/ScriptCollection
6
6
  Author: Marius Göcke
@@ -9,7 +9,7 @@ ScriptCollection/ProgramRunnerMock.py,sha256=uTu-aFle1W_oKjeQEmuPsFPQpvo0kRf2FrR
9
9
  ScriptCollection/ProgramRunnerPopen.py,sha256=BPY7-ZMIlqT7JOKz8qlB5c0laF2Js-ijzqk09GxZC48,3821
10
10
  ScriptCollection/ProgramRunnerSudo.py,sha256=_khC3xuTdrPoLluBJZWfldltmmuKltABJPcbjZSFW-4,4835
11
11
  ScriptCollection/SCLog.py,sha256=dxGOI4E9lG5v9jk_LajXCkM5nghliCDV8YB8Ihn160s,4541
12
- ScriptCollection/ScriptCollectionCore.py,sha256=mtg72npynGXVQ1c_LGrV_4x73_O-axIjk914aPughy4,142342
12
+ ScriptCollection/ScriptCollectionCore.py,sha256=SXPOaedIr6JKt7OA23JpWJU5HDlYUD77Z83ZQt7d58w,142342
13
13
  ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  ScriptCollection/TFCPS/TFCPS_CodeUnitSpecific_Base.py,sha256=VyoVQPQ5t3VmRsR599tzsjRlnL42Hj3kubMmeoTQW7A,25441
15
15
  ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnit.py,sha256=m3bZZCoKV0mxME6HtDa3BAsGD4DSbiSp4XkqKOJyc9Y,7369
@@ -17,10 +17,10 @@ ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py,sha256=f9oGnopuzn3iDHC1A
17
17
  ScriptCollection/TFCPS/TFCPS_CreateRelease.py,sha256=bcJlfI062Eoq7MOIhun-_iNG7SdO1ZIuC_cylaoLI1s,6332
18
18
  ScriptCollection/TFCPS/TFCPS_Generic.py,sha256=O-0guM_LJCcZmPZJhMgTvXD2RXUJEBWWv6Bt6hDFhvM,1943
19
19
  ScriptCollection/TFCPS/TFCPS_MergeToMain.py,sha256=7F9cwFy-7bxN5mkK9V_n7ffMPvBxLwzQvrAe60fbEMM,7245
20
- ScriptCollection/TFCPS/TFCPS_MergeToStable.py,sha256=1VNs7QxSjkZjjYi281LujZ1fOKP-LWHJKpdruA6L2Ws,21649
20
+ ScriptCollection/TFCPS/TFCPS_MergeToStable.py,sha256=nNS8NavE7MKUOkisH5h8RZa9dcHQd5r8yFZWO4RQSpY,21645
21
21
  ScriptCollection/TFCPS/TFCPS_PreBuildCodeunitsScript.py,sha256=CxdwUklhZVuJGp0vcokoH_KMXFzmlUlZwj77xFYijho,2242
22
22
  ScriptCollection/TFCPS/TFCPS_Tools_Dependencies.py,sha256=o7HI3ki3WWqlAiUsrh3Lky_w6UhYh9hdjYPGOhubQGA,414
23
- ScriptCollection/TFCPS/TFCPS_Tools_General.py,sha256=lZb-LqBfIYhVTmqjpxfJ3Cp7YIbVcre62c5sElMi-xc,80894
23
+ ScriptCollection/TFCPS/TFCPS_Tools_General.py,sha256=cfZl0EM1I9USzFh6cp31BT5kpR0QnVUJDjWeLKiHUs8,85283
24
24
  ScriptCollection/TFCPS/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
25
  ScriptCollection/TFCPS/Docker/TFCPS_CodeUnitSpecific_Docker.py,sha256=ylPvcdiN7RuqXpM-3uNqs40v1kyhaC0guV4JA2pIt_M,5234
26
26
  ScriptCollection/TFCPS/Docker/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -35,8 +35,8 @@ ScriptCollection/TFCPS/NodeJS/TFCPS_CodeUnitSpecific_NodeJS.py,sha256=aF53bvcuZi
35
35
  ScriptCollection/TFCPS/NodeJS/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
36
36
  ScriptCollection/TFCPS/Python/TFCPS_CodeUnitSpecific_Python.py,sha256=q7msAxCb5VIZ-xhFg1MfzUvWomQRKYldqmW42KFhyMU,6868
37
37
  ScriptCollection/TFCPS/Python/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
- scriptcollection-4.0.59.dist-info/METADATA,sha256=Hi-eMj8lIT6fxUx9obu3uvI1sIxitzVlXqKcyt6y3Ek,7688
39
- scriptcollection-4.0.59.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
40
- scriptcollection-4.0.59.dist-info/entry_points.txt,sha256=_izhaQEyHiyBIfM2zTYDaJ7qvgsP1WntkVChFnkWymE,4431
41
- scriptcollection-4.0.59.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
42
- scriptcollection-4.0.59.dist-info/RECORD,,
38
+ scriptcollection-4.0.62.dist-info/METADATA,sha256=11a5AG-8xufjtCbRY9HuVcT9c5kZmieGdAYelRP_Vns,7688
39
+ scriptcollection-4.0.62.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
40
+ scriptcollection-4.0.62.dist-info/entry_points.txt,sha256=_izhaQEyHiyBIfM2zTYDaJ7qvgsP1WntkVChFnkWymE,4431
41
+ scriptcollection-4.0.62.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
42
+ scriptcollection-4.0.62.dist-info/RECORD,,