ScriptCollection 3.5.104__py3-none-any.whl → 3.5.106__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.
@@ -133,33 +133,34 @@ class GeneralUtilities:
133
133
 
134
134
  @staticmethod
135
135
  @check_arguments
136
- def copy_content_of_folder(source_directory: str, target_directory: str, overwrite_existing_files=False) -> None:
137
- GeneralUtilities.__copy_or_move_content_of_folder(source_directory, target_directory, overwrite_existing_files, False)
136
+ def copy_content_of_folder(source_directory: str, target_directory: str, overwrite_existing_files=False,filtertext:str=None) -> None:
137
+ GeneralUtilities.__copy_or_move_content_of_folder(source_directory, target_directory, overwrite_existing_files, False,filtertext)
138
138
 
139
139
  @staticmethod
140
140
  @check_arguments
141
- def move_content_of_folder(source_directory: str, target_directory: str, overwrite_existing_files=False) -> None:
142
- GeneralUtilities.__copy_or_move_content_of_folder(source_directory, target_directory, overwrite_existing_files, True)
141
+ def move_content_of_folder(source_directory: str, target_directory: str, overwrite_existing_files=False,filtertext:str=None) -> None:
142
+ GeneralUtilities.__copy_or_move_content_of_folder(source_directory, target_directory, overwrite_existing_files, True,filtertext)
143
143
 
144
144
  @staticmethod
145
145
  @check_arguments
146
- def __copy_or_move_content_of_folder(source_directory: str, target_directory: str, overwrite_existing_files, remove_source: bool) -> None:
146
+ def __copy_or_move_content_of_folder(source_directory: str, target_directory: str, overwrite_existing_files, remove_source: bool,filtertext:str=None) -> None:
147
147
  srcDirFull = GeneralUtilities.resolve_relative_path_from_current_working_directory(source_directory)
148
148
  dstDirFull = GeneralUtilities.resolve_relative_path_from_current_working_directory(target_directory)
149
149
  if (os.path.isdir(source_directory)):
150
150
  GeneralUtilities.ensure_directory_exists(target_directory)
151
151
  for file in GeneralUtilities.get_direct_files_of_folder(srcDirFull):
152
152
  filename = os.path.basename(file)
153
- targetfile = os.path.join(dstDirFull, filename)
154
- if (os.path.isfile(targetfile)):
155
- if overwrite_existing_files:
156
- GeneralUtilities.ensure_file_does_not_exist(targetfile)
153
+ if filtertext is None or re.match(filtertext, file):
154
+ targetfile = os.path.join(dstDirFull, filename)
155
+ if (os.path.isfile(targetfile)):
156
+ if overwrite_existing_files:
157
+ GeneralUtilities.ensure_file_does_not_exist(targetfile)
158
+ else:
159
+ raise ValueError(f"Targetfile '{targetfile}' does already exist.")
160
+ if remove_source:
161
+ shutil.move(file, dstDirFull)
157
162
  else:
158
- raise ValueError(f"Targetfile {targetfile} does already exist")
159
- if remove_source:
160
- shutil.move(file, dstDirFull)
161
- else:
162
- shutil.copy(file, dstDirFull)
163
+ shutil.copy(file, dstDirFull)
163
164
  for sub_folder in GeneralUtilities.get_direct_folders_of_folder(srcDirFull):
164
165
  foldername = os.path.basename(sub_folder)
165
166
  sub_target = os.path.join(dstDirFull, foldername)
@@ -33,7 +33,7 @@ from .ProgramRunnerBase import ProgramRunnerBase
33
33
  from .ProgramRunnerPopen import ProgramRunnerPopen
34
34
  from .ProgramRunnerEpew import ProgramRunnerEpew, CustomEpewArgument
35
35
 
36
- version = "3.5.104"
36
+ version = "3.5.106"
37
37
  __version__ = version
38
38
 
39
39
 
@@ -1868,7 +1868,8 @@ DNS = {domain}
1868
1868
  self.run_program_argsasarray("openssl", ['pkcs12', '-export', '-out', f'{filename}.pfx', f'-inkey', f'{filename}.key', '-in', f'{filename}.crt', '-password', f'pass:{password}'], folder)
1869
1869
 
1870
1870
  @GeneralUtilities.check_arguments
1871
- def update_dependencies_of_python_in_requirementstxt_file(self, file: str, verbosity: int):
1871
+ def update_dependencies_of_python_in_requirementstxt_file(self, file: str,ignored_dependencies:list[str], verbosity: int):
1872
+ #TODO consider ignored_dependencies
1872
1873
  lines = GeneralUtilities.read_lines_from_file(file)
1873
1874
  new_lines = []
1874
1875
  for line in lines:
@@ -1898,7 +1899,8 @@ DNS = {domain}
1898
1899
  raise ValueError(f'Unexpected line in requirements-file: "{line}"')
1899
1900
 
1900
1901
  @GeneralUtilities.check_arguments
1901
- def update_dependencies_of_python_in_setupcfg_file(self, setup_cfg_file: str, verbosity: int):
1902
+ def update_dependencies_of_python_in_setupcfg_file(self, setup_cfg_file: str,ignored_dependencies:list[str], verbosity: int):
1903
+ #TODO consider ignored_dependencies
1902
1904
  lines = GeneralUtilities.read_lines_from_file(setup_cfg_file)
1903
1905
  new_lines = []
1904
1906
  requirement_parsing_mode = False
@@ -2277,3 +2279,6 @@ TXDX
2277
2279
  element = ET.XML(GeneralUtilities.read_text_from_file(file, encoding))
2278
2280
  ET.indent(element)
2279
2281
  GeneralUtilities.write_text_to_file(file, ET.tostring(element, encoding="unicode"), encoding)
2282
+
2283
+ def install_requirementstxt_file(self,requirements_txt_file: str, folder: str, verbosity: int):
2284
+ self.run_program_argsasarray("pip", ["install", "-r", requirements_txt_file], folder, verbosity=verbosity)
@@ -1560,6 +1560,9 @@ class TasksForCommonProjectStructure:
1560
1560
  combined_file = os.path.join(codeunit_folder, file)
1561
1561
  if not os.path.isfile(combined_file):
1562
1562
  raise ValueError(f'The mandatory file "{file}" does not exist in the codeunit-folder.')
1563
+
1564
+ if os.path.isfile(os.path.join(codeunit_folder,"Other","requirements.txt")):
1565
+ self.install_requirementstxt_for_codeunit(codeunit_folder,verbosity)
1563
1566
 
1564
1567
  # Check developer
1565
1568
  if self.validate_developers_of_repository:
@@ -2264,16 +2267,32 @@ class TasksForCommonProjectStructure:
2264
2267
  ignored_dependencies = self.get_dependencies_which_are_ignored_from_updates(codeunit_folder, True)
2265
2268
  # TODO implement
2266
2269
 
2270
+ @GeneralUtilities.check_arguments
2271
+ def update_dependencies_of_typical_python_repository_requirements(self, repository_folder: str, verbosity: int, cmd_args: list[str]) -> None:
2272
+ verbosity = self.get_verbosity_from_commandline_arguments(cmd_args, verbosity)
2273
+
2274
+ development_requirements_file = os.path.join(repository_folder, "Other","requirements.txt")
2275
+ if (os.path.isfile(development_requirements_file)):
2276
+ self.__sc.update_dependencies_of_python_in_requirementstxt_file(development_requirements_file,[], verbosity)
2277
+
2267
2278
  @GeneralUtilities.check_arguments
2268
2279
  def update_dependencies_of_typical_python_codeunit(self, update_script_file: str, verbosity: int, cmd_args: list[str]) -> None:
2269
2280
  codeunit_folder = GeneralUtilities.resolve_relative_path("..", os.path.dirname(update_script_file))
2270
2281
  ignored_dependencies = self.get_dependencies_which_are_ignored_from_updates(codeunit_folder, True)
2271
2282
  # TODO consider ignored_dependencies
2272
2283
  verbosity = self.get_verbosity_from_commandline_arguments(cmd_args, verbosity)
2273
- self.__sc.update_dependencies_of_python_in_setupcfg_file(os.path.join(codeunit_folder, "setup.cfg"), verbosity)
2274
- development_requirements_file = os.path.join(codeunit_folder, "requirements.txt")
2284
+
2285
+ setup_cfg=os.path.join(codeunit_folder, "setup.cfg")
2286
+ if (os.path.isfile(setup_cfg)):
2287
+ self.__sc.update_dependencies_of_python_in_setupcfg_file(setup_cfg,ignored_dependencies, verbosity)
2288
+
2289
+ development_requirements_file = os.path.join(codeunit_folder, "requirements.txt")#required for codeunits which contain python-code which need third-party dependencies
2275
2290
  if (os.path.isfile(development_requirements_file)):
2276
- self.__sc.update_dependencies_of_python_in_requirementstxt_file(development_requirements_file, verbosity)
2291
+ self.__sc.update_dependencies_of_python_in_requirementstxt_file(development_requirements_file,ignored_dependencies, verbosity)
2292
+
2293
+ development_requirements_file2 = os.path.join(codeunit_folder, "Other","requirements.txt")#required for codeunits which contain python-scripts which needs third-party dependencies
2294
+ if (os.path.isfile(development_requirements_file2)):
2295
+ self.__sc.update_dependencies_of_python_in_requirementstxt_file(development_requirements_file2, ignored_dependencies,verbosity)
2277
2296
 
2278
2297
  @GeneralUtilities.check_arguments
2279
2298
  def update_dependencies_of_typical_dotnet_codeunit(self, update_script_file: str, verbosity: int, cmd_args: list[str]) -> None:
@@ -3271,3 +3290,28 @@ class TasksForCommonProjectStructure:
3271
3290
  self.__sc.git_checkout(ref_repo, update_http_documentation_arguments.main_branch_name)
3272
3291
  self.__sc.git_push_with_retry(ref_repo, update_http_documentation_arguments.common_remote_name, update_http_documentation_arguments.main_branch_name, update_http_documentation_arguments.main_branch_name)
3273
3292
  self.__sc.git_commit(GeneralUtilities.resolve_relative_path("../..", folder_of_this_file), f"Updated content of {update_http_documentation_arguments.product_name} v{update_http_documentation_arguments.new_project_version} in {update_http_documentation_arguments.reference_repository_name}-submodule")
3293
+
3294
+ @GeneralUtilities.check_arguments
3295
+ def install_requirementstxt_for_codeunit(self,codeunit_folder:str,verbosity:int):
3296
+ self.__sc.install_requirementstxt_file(codeunit_folder+"/Other/requirements.txt", verbosity)
3297
+
3298
+ @GeneralUtilities.check_arguments
3299
+ def install_requirementstxt_for_repository(self, repository_folde: str,verbosity:int):
3300
+ self.__sc.install_requirementstxt_file(repository_folde+"/Other/requirements.txt", verbosity)
3301
+
3302
+ @GeneralUtilities.check_arguments
3303
+ def update_submodule(self, repository_folder: str, submodule_name:str):
3304
+ submodule_folder = GeneralUtilities.resolve_relative_path("Other/Resources/Submodules/"+submodule_name, repository_folder)
3305
+ self.__sc.git_fetch(submodule_folder, "origin")
3306
+ self.__sc.git_checkout(submodule_folder, "main")
3307
+ self.__sc.git_pull(submodule_folder, "origin", "main", "main", True)
3308
+ current_version = self.__sc.get_semver_version_from_gitversion(repository_folder)
3309
+ changelog_file = os.path.join(repository_folder, "Other", "Resources", "Changelog", f"v{current_version}.md")
3310
+ if (not os.path.isfile(changelog_file)):
3311
+ GeneralUtilities.ensure_file_exists(changelog_file)
3312
+ GeneralUtilities.write_text_to_file(changelog_file, """# Release notes
3313
+
3314
+ ## Changes
3315
+
3316
+ - Updated geo-ip-database.
3317
+ """)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ScriptCollection
3
- Version: 3.5.104
3
+ Version: 3.5.106
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
@@ -28,7 +28,7 @@ Requires-Dist: cyclonedx-bom>=5.3.0
28
28
  Requires-Dist: defusedxml>=0.7.1
29
29
  Requires-Dist: keyboard>=0.13.5
30
30
  Requires-Dist: lcov-cobertura>=2.1.1
31
- Requires-Dist: lxml>=5.3.1
31
+ Requires-Dist: lxml>=5.3.2
32
32
  Requires-Dist: ntplib>=0.4.0
33
33
  Requires-Dist: Pillow>=11.1.0
34
34
  Requires-Dist: pycdlib>=1.14.0
@@ -1,16 +1,16 @@
1
1
  ScriptCollection/Executables.py,sha256=HI9Pxs5Z9QxPGyqeJU2lWslEggFyGYANCqYVQZp6eJ0,30490
2
- ScriptCollection/GeneralUtilities.py,sha256=jkJu6y8Wv-j_braS_0zsjF6JzDo46NshMeeAphsXGX4,43848
2
+ ScriptCollection/GeneralUtilities.py,sha256=rjOHLJXHQtYCDSjjWQ45Vs7vzm9C2lEgtyYQ_91TEHU,44043
3
3
  ScriptCollection/ProcessesRunner.py,sha256=3mu4ZxzZleQo0Op6o9EYTCFiJfb6kx5ov2YfZfT89mU,1395
4
4
  ScriptCollection/ProgramRunnerBase.py,sha256=2kMIAqdc65UjBAddOZkzy_aFx9h5roZ5a4bQNM6RV6Y,2480
5
5
  ScriptCollection/ProgramRunnerEpew.py,sha256=4pjEd0r9Fcz3TTDv0MdTSd5KkigYXcWUVI1X43regfU,6477
6
6
  ScriptCollection/ProgramRunnerPopen.py,sha256=BPY7-ZMIlqT7JOKz8qlB5c0laF2Js-ijzqk09GxZC48,3821
7
7
  ScriptCollection/SCLog.py,sha256=Gw27Oclcb0ten7_89PD5CdNMoO-at2hGUOYbF-x1HPQ,2296
8
- ScriptCollection/ScriptCollectionCore.py,sha256=08UGdNP-Ji04KIkoG_1Ks7EdbLlSpnM-dI0WBNMzrOc,125705
9
- ScriptCollection/TasksForCommonProjectStructure.py,sha256=4EcmpWaLxfJHPSW47EXeJivk4hypqPasgbX-joj9isE,229844
8
+ ScriptCollection/ScriptCollectionCore.py,sha256=w5AmB7nLdcgRu5kqfHls95046uRQHqLvWMsywZX4yMA,126071
9
+ ScriptCollection/TasksForCommonProjectStructure.py,sha256=9rO_W6kZiy3Lgov0HeyyDhOwriorMeJXlVDvwZ3S1UE,232511
10
10
  ScriptCollection/UpdateCertificates.py,sha256=xRebqD2etBD7ILHL-7fg-Y-kPF0Tbmnwexv4FhwDntQ,7791
11
11
  ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
- scriptcollection-3.5.104.dist-info/METADATA,sha256=oZ-T6ilqqw29o0VDog_vtgJvC7yYrKWd2Tm1PT_BDJE,7664
13
- scriptcollection-3.5.104.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
14
- scriptcollection-3.5.104.dist-info/entry_points.txt,sha256=fYCGWGNGijBQHhFe6UAO-BEpfEOxLyNJemukt5ElSzs,3644
15
- scriptcollection-3.5.104.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
16
- scriptcollection-3.5.104.dist-info/RECORD,,
12
+ scriptcollection-3.5.106.dist-info/METADATA,sha256=n6LYf8sPb9QA50YUjdHf3Sx-ShX9J-_mjl4eJ4RZp4g,7664
13
+ scriptcollection-3.5.106.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
14
+ scriptcollection-3.5.106.dist-info/entry_points.txt,sha256=fYCGWGNGijBQHhFe6UAO-BEpfEOxLyNJemukt5ElSzs,3644
15
+ scriptcollection-3.5.106.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
16
+ scriptcollection-3.5.106.dist-info/RECORD,,