ScriptCollection 3.5.101__py3-none-any.whl → 3.5.103__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.
- ScriptCollection/ScriptCollectionCore.py +70 -42
- ScriptCollection/TasksForCommonProjectStructure.py +20 -32
- {scriptcollection-3.5.101.dist-info → scriptcollection-3.5.103.dist-info}/METADATA +5 -5
- {scriptcollection-3.5.101.dist-info → scriptcollection-3.5.103.dist-info}/RECORD +7 -7
- {scriptcollection-3.5.101.dist-info → scriptcollection-3.5.103.dist-info}/WHEEL +1 -1
- {scriptcollection-3.5.101.dist-info → scriptcollection-3.5.103.dist-info}/entry_points.txt +0 -0
- {scriptcollection-3.5.101.dist-info → scriptcollection-3.5.103.dist-info}/top_level.txt +0 -0
@@ -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.
|
36
|
+
version = "3.5.103"
|
37
37
|
__version__ = version
|
38
38
|
|
39
39
|
|
@@ -292,7 +292,7 @@ class ScriptCollectionCore:
|
|
292
292
|
|
293
293
|
@GeneralUtilities.check_arguments
|
294
294
|
def git_push_with_retry(self, folder: str, remotename: str, localbranchname: str, remotebranchname: str, forcepush: bool = False, pushalltags: bool = True, verbosity: int = 0, amount_of_attempts: int = 5) -> None:
|
295
|
-
GeneralUtilities.retry_action(lambda: self.git_push(folder, remotename, localbranchname, remotebranchname, forcepush, pushalltags,verbosity), amount_of_attempts)
|
295
|
+
GeneralUtilities.retry_action(lambda: self.git_push(folder, remotename, localbranchname, remotebranchname, forcepush, pushalltags, verbosity), amount_of_attempts)
|
296
296
|
|
297
297
|
@GeneralUtilities.check_arguments
|
298
298
|
def git_push(self, folder: str, remotename: str, localbranchname: str, remotebranchname: str, forcepush: bool = False, pushalltags: bool = True, verbosity: int = 0) -> None:
|
@@ -770,6 +770,74 @@ class ScriptCollectionCore:
|
|
770
770
|
if exit_code != 0:
|
771
771
|
raise ValueError(f"Fatal error occurrs while copying '{source}' to '{target}'. StdErr: '{stderr}'")
|
772
772
|
|
773
|
+
@GeneralUtilities.check_arguments
|
774
|
+
def create_file(self, path: str, error_if_already_exists: bool, create_necessary_folder: bool) -> None:
|
775
|
+
"""This function works platform-independent also for non-local-executions if the ScriptCollection commandline-commands are available as global command on the target-system."""
|
776
|
+
if self.program_runner.will_be_executed_locally():
|
777
|
+
if not os.path.isabs(path):
|
778
|
+
path = os.path.join(os.getcwd(), path)
|
779
|
+
|
780
|
+
if os.path.isfile(path) and error_if_already_exists:
|
781
|
+
raise ValueError(f"File '{path}' already exists.")
|
782
|
+
|
783
|
+
# TODO maybe it should be checked if there is a folder with the same path which already exists.
|
784
|
+
|
785
|
+
folder = os.path.dirname(path)
|
786
|
+
|
787
|
+
if not os.path.isdir(folder):
|
788
|
+
if create_necessary_folder:
|
789
|
+
GeneralUtilities.ensure_directory_exists(folder) # TODO check if this also create nested folders if required
|
790
|
+
else:
|
791
|
+
raise ValueError(f"Folder '{folder}' does not exist.")
|
792
|
+
|
793
|
+
GeneralUtilities.ensure_file_exists(path)
|
794
|
+
else:
|
795
|
+
arguments = ["--path", path]
|
796
|
+
|
797
|
+
if error_if_already_exists:
|
798
|
+
arguments = arguments+["--errorwhenexists"]
|
799
|
+
|
800
|
+
if create_necessary_folder:
|
801
|
+
arguments = arguments+["--createnecessaryfolder"]
|
802
|
+
|
803
|
+
exit_code, _, stderr, _ = self.run_program_argsasarray("sccreatefile", arguments, throw_exception_if_exitcode_is_not_zero=False) # works platform-indepent
|
804
|
+
if exit_code != 0:
|
805
|
+
raise ValueError(f"Fatal error occurrs while create file '{path}'. StdErr: '{stderr}'")
|
806
|
+
|
807
|
+
@GeneralUtilities.check_arguments
|
808
|
+
def create_folder(self, path: str, error_if_already_exists: bool, create_necessary_folder: bool) -> None:
|
809
|
+
"""This function works platform-independent also for non-local-executions if the ScriptCollection commandline-commands are available as global command on the target-system."""
|
810
|
+
if self.program_runner.will_be_executed_locally():
|
811
|
+
if not os.path.isabs(path):
|
812
|
+
path = os.path.join(os.getcwd(), path)
|
813
|
+
|
814
|
+
if os.path.isdir(path) and error_if_already_exists:
|
815
|
+
raise ValueError(f"Folder '{path}' already exists.")
|
816
|
+
|
817
|
+
# TODO maybe it should be checked if there is a file with the same path which already exists.
|
818
|
+
|
819
|
+
folder = os.path.dirname(path)
|
820
|
+
|
821
|
+
if not os.path.isdir(folder):
|
822
|
+
if create_necessary_folder:
|
823
|
+
GeneralUtilities.ensure_directory_exists(folder) # TODO check if this also create nested folders if required
|
824
|
+
else:
|
825
|
+
raise ValueError(f"Folder '{folder}' does not exist.")
|
826
|
+
|
827
|
+
GeneralUtilities.ensure_directory_exists(path)
|
828
|
+
else:
|
829
|
+
arguments = ["--path", path]
|
830
|
+
|
831
|
+
if error_if_already_exists:
|
832
|
+
arguments = arguments+["--errorwhenexists"]
|
833
|
+
|
834
|
+
if create_necessary_folder:
|
835
|
+
arguments = arguments+["--createnecessaryfolder"]
|
836
|
+
|
837
|
+
exit_code, _, stderr, _ = self.run_program_argsasarray("sccreatefolder", arguments, throw_exception_if_exitcode_is_not_zero=False) # works platform-indepent
|
838
|
+
if exit_code != 0:
|
839
|
+
raise ValueError(f"Fatal error occurrs while create folder '{path}'. StdErr: '{stderr}'")
|
840
|
+
|
773
841
|
@GeneralUtilities.check_arguments
|
774
842
|
def __sort_fmd(self, line: str):
|
775
843
|
splitted: list = line.split(";")
|
@@ -2203,46 +2271,6 @@ TXDX
|
|
2203
2271
|
def create_local_docker_network(self, network_name: str) -> None:
|
2204
2272
|
self.run_program("docker", f"network create {network_name}")
|
2205
2273
|
|
2206
|
-
@GeneralUtilities.check_arguments
|
2207
|
-
def create_file(self, path: str, error_if_already_exists: bool, create_necessary_folder: bool) -> None:
|
2208
|
-
if not os.path.isabs(path):
|
2209
|
-
path = os.path.join(os.getcwd(), path)
|
2210
|
-
|
2211
|
-
if os.path.isfile(path) and error_if_already_exists:
|
2212
|
-
raise ValueError(f"File '{path}' already exists.")
|
2213
|
-
|
2214
|
-
# TODO maybe it should be checked if there is a folder with the same path which already exists.
|
2215
|
-
|
2216
|
-
folder = os.path.dirname(path)
|
2217
|
-
|
2218
|
-
if not os.path.isdir(folder):
|
2219
|
-
if create_necessary_folder:
|
2220
|
-
GeneralUtilities.ensure_directory_exists(folder) # TODO check if this also create nested folders if required
|
2221
|
-
else:
|
2222
|
-
raise ValueError(f"Folder '{folder}' does not exist.")
|
2223
|
-
|
2224
|
-
GeneralUtilities.ensure_file_exists(path)
|
2225
|
-
|
2226
|
-
@GeneralUtilities.check_arguments
|
2227
|
-
def create_folder(self, path: str, error_if_already_exists: bool, create_necessary_folder: bool) -> None:
|
2228
|
-
if not os.path.isabs(path):
|
2229
|
-
path = os.path.join(os.getcwd(), path)
|
2230
|
-
|
2231
|
-
if os.path.isdir(path) and error_if_already_exists:
|
2232
|
-
raise ValueError(f"Folder '{path}' already exists.")
|
2233
|
-
|
2234
|
-
# TODO maybe it should be checked if there is a file with the same path which already exists.
|
2235
|
-
|
2236
|
-
folder = os.path.dirname(path)
|
2237
|
-
|
2238
|
-
if not os.path.isdir(folder):
|
2239
|
-
if create_necessary_folder:
|
2240
|
-
GeneralUtilities.ensure_directory_exists(folder) # TODO check if this also create nested folders if required
|
2241
|
-
else:
|
2242
|
-
raise ValueError(f"Folder '{folder}' does not exist.")
|
2243
|
-
|
2244
|
-
GeneralUtilities.ensure_directory_exists(path)
|
2245
|
-
|
2246
2274
|
@GeneralUtilities.check_arguments
|
2247
2275
|
def format_xml_file(self, file: str) -> None:
|
2248
2276
|
encoding = "utf-8"
|
@@ -1237,18 +1237,17 @@ class TasksForCommonProjectStructure:
|
|
1237
1237
|
|
1238
1238
|
@GeneralUtilities.check_arguments
|
1239
1239
|
def get_codeunits(self, repository_folder: str, ignore_disabled_codeunits: bool = True) -> list[str]:
|
1240
|
-
|
1241
|
-
|
1242
|
-
for
|
1243
|
-
|
1244
|
-
codeunit_file = os.path.join(
|
1245
|
-
if os.path.
|
1246
|
-
if (
|
1247
|
-
|
1248
|
-
|
1249
|
-
|
1250
|
-
|
1251
|
-
return result
|
1240
|
+
codeunits_with_dependent_codeunits: dict[str, set[str]] = dict[str, set[str]]()
|
1241
|
+
subfolders = GeneralUtilities.get_direct_folders_of_folder(repository_folder)
|
1242
|
+
for subfolder in subfolders:
|
1243
|
+
codeunit_name: str = os.path.basename(subfolder)
|
1244
|
+
codeunit_file = os.path.join(subfolder, f"{codeunit_name}.codeunit.xml")
|
1245
|
+
if os.path.exists(codeunit_file):
|
1246
|
+
if ignore_disabled_codeunits and not self.codeunit_is_enabled(codeunit_file):
|
1247
|
+
continue
|
1248
|
+
codeunits_with_dependent_codeunits[codeunit_name] = self.get_dependent_code_units(codeunit_file)
|
1249
|
+
sorted_codeunits = self._internal_get_sorted_codeunits_by_dict(codeunits_with_dependent_codeunits)
|
1250
|
+
return sorted_codeunits
|
1252
1251
|
|
1253
1252
|
@GeneralUtilities.check_arguments
|
1254
1253
|
def codeunit_is_enabled(self, codeunit_file: str) -> bool:
|
@@ -2456,18 +2455,6 @@ class TasksForCommonProjectStructure:
|
|
2456
2455
|
GeneralUtilities.ensure_directory_exists(ca_target_folder)
|
2457
2456
|
GeneralUtilities.copy_content_of_folder(ca_source_folder, ca_target_folder)
|
2458
2457
|
|
2459
|
-
@GeneralUtilities.check_arguments
|
2460
|
-
def get_sorted_codeunits(self, repository_folder: str) -> list[str]:
|
2461
|
-
codeunits_with_dependent_codeunits: dict[str, set[str]] = dict[str, set[str]]()
|
2462
|
-
subfolders = GeneralUtilities.get_direct_folders_of_folder(repository_folder)
|
2463
|
-
for subfolder in subfolders:
|
2464
|
-
codeunit_name: str = os.path.basename(subfolder)
|
2465
|
-
codeunit_file = os.path.join(subfolder, f"{codeunit_name}.codeunit.xml")
|
2466
|
-
if os.path.exists(codeunit_file):
|
2467
|
-
codeunits_with_dependent_codeunits[codeunit_name] = self.get_dependent_code_units(codeunit_file)
|
2468
|
-
sorted_codeunits = self._internal_get_sorted_codeunits_by_dict(codeunits_with_dependent_codeunits)
|
2469
|
-
return sorted_codeunits
|
2470
|
-
|
2471
2458
|
@GeneralUtilities.check_arguments
|
2472
2459
|
def _internal_get_sorted_codeunits_by_dict(self, codeunits=dict[str, set[str]]) -> list[str]:
|
2473
2460
|
result_typed = list(TopologicalSorter(codeunits).static_order())
|
@@ -2525,7 +2512,7 @@ class TasksForCommonProjectStructure:
|
|
2525
2512
|
PrepareBuildCodeunits_script_name = "PrepareBuildCodeunits.py"
|
2526
2513
|
prepare_build_codeunits_scripts = os.path.join(project_resources_folder, PrepareBuildCodeunits_script_name)
|
2527
2514
|
|
2528
|
-
if do_git_clean_when_no_changes:
|
2515
|
+
if do_git_clean_when_no_changes and not self.__sc.git_repository_has_uncommitted_changes(repository_folder):
|
2529
2516
|
self.__sc.run_program("git", "clean -dfx", repository_folder)
|
2530
2517
|
if os.path.isfile(prepare_build_codeunits_scripts):
|
2531
2518
|
GeneralUtilities.write_message_to_stdout(f'Run "{PrepareBuildCodeunits_script_name}"')
|
@@ -2557,7 +2544,7 @@ class TasksForCommonProjectStructure:
|
|
2557
2544
|
codeunit_file = os.path.join(subfolder, f"{codeunit_name}.codeunit.xml")
|
2558
2545
|
GeneralUtilities.assert_condition(os.path.exists(codeunit_file), f"Codeunit-file '{codeunit_file}' does nost exist.")
|
2559
2546
|
codeunits_with_dependent_codeunits[codeunit_name] = self.get_dependent_code_units(codeunit_file)
|
2560
|
-
sorted_codeunits = self.
|
2547
|
+
sorted_codeunits = self.get_codeunits(repository_folder)
|
2561
2548
|
sorted_codeunits = [codeunit for codeunit in sorted_codeunits if codeunit in codeunits]
|
2562
2549
|
project_version = self.get_version_of_project(repository_folder)
|
2563
2550
|
|
@@ -2894,19 +2881,18 @@ class TasksForCommonProjectStructure:
|
|
2894
2881
|
codeunit_version = self.get_version_of_codeunit_folder(codeunit_folder)
|
2895
2882
|
build_folder = os.path.join(codeunit_folder, "Other", "Build")
|
2896
2883
|
artifacts_folder = os.path.join(codeunit_folder, "Other", "Artifacts", artifact_name_of_zip)
|
2884
|
+
manifest_folder = os.path.join(codeunit_folder, "Other", "Artifacts", "WinGet-Manifest")
|
2897
2885
|
GeneralUtilities.assert_folder_exists(artifacts_folder)
|
2898
2886
|
artifacts_file = ScriptCollectionCore().find_file_by_extension(artifacts_folder, "zip")
|
2899
2887
|
winget_template_file = os.path.join(build_folder, "WinGet-Template.yaml")
|
2900
|
-
winget_manifest_file = os.path.join(
|
2888
|
+
winget_manifest_file = os.path.join(manifest_folder, "WinGet-Manifest.yaml")
|
2901
2889
|
GeneralUtilities.assert_file_exists(winget_template_file)
|
2890
|
+
GeneralUtilities.ensure_directory_exists(manifest_folder)
|
2902
2891
|
GeneralUtilities.ensure_file_exists(winget_manifest_file)
|
2903
2892
|
manifest_content = GeneralUtilities.read_text_from_file(winget_template_file)
|
2904
2893
|
manifest_content = GeneralUtilities.replace_variable_in_string(manifest_content, "version", codeunit_version)
|
2905
2894
|
manifest_content = GeneralUtilities.replace_variable_in_string(manifest_content, "sha256_hashvalue", GeneralUtilities.get_sha256_of_file(artifacts_file))
|
2906
2895
|
GeneralUtilities.write_text_to_file(winget_manifest_file, manifest_content)
|
2907
|
-
target_folder = os.path.join(codeunit_folder, "Other", "Artifacts", "WinGet-Manifest")
|
2908
|
-
GeneralUtilities.ensure_folder_exists_and_is_empty(target_folder)
|
2909
|
-
shutil.copy(winget_manifest_file, target_folder)
|
2910
2896
|
|
2911
2897
|
@GeneralUtilities.check_arguments
|
2912
2898
|
def update_year_in_license_file_in_common_scripts_file(self, common_tasks_scripts_file: str) -> None:
|
@@ -2960,6 +2946,7 @@ class TasksForCommonProjectStructure:
|
|
2960
2946
|
self.assert_is_codeunit_folder(codeunit_folder)
|
2961
2947
|
now = datetime.now()
|
2962
2948
|
codeunit_folder = GeneralUtilities.resolve_relative_path_from_current_working_directory(codeunit_folder)
|
2949
|
+
repository_folder = GeneralUtilities.resolve_relative_path("..", codeunit_folder)
|
2963
2950
|
codeunit_name: str = os.path.basename(codeunit_folder)
|
2964
2951
|
if verbosity > 2:
|
2965
2952
|
GeneralUtilities.write_message_to_stdout(f"Start building codeunit {codeunit_name}")
|
@@ -2974,7 +2961,8 @@ class TasksForCommonProjectStructure:
|
|
2974
2961
|
|
2975
2962
|
GeneralUtilities.write_message_to_stdout(f"Start building codeunit {codeunit_name}.")
|
2976
2963
|
GeneralUtilities.write_message_to_stdout(f"Build-environmenttype: {target_environmenttype}")
|
2977
|
-
self.__sc.
|
2964
|
+
if not self.__sc.git_repository_has_uncommitted_changes(repository_folder):
|
2965
|
+
self.__sc.run_program("git", "clean -dfx", codeunit_folder)
|
2978
2966
|
|
2979
2967
|
verbosity_for_executed_programs = self.get_verbosity_from_commandline_arguments(commandline_arguments, verbosity)
|
2980
2968
|
|
@@ -3080,7 +3068,7 @@ class TasksForCommonProjectStructure:
|
|
3080
3068
|
# Prepare
|
3081
3069
|
GeneralUtilities.write_message_to_stdout("Update dependencies...")
|
3082
3070
|
self.__sc.assert_is_git_repository(repository_folder)
|
3083
|
-
codeunits = self.
|
3071
|
+
codeunits = self.get_codeunits(repository_folder)
|
3084
3072
|
update_dependencies_script_filename = "UpdateDependencies.py"
|
3085
3073
|
target_environmenttype = "QualityCheck"
|
3086
3074
|
self.build_codeunits(repository_folder, target_environmenttype=target_environmenttype, do_git_clean_when_no_changes=True, note="Prepare dependency-update") # Required because update dependencies is not always possible for not-buildet codeunits (depends on the programming language or package manager)
|
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: ScriptCollection
|
3
|
-
Version: 3.5.
|
3
|
+
Version: 3.5.103
|
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
|
@@ -23,7 +23,7 @@ Classifier: Topic :: Utilities
|
|
23
23
|
Requires-Python: >=3.10
|
24
24
|
Description-Content-Type: text/markdown
|
25
25
|
Requires-Dist: build>=1.2.2.post1
|
26
|
-
Requires-Dist: coverage>=7.7.
|
26
|
+
Requires-Dist: coverage>=7.7.1
|
27
27
|
Requires-Dist: cyclonedx-bom>=5.3.0
|
28
28
|
Requires-Dist: defusedxml>=0.7.1
|
29
29
|
Requires-Dist: keyboard>=0.13.5
|
@@ -33,7 +33,7 @@ Requires-Dist: ntplib>=0.4.0
|
|
33
33
|
Requires-Dist: Pillow>=11.1.0
|
34
34
|
Requires-Dist: pycdlib>=1.14.0
|
35
35
|
Requires-Dist: Pygments>=2.19.1
|
36
|
-
Requires-Dist: pylint>=3.3.
|
36
|
+
Requires-Dist: pylint>=3.3.6
|
37
37
|
Requires-Dist: pyOpenSSL>=25.0.0
|
38
38
|
Requires-Dist: PyPDF>=5.4.0
|
39
39
|
Requires-Dist: pytest>=8.3.5
|
@@ -41,7 +41,7 @@ Requires-Dist: PyYAML>=6.0.2
|
|
41
41
|
Requires-Dist: qrcode>=8.0
|
42
42
|
Requires-Dist: send2trash>=1.8.3
|
43
43
|
Requires-Dist: twine>=6.1.0
|
44
|
-
Requires-Dist: xmlschema>=3.4.
|
44
|
+
Requires-Dist: xmlschema>=3.4.5
|
45
45
|
|
46
46
|
# ScriptCollection
|
47
47
|
|
@@ -6,12 +6,12 @@ ScriptCollection/ProgramRunnerEpew.py,sha256=4pjEd0r9Fcz3TTDv0MdTSd5KkigYXcWUVI1
|
|
6
6
|
ScriptCollection/ProgramRunnerPopen.py,sha256=BPY7-ZMIlqT7JOKz8qlB5c0laF2Js-ijzqk09GxZC48,3821
|
7
7
|
ScriptCollection/RPStream.py,sha256=NRRHL3YSP3D9MuAV2jB_--0KUKCsvJGxeKnxgrRZ9kY,1545
|
8
8
|
ScriptCollection/SCLog.py,sha256=l4aekBiGoNkKGtvO_Er3NY_K7ts4ZWtIGlhq07I-4LY,30
|
9
|
-
ScriptCollection/ScriptCollectionCore.py,sha256=
|
10
|
-
ScriptCollection/TasksForCommonProjectStructure.py,sha256=
|
9
|
+
ScriptCollection/ScriptCollectionCore.py,sha256=p9ofnNkzI-3_QsJwbh4auBAGSh-IkWKGlrLSh0eZyBE,125705
|
10
|
+
ScriptCollection/TasksForCommonProjectStructure.py,sha256=MpyvFNyJG7njRYvV9KULJmbn7WonR18YDeS7oI_O3UU,229780
|
11
11
|
ScriptCollection/UpdateCertificates.py,sha256=Eynbgu7k9jLxApP2D_8Il77B6BFjJap6K7oTeEAZYbk,7790
|
12
12
|
ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
13
|
-
scriptcollection-3.5.
|
14
|
-
scriptcollection-3.5.
|
15
|
-
scriptcollection-3.5.
|
16
|
-
scriptcollection-3.5.
|
17
|
-
scriptcollection-3.5.
|
13
|
+
scriptcollection-3.5.103.dist-info/METADATA,sha256=q07vsHzykcNIo0Vixjx1YEAUj21qm1UVbgW70afB0O8,7664
|
14
|
+
scriptcollection-3.5.103.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
15
|
+
scriptcollection-3.5.103.dist-info/entry_points.txt,sha256=fYCGWGNGijBQHhFe6UAO-BEpfEOxLyNJemukt5ElSzs,3644
|
16
|
+
scriptcollection-3.5.103.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
|
17
|
+
scriptcollection-3.5.103.dist-info/RECORD,,
|
File without changes
|
File without changes
|