ScriptCollection 3.5.30__py3-none-any.whl → 3.5.32__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.
@@ -31,7 +31,7 @@ from .ProgramRunnerBase import ProgramRunnerBase
31
31
  from .ProgramRunnerPopen import ProgramRunnerPopen
32
32
  from .ProgramRunnerEpew import ProgramRunnerEpew, CustomEpewArgument
33
33
 
34
- version = "3.5.30"
34
+ version = "3.5.32"
35
35
  __version__ = version
36
36
 
37
37
 
@@ -1719,26 +1719,22 @@ chmod {permission} {link_file}
1719
1719
  GeneralUtilities.write_lines_to_file(file, lines)
1720
1720
 
1721
1721
  @GeneralUtilities.check_arguments
1722
- def get_external_ip(self, proxy: str) -> str:
1723
- information = self.get_externalnetworkinformation_as_json_string(proxy)
1722
+ def get_external_ip(self) -> str:
1723
+ information = self.get_externalnetworkinformation_as_json_string()
1724
1724
  parsed = json.loads(information)
1725
- return parsed.ip
1725
+ return parsed.IPAddress
1726
1726
 
1727
1727
  @GeneralUtilities.check_arguments
1728
- def get_country_of_external_ip(self, proxy: str) -> str:
1729
- information = self.get_externalnetworkinformation_as_json_string(proxy)
1728
+ def get_country_of_external_ip(self) -> str:
1729
+ information = self.get_externalnetworkinformation_as_json_string()
1730
1730
  parsed = json.loads(information)
1731
- return parsed.country
1731
+ return parsed.Country
1732
1732
 
1733
1733
  @GeneralUtilities.check_arguments
1734
- def get_externalnetworkinformation_as_json_string(self, proxy: str) -> str:
1735
- proxies = None
1736
- if GeneralUtilities.string_has_content(proxy):
1737
- proxies = {"http": proxy}
1734
+ def get_externalnetworkinformation_as_json_string(self) -> str:
1738
1735
  headers = {'Cache-Control': 'no-cache'}
1739
- response = requests.get('https://ipinfo.io', proxies=proxies, timeout=5, headers=headers)
1740
- network_information_as_json_string = GeneralUtilities.bytes_to_string(
1741
- response.content)
1736
+ response = requests.get('https://clientinformation.anion327.de/API/v1/ClientInformationBackendController/Information', timeout=5, headers=headers)
1737
+ network_information_as_json_string = GeneralUtilities.bytes_to_string(response.content)
1742
1738
  return network_information_as_json_string
1743
1739
 
1744
1740
  @GeneralUtilities.check_arguments
@@ -753,7 +753,7 @@ class TasksForCommonProjectStructure:
753
753
  for file in GeneralUtilities.get_all_files_of_folder(src_folder)+GeneralUtilities.get_all_files_of_folder(tests_folder):
754
754
  relative_file_path_in_repository = os.path.relpath(file, repository_folder)
755
755
  if file.endswith(".py") and os.path.getsize(file) > 0 and not self.__sc.file_is_git_ignored(relative_file_path_in_repository, repository_folder):
756
- GeneralUtilities.write_message_to_stdout(f"Check for linting-issues in {os.path.relpath(file,os.path.join(repository_folder,codeunitname))}.")
756
+ GeneralUtilities.write_message_to_stdout(f"Check for linting-issues in {os.path.relpath(file, os.path.join(repository_folder, codeunitname))}.")
757
757
  linting_result = self.__sc.python_file_has_errors(file, repository_folder)
758
758
  if (linting_result[0]):
759
759
  errors_found = True
@@ -1102,9 +1102,7 @@ class TasksForCommonProjectStructure:
1102
1102
  raise ValueError(f"Repository '{repository_folder}' has uncommitted changes.")
1103
1103
 
1104
1104
  @GeneralUtilities.check_arguments
1105
- def ensure_certificate_authority_for_development_purposes_is_generated(self, script_file: str):
1106
- folder_of_current_file = os.path.dirname(script_file)
1107
- product_folder: str = GeneralUtilities.resolve_relative_path("../..", folder_of_current_file)
1105
+ def ensure_certificate_authority_for_development_purposes_is_generated(self, product_folder: str):
1108
1106
  product_name: str = os.path.basename(product_folder)
1109
1107
  now = datetime.now()
1110
1108
  ca_name = f"{product_name}CA_{now.year:04}{now.month:02}{now.day:02}{now.hour:02}{now.min:02}{now.second:02}"
@@ -1119,6 +1117,15 @@ class TasksForCommonProjectStructure:
1119
1117
  pass
1120
1118
  if generate_certificate:
1121
1119
  self.__sc.generate_certificate_authority(ca_folder, ca_name, "DE", "SubjST", "SubjL", "SubjO", "SubjOU")
1120
+ # TODO add switch to auto-install the script if desired
1121
+ # for windows: powershell Import-Certificate -FilePath ConSurvCA_20241121000236.crt -CertStoreLocation 'Cert:\CurrentUser\Root'
1122
+ # for linux: (TODO)
1123
+
1124
+ @GeneralUtilities.check_arguments
1125
+ def generate_certificate_for_development_purposes_for_product(self, repository_folder: str):
1126
+ product_name = os.path.basename(repository_folder)
1127
+ ca_folder: str = os.path.join(repository_folder, "Other", "Resources", "CA")
1128
+ self.__generate_certificate_for_development_purposes(product_name, os.path.join(repository_folder, "Other", "Resources"), ca_folder, None)
1122
1129
 
1123
1130
  @GeneralUtilities.check_arguments
1124
1131
  def generate_certificate_for_development_purposes_for_external_service(self, service_folder: str, domain: str = None):
@@ -1160,6 +1167,15 @@ class TasksForCommonProjectStructure:
1160
1167
  self.__sc.sign_certificate(certificate_folder, ca_folder, ca_name, domain, resource_content_filename)
1161
1168
  GeneralUtilities.ensure_file_does_not_exist(unsignedcertificate_file)
1162
1169
 
1170
+ @GeneralUtilities.check_arguments
1171
+ def copy_product_resource_to_codeunit_resource_folder(self, codeunit_folder: str, resourcename: str) -> None:
1172
+ src_folder = GeneralUtilities.resolve_relative_path(f"../Other/Resources/{resourcename}", codeunit_folder)
1173
+ GeneralUtilities.assert_condition(os.path.isdir(src_folder), f"Required product-resource {resourcename} does not exist. Expected folder: {src_folder}")
1174
+ trg_folder = GeneralUtilities.resolve_relative_path(f"Other/Resources/{resourcename}", codeunit_folder)
1175
+ GeneralUtilities.ensure_directory_does_not_exist(trg_folder)
1176
+ GeneralUtilities.ensure_directory_exists(trg_folder)
1177
+ GeneralUtilities.copy_content_of_folder(src_folder, trg_folder)
1178
+
1163
1179
  @GeneralUtilities.check_arguments
1164
1180
  def ensure_product_resource_is_imported(self, codeunit_folder: str, product_resource_name: str) -> None:
1165
1181
  product_folder = os.path.dirname(codeunit_folder)
@@ -1803,7 +1819,7 @@ class TasksForCommonProjectStructure:
1803
1819
 
1804
1820
  @GeneralUtilities.check_arguments
1805
1821
  def copy_development_certificate_to_default_development_directory(self, codeunit_folder: str, build_environment: str, domain: str = None, certificate_resource_name: str = "DevelopmentCertificate") -> None:
1806
- if build_environment == "Development":
1822
+ if build_environment != "Productive":
1807
1823
  codeunit_name: str = os.path.basename(codeunit_folder)
1808
1824
  if domain is None:
1809
1825
  domain = f"{codeunit_name}.test.local".lower()
@@ -1991,6 +2007,7 @@ class TasksForCommonProjectStructure:
1991
2007
 
1992
2008
  @GeneralUtilities.check_arguments
1993
2009
  def add_github_release(self, productname: str, projectversion: str, build_artifacts_folder: str, github_username: str, repository_folder: str, commandline_arguments: list[str]) -> None:
2010
+ GeneralUtilities.write_message_to_stdout(f"Create GitHub-release for {productname}.")
1994
2011
  verbosity = TasksForCommonProjectStructure.get_verbosity_from_commandline_arguments(commandline_arguments, 1)
1995
2012
  github_repo = f"{github_username}/{productname}"
1996
2013
  artifact_files = []
@@ -2271,7 +2288,7 @@ class TasksForCommonProjectStructure:
2271
2288
  changelog_folder = os.path.join(repository_folder, "Other", "Resources", "Changelog")
2272
2289
  changelog_file = os.path.join(changelog_folder, f"v{project_version}.md")
2273
2290
  if not os.path.isfile(changelog_file):
2274
- raise ValueError(f"Changelog-file '{changelog_file}' does not exist.")
2291
+ raise ValueError(f"Changelog-file '{changelog_file}' does not exist. Try creating it using 'sccreatechangelogentry' for example.")
2275
2292
 
2276
2293
  @GeneralUtilities.check_arguments
2277
2294
  def __check_whether_security_txt_exists(self, repository_folder: str) -> None:
@@ -2651,6 +2668,7 @@ class TasksForCommonProjectStructure:
2651
2668
 
2652
2669
  @GeneralUtilities.check_arguments
2653
2670
  def generic_prepare_new_release(self, generic_prepare_new_release_arguments: GenericPrepareNewReleaseArguments):
2671
+ GeneralUtilities.write_message_to_stdout(f"Prepare release for {generic_prepare_new_release_arguments.product_name}.")
2654
2672
 
2655
2673
  # constants
2656
2674
  folder_of_this_file = os.path.dirname(generic_prepare_new_release_arguments.current_file)
@@ -2695,6 +2713,7 @@ class TasksForCommonProjectStructure:
2695
2713
 
2696
2714
  @GeneralUtilities.check_arguments
2697
2715
  def generic_create_release(self, generic_create_release_arguments: GenericCreateReleaseArguments) -> tuple[bool, str]:
2716
+ GeneralUtilities.write_message_to_stdout(f"Create release for {generic_create_release_arguments.product_name}.")
2698
2717
  folder_of_this_file = os.path.dirname(generic_create_release_arguments.current_file)
2699
2718
  build_repository_folder = GeneralUtilities.resolve_relative_path("../..", folder_of_this_file)
2700
2719
  repository_folder_name = generic_create_release_arguments.product_name
@@ -2740,8 +2759,24 @@ class TasksForCommonProjectStructure:
2740
2759
  self.commandline_arguments = commandline_arguments
2741
2760
  self.main_branch_name = "main"
2742
2761
 
2762
+ @GeneralUtilities.check_arguments
2763
+ def create_changelog_entry(self, repositoryfolder: str, message: str, commit: bool):
2764
+ current_version = self.get_version_of_project(repositoryfolder)
2765
+ changelog_file = os.path.join(repositoryfolder, "Other", "Resources", "Changelog", f"v{current_version}.md")
2766
+ if os.path.isdir(changelog_file):
2767
+ raise ValueError(f"Changelogfile {changelog_file} already exists.")
2768
+ else:
2769
+ GeneralUtilities.ensure_file_exists(changelog_file)
2770
+ GeneralUtilities.write_text_to_file(changelog_file, f"""# Release notes
2771
+
2772
+ ## Changes
2773
+
2774
+ - {message}
2775
+ """)
2776
+
2743
2777
  @GeneralUtilities.check_arguments
2744
2778
  def update_http_documentation(self, update_http_documentation_arguments: UpdateHTTPDocumentationArguments):
2779
+ GeneralUtilities.write_message_to_stdout(f"Update HTTP-documentation for for {update_http_documentation_arguments.product_name}.")
2745
2780
  folder_of_this_file = str(os.path.dirname(update_http_documentation_arguments.current_file))
2746
2781
 
2747
2782
  ref_repo = GeneralUtilities.resolve_relative_path(f"../../Submodules/{update_http_documentation_arguments.reference_repository_name}", folder_of_this_file)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ScriptCollection
3
- Version: 3.5.30
3
+ Version: 3.5.32
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
@@ -22,26 +22,26 @@ Classifier: Topic :: Terminals
22
22
  Classifier: Topic :: Utilities
23
23
  Requires-Python: >=3.10
24
24
  Description-Content-Type: text/markdown
25
- Requires-Dist: build >=1.2.2.post1
26
- Requires-Dist: coverage >=7.6.4
27
- Requires-Dist: cyclonedx-bom >=5.1.1
28
- Requires-Dist: defusedxml >=0.7.1
29
- Requires-Dist: keyboard >=0.13.5
30
- Requires-Dist: lcov-cobertura >=2.0.2
31
- Requires-Dist: lxml >=5.3.0
32
- Requires-Dist: ntplib >=0.4.0
33
- Requires-Dist: Pillow >=11.0.0
34
- Requires-Dist: pycdlib >=1.14.0
35
- Requires-Dist: Pygments >=2.18.0
36
- Requires-Dist: pylint >=3.3.1
37
- Requires-Dist: pyOpenSSL >=24.2.1
38
- Requires-Dist: PyPDF2 >=3.0.1
39
- Requires-Dist: pytest >=8.3.3
40
- Requires-Dist: PyYAML >=6.0.2
41
- Requires-Dist: qrcode >=8.0
42
- Requires-Dist: send2trash >=1.8.3
43
- Requires-Dist: twine >=5.1.1
44
- Requires-Dist: xmlschema >=3.4.3
25
+ Requires-Dist: build>=1.2.2.post1
26
+ Requires-Dist: coverage>=7.6.8
27
+ Requires-Dist: cyclonedx-bom>=5.1.1
28
+ Requires-Dist: defusedxml>=0.7.1
29
+ Requires-Dist: keyboard>=0.13.5
30
+ Requires-Dist: lcov-cobertura>=2.0.2
31
+ Requires-Dist: lxml>=5.3.0
32
+ Requires-Dist: ntplib>=0.4.0
33
+ Requires-Dist: Pillow>=11.0.0
34
+ Requires-Dist: pycdlib>=1.14.0
35
+ Requires-Dist: Pygments>=2.18.0
36
+ Requires-Dist: pylint>=3.3.1
37
+ Requires-Dist: pyOpenSSL>=24.2.1
38
+ Requires-Dist: PyPDF2>=3.0.1
39
+ Requires-Dist: pytest>=8.3.3
40
+ Requires-Dist: PyYAML>=6.0.2
41
+ Requires-Dist: qrcode>=8.0
42
+ Requires-Dist: send2trash>=1.8.3
43
+ Requires-Dist: twine>=5.1.1
44
+ Requires-Dist: xmlschema>=3.4.3
45
45
 
46
46
  # ScriptCollection
47
47
 
@@ -0,0 +1,16 @@
1
+ ScriptCollection/Executables.py,sha256=BORL6X7QF3_A_UzQjiH4NfKLp2cWftSs48rb99hXnUM,20819
2
+ ScriptCollection/GeneralUtilities.py,sha256=prDx6pTHFVwH4_aFBIQ843Td2su-VJ1PVx8qwRKxCAQ,35786
3
+ ScriptCollection/ProcessesRunner.py,sha256=3mu4ZxzZleQo0Op6o9EYTCFiJfb6kx5ov2YfZfT89mU,1395
4
+ ScriptCollection/ProgramRunnerBase.py,sha256=7QAjoqOz6XPmJH19F2k-Z1fFQB_uZnPFvn-T54IJcHQ,2324
5
+ ScriptCollection/ProgramRunnerEpew.py,sha256=C2Rs3YWOWWWJct7XmKphp5CF1tf0j4Fp-ljV2drLTfs,6349
6
+ ScriptCollection/ProgramRunnerPopen.py,sha256=G3LgQUVCfaq7XjBsGzalElH31Hbr0etttGR2_H87YzA,3512
7
+ ScriptCollection/RPStream.py,sha256=NRRHL3YSP3D9MuAV2jB_--0KUKCsvJGxeKnxgrRZ9kY,1545
8
+ ScriptCollection/ScriptCollectionCore.py,sha256=jOv1mqd_-5S7gpwXgoAPaMGrrcjrbqvCNPaNb2a3uek,101810
9
+ ScriptCollection/TasksForCommonProjectStructure.py,sha256=piNVRc6__qqGGhEX-vB1SuKQu3m8uaPHi_20RO0jcd4,197149
10
+ ScriptCollection/UpdateCertificates.py,sha256=Eynbgu7k9jLxApP2D_8Il77B6BFjJap6K7oTeEAZYbk,7790
11
+ ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
+ ScriptCollection-3.5.32.dist-info/METADATA,sha256=cuwsb2y18ZtOsonyOt6_101KjtNrVB2T_n0kG9KyI38,7664
13
+ ScriptCollection-3.5.32.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
14
+ ScriptCollection-3.5.32.dist-info/entry_points.txt,sha256=_O7BmQ81LdDfrj5uOhjshg9Xc-tABHQJIxDOyOGRzzI,2397
15
+ ScriptCollection-3.5.32.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
16
+ ScriptCollection-3.5.32.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.5.0)
2
+ Generator: setuptools (75.6.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -5,6 +5,7 @@ scbuildcodeunitsc = ScriptCollection.Executables:BuildCodeUnitsC
5
5
  sccalculatebitcoinblockhash = ScriptCollection.Executables:CalculateBitcoinBlockHash
6
6
  scchangefileextension = ScriptCollection.Executables:ChangeFileExtensions
7
7
  scchangehashofprogram = ScriptCollection.Executables:ChangeHashOfProgram
8
+ sccreatechangelogentry = ScriptCollection.Executables:CreateChangelogEntry
8
9
  sccreateemptyfilewithspecificsize = ScriptCollection.Executables:CreateEmptyFileWithSpecificSize
9
10
  sccreatehashofallfiles = ScriptCollection.Executables:CreateHashOfAllFiles
10
11
  sccreateisofilewithobfuscatedfiles = ScriptCollection.Executables:CreateISOFileWithObfuscatedFiles
@@ -1,16 +0,0 @@
1
- ScriptCollection/Executables.py,sha256=57f2bopoRUchbyyCZTseBk0ynEyHfXc2u4-LraxI7qg,20161
2
- ScriptCollection/GeneralUtilities.py,sha256=AElXv2NO30cTw-Qs3qVmO-YCOQ5FvBQM3RZMywuKQ_Y,35121
3
- ScriptCollection/ProcessesRunner.py,sha256=3mu4ZxzZleQo0Op6o9EYTCFiJfb6kx5ov2YfZfT89mU,1395
4
- ScriptCollection/ProgramRunnerBase.py,sha256=7QAjoqOz6XPmJH19F2k-Z1fFQB_uZnPFvn-T54IJcHQ,2324
5
- ScriptCollection/ProgramRunnerEpew.py,sha256=C2Rs3YWOWWWJct7XmKphp5CF1tf0j4Fp-ljV2drLTfs,6349
6
- ScriptCollection/ProgramRunnerPopen.py,sha256=G3LgQUVCfaq7XjBsGzalElH31Hbr0etttGR2_H87YzA,3512
7
- ScriptCollection/RPStream.py,sha256=NRRHL3YSP3D9MuAV2jB_--0KUKCsvJGxeKnxgrRZ9kY,1545
8
- ScriptCollection/ScriptCollectionCore.py,sha256=LuqrtPRjs03p3Jd34g68sZuygKm1cyRVj5moogdnOwI,101921
9
- ScriptCollection/TasksForCommonProjectStructure.py,sha256=_9GJp7C1QOQbWDcVnwvAkxpTQlCuvHMvE5yyV3irc1s,194740
10
- ScriptCollection/UpdateCertificates.py,sha256=Eynbgu7k9jLxApP2D_8Il77B6BFjJap6K7oTeEAZYbk,7790
11
- ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
- ScriptCollection-3.5.30.dist-info/METADATA,sha256=6rdPQb7iZF6B6iIjMtgYTryUTeKkzYqNnZqz_rFwSX4,7684
13
- ScriptCollection-3.5.30.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
14
- ScriptCollection-3.5.30.dist-info/entry_points.txt,sha256=yASwR6hWZ_b5d4W49YeX1htD8ngfWbwgjpfQiJdtUAU,2322
15
- ScriptCollection-3.5.30.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
16
- ScriptCollection-3.5.30.dist-info/RECORD,,