ScriptCollection 3.5.149__py3-none-any.whl → 3.5.150__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.
@@ -34,7 +34,7 @@ from .ProgramRunnerPopen import ProgramRunnerPopen
34
34
  from .ProgramRunnerEpew import ProgramRunnerEpew, CustomEpewArgument
35
35
  from .SCLog import SCLog, LogLevel
36
36
 
37
- version = "3.5.149"
37
+ version = "3.5.150"
38
38
  __version__ = version
39
39
 
40
40
 
@@ -124,6 +124,17 @@ class TasksForCommonProjectStructure:
124
124
  sc.log = log
125
125
  self.__sc = sc
126
126
 
127
+ @GeneralUtilities.check_arguments
128
+ def is_codeunit_folder(self, codeunit_folder: str) -> bool:
129
+ repo_folder = GeneralUtilities.resolve_relative_path("..", codeunit_folder)
130
+ if not self.__sc.is_git_repository(repo_folder):
131
+ return False
132
+ codeunit_name = os.path.basename(codeunit_folder)
133
+ codeunit_file: str = os.path.join(codeunit_folder, f"{codeunit_name}.codeunit.xml")
134
+ if not os.path.isfile(codeunit_file):
135
+ return False
136
+ return True
137
+
127
138
  @GeneralUtilities.check_arguments
128
139
  def assert_is_codeunit_folder(self, codeunit_folder: str) -> str:
129
140
  repo_folder = GeneralUtilities.resolve_relative_path("..", codeunit_folder)
@@ -1884,7 +1895,7 @@ class TasksForCommonProjectStructure:
1884
1895
  GeneralUtilities.write_text_to_file(file, result)
1885
1896
 
1886
1897
  @GeneralUtilities.check_arguments
1887
- def do_npm_install(self, package_json_folder: str, force: bool, verbosity: int) -> None:
1898
+ def do_npm_install(self, package_json_folder: str, force: bool, verbosity: int = 1) -> None:
1888
1899
  argument1 = "install"
1889
1900
  if force:
1890
1901
  argument1 = f"{argument1} --force"
@@ -2092,6 +2103,14 @@ class TasksForCommonProjectStructure:
2092
2103
  GeneralUtilities.ensure_directory_does_not_exist(target_folder)
2093
2104
  shutil.copytree(source_folder, target_folder)
2094
2105
 
2106
+ @GeneralUtilities.check_arguments
2107
+ def copy_resources_from_global_project_resources(self, codeunit_folder: str, resource_name: str) -> None:
2108
+ self.assert_is_codeunit_folder(codeunit_folder)
2109
+ source_folder: str = GeneralUtilities.resolve_relative_path(f"../Other/Resources/{resource_name}", codeunit_folder)
2110
+ target_folder: str = GeneralUtilities.resolve_relative_path(f"Other/Resources/{resource_name}", codeunit_folder)
2111
+ GeneralUtilities.ensure_directory_does_not_exist(target_folder)
2112
+ shutil.copytree(source_folder, target_folder)
2113
+
2095
2114
  @GeneralUtilities.check_arguments
2096
2115
  def generate_openapi_file(self, buildscript_file: str, runtime: str, verbosity: int, commandline_arguments: list[str], swagger_document_name: str = "APISpecification") -> None:
2097
2116
  GeneralUtilities.write_message_to_stdout("Generate OpenAPI-specification-file...")
@@ -2354,16 +2373,18 @@ class TasksForCommonProjectStructure:
2354
2373
  self.__sc.update_dependencies_of_dotnet_project(csproj_file, verbosity, ignored_dependencies)
2355
2374
 
2356
2375
  @GeneralUtilities.check_arguments
2357
- def update_dependencies_of_typical_node_codeunit(self, update_script_file: str, verbosity: int, cmd_args: list[str]) -> None:
2358
- codeunit_folder = GeneralUtilities.resolve_relative_path("..", os.path.dirname(update_script_file))
2359
- ignored_dependencies = self.get_dependencies_which_are_ignored_from_updates(codeunit_folder, True)
2376
+ def update_dependencies_of_package_json(self, folder: str, verbosity: int, cmd_args: list[str]) -> None:
2377
+ if self.is_codeunit_folder(folder):
2378
+ ignored_dependencies = self.get_dependencies_which_are_ignored_from_updates(folder, True)
2379
+ else:
2380
+ ignored_dependencies = []
2360
2381
  # TODO consider ignored_dependencies
2361
- result = self.run_with_epew("npm", "outdated", codeunit_folder, verbosity, throw_exception_if_exitcode_is_not_zero=False)
2382
+ result = self.run_with_epew("npm", "outdated", folder, verbosity, throw_exception_if_exitcode_is_not_zero=False)
2362
2383
  if result[0] == 0:
2363
2384
  return # all dependencies up to date
2364
2385
  elif result[0] == 1:
2365
2386
  package_json_content = None
2366
- package_json_file = f"{codeunit_folder}/package.json"
2387
+ package_json_file = f"{folder}/package.json"
2367
2388
  with open(package_json_file, "r", encoding="utf-8") as package_json_file_object:
2368
2389
  package_json_content = json.load(package_json_file_object)
2369
2390
  lines = GeneralUtilities.string_to_lines(result[1])[1:][:-1]
@@ -2377,7 +2398,7 @@ class TasksForCommonProjectStructure:
2377
2398
  package_json_content["devDependencies"][package] = latest_version
2378
2399
  with open(package_json_file, "w", encoding="utf-8") as package_json_file_object:
2379
2400
  json.dump(package_json_content, package_json_file_object, indent=4)
2380
- self.do_npm_install(codeunit_folder, True, verbosity)
2401
+ self.do_npm_install(folder, True, verbosity)
2381
2402
  else:
2382
2403
  GeneralUtilities.write_message_to_stderr("Update dependencies resulted in an error.")
2383
2404
 
@@ -3416,7 +3437,7 @@ class TasksForCommonProjectStructure:
3416
3437
  self.__sc.install_requirementstxt_file(repository_folde+"/Other/requirements.txt", verbosity)
3417
3438
 
3418
3439
  @GeneralUtilities.check_arguments
3419
- def update_submodule(self, repository_folder: str, submodule_name: str,local_branch:str="main",remote_branch:str="main",remote:str="origin"):
3440
+ def update_submodule(self, repository_folder: str, submodule_name: str, local_branch: str = "main", remote_branch: str = "main", remote: str = "origin"):
3420
3441
  submodule_folder = GeneralUtilities.resolve_relative_path("Other/Resources/Submodules/"+submodule_name, repository_folder)
3421
3442
  self.__sc.git_fetch(submodule_folder, remote)
3422
3443
  self.__sc.git_checkout(submodule_folder, local_branch)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ScriptCollection
3
- Version: 3.5.149
3
+ Version: 3.5.150
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
@@ -7,11 +7,11 @@ ScriptCollection/ProgramRunnerBase.py,sha256=2kMIAqdc65UjBAddOZkzy_aFx9h5roZ5a4b
7
7
  ScriptCollection/ProgramRunnerEpew.py,sha256=4pjEd0r9Fcz3TTDv0MdTSd5KkigYXcWUVI1X43regfU,6477
8
8
  ScriptCollection/ProgramRunnerPopen.py,sha256=BPY7-ZMIlqT7JOKz8qlB5c0laF2Js-ijzqk09GxZC48,3821
9
9
  ScriptCollection/SCLog.py,sha256=GJ44S6VaBVwX5Dd6MIrdZn6I0dpaaYKVq9w-N0nMXlo,4496
10
- ScriptCollection/ScriptCollectionCore.py,sha256=2GF7AUB6QN2o3N3-KPhdHGzxwpZryfWQIPRGLUMRmRo,138093
11
- ScriptCollection/TasksForCommonProjectStructure.py,sha256=GoIVDPIGua2ZJIGM4zeJL1nNLwh7X1W8BI-2z-ESgb0,241302
10
+ ScriptCollection/ScriptCollectionCore.py,sha256=5NttFPAv0ArguQgpq-4BPm37_hiUQRlpyscIVH8b8qQ,138093
11
+ ScriptCollection/TasksForCommonProjectStructure.py,sha256=jPgWuxmQ0_iSE1fWZesNipG0ddATCFGLoU4RaWWW_LI,242339
12
12
  ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
- scriptcollection-3.5.149.dist-info/METADATA,sha256=Xt22-tDxFlz_5bbY-hDalMAXE7ndoPYu7QeEGLC822g,7689
14
- scriptcollection-3.5.149.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
15
- scriptcollection-3.5.149.dist-info/entry_points.txt,sha256=UyXXDpgVK6U0rkdbe2g-d3a7JFhLFWTUFSYWhcJE7IA,4214
16
- scriptcollection-3.5.149.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
17
- scriptcollection-3.5.149.dist-info/RECORD,,
13
+ scriptcollection-3.5.150.dist-info/METADATA,sha256=8qYKtBv7zsacVbjXt6OPfjZIDfoK4d2hIJ3qYyj-XLE,7689
14
+ scriptcollection-3.5.150.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
15
+ scriptcollection-3.5.150.dist-info/entry_points.txt,sha256=UyXXDpgVK6U0rkdbe2g-d3a7JFhLFWTUFSYWhcJE7IA,4214
16
+ scriptcollection-3.5.150.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
17
+ scriptcollection-3.5.150.dist-info/RECORD,,