ScriptCollection 3.5.140__py3-none-any.whl → 3.5.143__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 +1 -1
- ScriptCollection/TasksForCommonProjectStructure.py +85 -28
- {scriptcollection-3.5.140.dist-info → scriptcollection-3.5.143.dist-info}/METADATA +5 -5
- {scriptcollection-3.5.140.dist-info → scriptcollection-3.5.143.dist-info}/RECORD +7 -7
- {scriptcollection-3.5.140.dist-info → scriptcollection-3.5.143.dist-info}/WHEEL +0 -0
- {scriptcollection-3.5.140.dist-info → scriptcollection-3.5.143.dist-info}/entry_points.txt +0 -0
- {scriptcollection-3.5.140.dist-info → scriptcollection-3.5.143.dist-info}/top_level.txt +0 -0
@@ -5,6 +5,7 @@ from pathlib import Path
|
|
5
5
|
from functools import cmp_to_key
|
6
6
|
import shutil
|
7
7
|
import math
|
8
|
+
import tarfile
|
8
9
|
import re
|
9
10
|
import urllib.request
|
10
11
|
import zipfile
|
@@ -22,6 +23,7 @@ from .GeneralUtilities import GeneralUtilities
|
|
22
23
|
from .ScriptCollectionCore import ScriptCollectionCore
|
23
24
|
from .SCLog import SCLog, LogLevel
|
24
25
|
from .ProgramRunnerEpew import ProgramRunnerEpew
|
26
|
+
from .ImageUpdater import ImageUpdater, VersionEcholon
|
25
27
|
|
26
28
|
|
27
29
|
class CreateReleaseConfiguration():
|
@@ -1513,7 +1515,7 @@ class TasksForCommonProjectStructure:
|
|
1513
1515
|
project_version = self.get_version_of_project(repository_folder)
|
1514
1516
|
codeunit_folder = os.path.join(repository_folder, codeunit_name)
|
1515
1517
|
|
1516
|
-
#
|
1518
|
+
# check codeunit-conformity
|
1517
1519
|
# TODO check if foldername=="<codeunitname>[.codeunit.xml]" == <codeunitname> in file
|
1518
1520
|
supported_codeunitspecificationversion = "2.9.4" # should always be the latest version of the ProjectTemplates-repository
|
1519
1521
|
codeunit_file = os.path.join(codeunit_folder, f"{codeunit_name}.codeunit.xml")
|
@@ -1523,7 +1525,7 @@ class TasksForCommonProjectStructure:
|
|
1523
1525
|
namespaces = {'cps': 'https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/tree/main/Conventions/RepositoryStructure/CommonProjectStructure', 'xsi': 'http://www.w3.org/2001/XMLSchema-instance'}
|
1524
1526
|
root: etree._ElementTree = etree.parse(codeunit_file)
|
1525
1527
|
|
1526
|
-
#
|
1528
|
+
# check codeunit-spcecification-version
|
1527
1529
|
try:
|
1528
1530
|
codeunit_file_version = root.xpath('//cps:codeunit/@codeunitspecificationversion', namespaces=namespaces)[0]
|
1529
1531
|
if codeunit_file_version != supported_codeunitspecificationversion:
|
@@ -1538,27 +1540,27 @@ class TasksForCommonProjectStructure:
|
|
1538
1540
|
GeneralUtilities.write_message_to_stderr(f'Warning: Codeunitfile "{codeunit_file}" can not be validated due to the following exception:')
|
1539
1541
|
GeneralUtilities.write_exception_to_stderr(exception)
|
1540
1542
|
|
1541
|
-
#
|
1543
|
+
# check codeunit-name
|
1542
1544
|
codeunit_name_in_codeunit_file = root.xpath('//cps:codeunit/cps:name/text()', namespaces=namespaces)[0]
|
1543
1545
|
if codeunit_name != codeunit_name_in_codeunit_file:
|
1544
1546
|
raise ValueError(f"The folder-name ('{codeunit_name}') is not equal to the codeunit-name ('{codeunit_name_in_codeunit_file}').")
|
1545
1547
|
|
1546
|
-
#
|
1548
|
+
# check owner-name
|
1547
1549
|
codeunit_ownername_in_codeunit_file = self. get_codeunit_owner_name(codeunit_file)
|
1548
1550
|
GeneralUtilities.assert_condition(GeneralUtilities.string_has_content(codeunit_ownername_in_codeunit_file), "No valid name for codeunitowner given.")
|
1549
1551
|
|
1550
|
-
#
|
1552
|
+
# check owner-emailaddress
|
1551
1553
|
codeunit_owneremailaddress_in_codeunit_file = self.get_codeunit_owner_emailaddress(codeunit_file)
|
1552
1554
|
GeneralUtilities.assert_condition(GeneralUtilities.string_has_content(codeunit_owneremailaddress_in_codeunit_file), "No valid email-address for codeunitowner given.")
|
1553
1555
|
|
1554
|
-
#
|
1556
|
+
# check development-state
|
1555
1557
|
developmentstate = root.xpath('//cps:properties/@developmentstate', namespaces=namespaces)[0]
|
1556
1558
|
developmentstate_active = "Active development"
|
1557
1559
|
developmentstate_maintenance = "Maintenance-updates only"
|
1558
1560
|
developmentstate_inactive = "Inactive"
|
1559
1561
|
GeneralUtilities.assert_condition(developmentstate in (developmentstate_active, developmentstate_maintenance, developmentstate_inactive), f"Invalid development-state. Must be '{developmentstate_active}' or '{developmentstate_maintenance}' or '{developmentstate_inactive}' but was '{developmentstate}'.")
|
1560
1562
|
|
1561
|
-
#
|
1563
|
+
# check for mandatory files
|
1562
1564
|
files = ["Other/Build/Build.py", "Other/QualityCheck/Linting.py", "Other/Reference/GenerateReference.py"]
|
1563
1565
|
if self.codeunit_has_testable_sourcecode(codeunit_file):
|
1564
1566
|
# TODO check if the testsettings-section appears in the codeunit-file
|
@@ -1574,7 +1576,7 @@ class TasksForCommonProjectStructure:
|
|
1574
1576
|
if os.path.isfile(os.path.join(codeunit_folder, "Other", "requirements.txt")):
|
1575
1577
|
self.install_requirementstxt_for_codeunit(codeunit_folder, verbosity)
|
1576
1578
|
|
1577
|
-
#
|
1579
|
+
# check developer
|
1578
1580
|
if self.validate_developers_of_repository:
|
1579
1581
|
expected_authors: list[tuple[str, str]] = []
|
1580
1582
|
expected_authors_in_xml = root.xpath('//cps:codeunit/cps:developerteam/cps:developer', namespaces=namespaces)
|
@@ -1597,19 +1599,30 @@ class TasksForCommonProjectStructure:
|
|
1597
1599
|
|
1598
1600
|
# TODO implement cycle-check for dependent codeunits
|
1599
1601
|
|
1600
|
-
#
|
1602
|
+
# clear previously builded artifacts if desired:
|
1601
1603
|
if clear_artifacts_folder:
|
1602
1604
|
artifacts_folder = os.path.join(codeunit_folder, "Other", "Artifacts")
|
1603
1605
|
GeneralUtilities.ensure_directory_does_not_exist(artifacts_folder)
|
1604
1606
|
|
1605
|
-
#
|
1607
|
+
# get artifacts from dependent codeunits
|
1606
1608
|
# if assume_dependent_codeunits_are_already_built:
|
1607
1609
|
# self.build_dependent_code_units(repository_folder, codeunit_name, verbosity, target_environmenttype, additional_arguments_file, commandline_arguments)
|
1608
1610
|
self.copy_artifacts_from_dependent_code_units(repository_folder, codeunit_name)
|
1609
1611
|
|
1610
|
-
#
|
1612
|
+
# update codeunit-version
|
1611
1613
|
self.update_version_of_codeunit(common_tasks_scripts_file, codeunit_version)
|
1612
1614
|
|
1615
|
+
# set project version
|
1616
|
+
package_json_file = os.path.join(repository_folder, "package.json") # TDOO move this to a general project-specific (and codeunit-independent-script)
|
1617
|
+
if os.path.isfile(package_json_file):
|
1618
|
+
package_json_data: str = None
|
1619
|
+
with open(package_json_file, "r", encoding="utf-8") as f1:
|
1620
|
+
package_json_data = json.load(f1)
|
1621
|
+
package_json_data["version"] = project_version
|
1622
|
+
with open(package_json_file, "w", encoding="utf-8") as f2:
|
1623
|
+
json.dump(package_json_data, f2, indent=2)
|
1624
|
+
GeneralUtilities.write_text_to_file(package_json_file, GeneralUtilities.read_text_from_file(package_json_file).replace("\r", ""))
|
1625
|
+
|
1613
1626
|
# set default constants
|
1614
1627
|
self.set_default_constants(os.path.join(codeunit_folder))
|
1615
1628
|
|
@@ -2121,6 +2134,27 @@ class TasksForCommonProjectStructure:
|
|
2121
2134
|
GeneralUtilities.ensure_file_does_not_exist(yamlfile3)
|
2122
2135
|
shutil.copyfile(yamlfile1, yamlfile3)
|
2123
2136
|
|
2137
|
+
@GeneralUtilities.check_arguments
|
2138
|
+
def get_latest_version_of_openapigenerator(self) -> None:
|
2139
|
+
github_api_releases_link = "https://api.github.com/repos/OpenAPITools/openapi-generator/releases"
|
2140
|
+
with urllib.request.urlopen(github_api_releases_link) as release_information_url:
|
2141
|
+
latest_release_infos = json.load(release_information_url)[0]
|
2142
|
+
latest_version = latest_release_infos["tag_name"][1:]
|
2143
|
+
return latest_version
|
2144
|
+
|
2145
|
+
@GeneralUtilities.check_arguments
|
2146
|
+
def set_version_of_openapigenerator_by_update_dependencies_file(self, update_dependencies_script_file: str, used_version: str = None) -> None:
|
2147
|
+
codeunit_folder: str = GeneralUtilities.resolve_relative_path("../..", update_dependencies_script_file)
|
2148
|
+
self.set_version_of_openapigenerator(codeunit_folder, used_version)
|
2149
|
+
|
2150
|
+
@GeneralUtilities.check_arguments
|
2151
|
+
def set_version_of_openapigenerator(self, codeunit_folder: str, used_version: str = None) -> None:
|
2152
|
+
version_file = os.path.join(codeunit_folder, "Other", "Resources", "Dependencies", "OpenAPIGenerator", "Version.txt")
|
2153
|
+
if used_version is None:
|
2154
|
+
used_version = self.get_latest_version_of_openapigenerator()
|
2155
|
+
GeneralUtilities.ensure_file_exists(version_file)
|
2156
|
+
GeneralUtilities.write_text_to_file(version_file, used_version)
|
2157
|
+
|
2124
2158
|
@GeneralUtilities.check_arguments
|
2125
2159
|
def ensure_openapigenerator_is_available(self, codeunit_folder: str) -> None:
|
2126
2160
|
self.assert_is_codeunit_folder(codeunit_folder)
|
@@ -2130,14 +2164,12 @@ class TasksForCommonProjectStructure:
|
|
2130
2164
|
jar_file = f"{openapigenerator_folder}/{filename}"
|
2131
2165
|
jar_file_exists = os.path.isfile(jar_file)
|
2132
2166
|
if internet_connection_is_available: # Load/Update
|
2133
|
-
|
2134
|
-
|
2135
|
-
|
2136
|
-
|
2137
|
-
|
2138
|
-
|
2139
|
-
GeneralUtilities.ensure_directory_exists(openapigenerator_folder)
|
2140
|
-
urllib.request.urlretrieve(download_link, jar_file)
|
2167
|
+
version_file = os.path.join(codeunit_folder, "Other", "Resources", "Dependencies", "OpenAPIGenerator", "Version.txt")
|
2168
|
+
used_version = GeneralUtilities.read_text_from_file(version_file)
|
2169
|
+
download_link = f"https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/{used_version}/openapi-generator-cli-{used_version}.jar"
|
2170
|
+
GeneralUtilities.ensure_directory_does_not_exist(openapigenerator_folder)
|
2171
|
+
GeneralUtilities.ensure_directory_exists(openapigenerator_folder)
|
2172
|
+
urllib.request.urlretrieve(download_link, jar_file)
|
2141
2173
|
else:
|
2142
2174
|
if jar_file_exists:
|
2143
2175
|
GeneralUtilities.write_message_to_stdout("Warning: Can not check for updates of OpenAPIGenerator due to missing internet-connection.")
|
@@ -2569,14 +2601,6 @@ class TasksForCommonProjectStructure:
|
|
2569
2601
|
from_day = datetime(now.year, now.month, now.day, 0, 0, 0)
|
2570
2602
|
self.mark_current_version_as_supported(repository_folder, project_version, from_day, until_day)
|
2571
2603
|
|
2572
|
-
package_json_file = os.path.join(repository_folder, "package.json")
|
2573
|
-
if os.path.isfile(package_json_file):
|
2574
|
-
with open(package_json_file, "r", encoding="utf-8") as f1:
|
2575
|
-
package_json_data = json.load(f1)
|
2576
|
-
package_json_data["version"] = project_version
|
2577
|
-
with open(package_json_file, "w", encoding="utf-8") as f2:
|
2578
|
-
json.dump(package_json_data, f2, indent=2)
|
2579
|
-
|
2580
2604
|
project_resources_folder = os.path.join(repository_folder, "Other", "Scripts")
|
2581
2605
|
PrepareBuildCodeunits_script_name = "PrepareBuildCodeunits.py"
|
2582
2606
|
prepare_build_codeunits_scripts = os.path.join(project_resources_folder, PrepareBuildCodeunits_script_name)
|
@@ -2665,7 +2689,7 @@ class TasksForCommonProjectStructure:
|
|
2665
2689
|
GeneralUtilities.write_message_to_stdout(message2)
|
2666
2690
|
|
2667
2691
|
@GeneralUtilities.check_arguments
|
2668
|
-
def __do_repository_checks(self, repository_folder: str, project_version: str) -> None:
|
2692
|
+
def __do_repository_checks(self, repository_folder: str, project_version: str) -> None: # TDOO move this to a general project-specific (and codeunit-independent-script)
|
2669
2693
|
self.__sc.assert_is_git_repository(repository_folder)
|
2670
2694
|
self.__check_if_changelog_exists(repository_folder, project_version)
|
2671
2695
|
self.__check_whether_security_txt_exists(repository_folder)
|
@@ -2793,6 +2817,30 @@ class TasksForCommonProjectStructure:
|
|
2793
2817
|
def ensure_androidappbundletool_is_available(self, target_folder: str) -> None:
|
2794
2818
|
self.ensure_file_from_github_assets_is_available_with_retry(target_folder, "google", "bundletool", "AndroidAppBundleTool", "bundletool.jar", lambda latest_version: f"bundletool-all-{latest_version}.jar")
|
2795
2819
|
|
2820
|
+
@GeneralUtilities.check_arguments
|
2821
|
+
def ensure_mediamtx_is_available(self, target_folder: str) -> None:
|
2822
|
+
def download_and_extract(osname: str, osname_in_github_asset: str, extension: str):
|
2823
|
+
resource_name: str = f"MediaMTX_{osname}"
|
2824
|
+
zip_filename: str = f"{resource_name}.{extension}"
|
2825
|
+
self.ensure_file_from_github_assets_is_available_with_retry(target_folder, "bluenviron", "mediamtx", resource_name, zip_filename, lambda latest_version: f"mediamtx_{latest_version}_{osname_in_github_asset}_amd64.{extension}")
|
2826
|
+
resource_folder: str = os.path.join(target_folder, "Other", "Resources", resource_name)
|
2827
|
+
target_folder_extracted = os.path.join(resource_folder, "MediaMTX")
|
2828
|
+
local_zip_file: str = os.path.join(resource_folder, f"{resource_name}.{extension}")
|
2829
|
+
GeneralUtilities.ensure_folder_exists_and_is_empty(target_folder_extracted)
|
2830
|
+
if extension == "zip":
|
2831
|
+
with zipfile.ZipFile(local_zip_file, 'r') as zip_ref:
|
2832
|
+
zip_ref.extractall(target_folder_extracted)
|
2833
|
+
elif extension == "tar.gz":
|
2834
|
+
with tarfile.open(local_zip_file, "r:gz") as tar:
|
2835
|
+
tar.extractall(path=target_folder_extracted)
|
2836
|
+
else:
|
2837
|
+
raise ValueError(f"Unknown extension: \"{extension}\"")
|
2838
|
+
GeneralUtilities.ensure_file_does_not_exist(local_zip_file)
|
2839
|
+
|
2840
|
+
download_and_extract("Windows", "windows", "zip")
|
2841
|
+
download_and_extract("Linux", "linux", "tar.gz")
|
2842
|
+
download_and_extract("MacOS", "darwin", "tar.gz")
|
2843
|
+
|
2796
2844
|
@GeneralUtilities.check_arguments
|
2797
2845
|
def ensure_cyclonedxcli_is_available(self, target_folder: str) -> None:
|
2798
2846
|
local_filename = "cyclonedx-cli"
|
@@ -3378,3 +3426,12 @@ class TasksForCommonProjectStructure:
|
|
3378
3426
|
|
3379
3427
|
- Updated geo-ip-database.
|
3380
3428
|
""")
|
3429
|
+
|
3430
|
+
@GeneralUtilities.check_arguments
|
3431
|
+
def update_images_in_example(self, codeunit_folder: str):
|
3432
|
+
iu = ImageUpdater()
|
3433
|
+
iu.add_default_mapper()
|
3434
|
+
dockercomposefile: str = f"{codeunit_folder}\\Other\\Reference\\ReferenceContent\\Examples\\MinimalDockerComposeFile\\docker-compose.yml"
|
3435
|
+
excluded = ["opendms"]
|
3436
|
+
iu.update_all_services_in_docker_compose_file(dockercomposefile, VersionEcholon.LatestPatchOrLatestMinor, excluded)
|
3437
|
+
iu.check_for_newest_version(dockercomposefile, excluded)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: ScriptCollection
|
3
|
-
Version: 3.5.
|
3
|
+
Version: 3.5.143
|
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
|
@@ -24,19 +24,19 @@ Requires-Python: >=3.10
|
|
24
24
|
Description-Content-Type: text/markdown
|
25
25
|
Requires-Dist: build>=1.2.2.post1
|
26
26
|
Requires-Dist: coverage>=7.9.1
|
27
|
-
Requires-Dist: cyclonedx-bom>=6.1.
|
27
|
+
Requires-Dist: cyclonedx-bom>=6.1.2
|
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>=
|
31
|
+
Requires-Dist: lxml>=6.0.0
|
32
32
|
Requires-Dist: ntplib>=0.4.0
|
33
33
|
Requires-Dist: Pillow>=11.2.1
|
34
34
|
Requires-Dist: psutil>=7.0.0
|
35
35
|
Requires-Dist: pycdlib>=1.14.0
|
36
|
-
Requires-Dist: Pygments>=2.19.
|
36
|
+
Requires-Dist: Pygments>=2.19.2
|
37
37
|
Requires-Dist: pylint>=3.3.7
|
38
38
|
Requires-Dist: pyOpenSSL>=25.1.0
|
39
|
-
Requires-Dist: PyPDF>=5.6.
|
39
|
+
Requires-Dist: PyPDF>=5.6.1
|
40
40
|
Requires-Dist: pytest>=8.4.1
|
41
41
|
Requires-Dist: PyYAML>=6.0.2
|
42
42
|
Requires-Dist: qrcode>=8.2
|
@@ -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=Dd2P8vH2PA830wAv6bchlMHHdGE_7At-F4WQY5w4XdA,4016
|
10
|
-
ScriptCollection/ScriptCollectionCore.py,sha256=
|
11
|
-
ScriptCollection/TasksForCommonProjectStructure.py,sha256=
|
10
|
+
ScriptCollection/ScriptCollectionCore.py,sha256=pWtZZsQbcjvCTsVEnx19Wr2Az_ClRUv8c1auPLVG5gM,136482
|
11
|
+
ScriptCollection/TasksForCommonProjectStructure.py,sha256=AP-hy9fvAZsXvd90r9fhG1wNAL248Rbh7KkmdKg8eJg,240506
|
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.143.dist-info/METADATA,sha256=_LIGGGBWhdvyi-HunxH_73o-n4Y0sqBTZTs_s4oT0fQ,7694
|
14
|
+
scriptcollection-3.5.143.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
15
|
+
scriptcollection-3.5.143.dist-info/entry_points.txt,sha256=AvmVO9iyWImExpvzL3YYQ9AOEiUIN9guPRRG_W_VNWY,4116
|
16
|
+
scriptcollection-3.5.143.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
|
17
|
+
scriptcollection-3.5.143.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|