ScriptCollection 3.5.31__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.
@@ -371,3 +371,19 @@ def GenerateARC42ReferenceTemplate() -> int:
371
371
  folder = os.getcwd()
372
372
  ScriptCollectionCore().generate_arc42_reference_template(folder, args.productname, args.subfolder)
373
373
  return 0
374
+
375
+
376
+ def CreateChangelogEntry() -> int:
377
+ parser = argparse.ArgumentParser()
378
+ parser.add_argument('-f', '--repositoryfolder', required=False, default=".")
379
+ parser.add_argument('-p', '--message', required=True)
380
+ parser.add_argument('-s', '--commit', action='store_true', required=False, default=False)
381
+ args = parser.parse_args()
382
+
383
+ folder: str = None
384
+ if os.path.isabs(args.repositoryfolder):
385
+ folder = args.repositoryfolder
386
+ else:
387
+ folder = GeneralUtilities.resolve_relative_path(args.repositoryfolder, os.getcwd())
388
+ TasksForCommonProjectStructure().create_changelog_entry(folder, args.message, args.commit)
389
+ return 0
@@ -732,8 +732,7 @@ class GeneralUtilities:
732
732
 
733
733
  @staticmethod
734
734
  @check_arguments
735
- def read_csv_file(file: str, ignore_first_line: bool = False, treat_number_sign_at_begin_of_line_as_comment: bool = True, trim_values: bool = True,
736
- encoding="utf-8", ignore_empty_lines: bool = True, separator_character: str = ";", values_are_surrounded_by_quotes: bool = False) -> list[list[str]]:
735
+ def read_csv_file(file: str, ignore_first_line: bool = False, treat_number_sign_at_begin_of_line_as_comment: bool = True, trim_values: bool = True, encoding="utf-8", ignore_empty_lines: bool = True, separator_character: str = ";", values_are_surrounded_by_quotes: bool = False) -> list[list[str]]:
737
736
  lines = GeneralUtilities.read_lines_from_file(file, encoding)
738
737
 
739
738
  if ignore_first_line:
@@ -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.31"
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
@@ -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()
@@ -2272,7 +2288,7 @@ class TasksForCommonProjectStructure:
2272
2288
  changelog_folder = os.path.join(repository_folder, "Other", "Resources", "Changelog")
2273
2289
  changelog_file = os.path.join(changelog_folder, f"v{project_version}.md")
2274
2290
  if not os.path.isfile(changelog_file):
2275
- 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.")
2276
2292
 
2277
2293
  @GeneralUtilities.check_arguments
2278
2294
  def __check_whether_security_txt_exists(self, repository_folder: str) -> None:
@@ -2743,6 +2759,21 @@ class TasksForCommonProjectStructure:
2743
2759
  self.commandline_arguments = commandline_arguments
2744
2760
  self.main_branch_name = "main"
2745
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
+
2746
2777
  @GeneralUtilities.check_arguments
2747
2778
  def update_http_documentation(self, update_http_documentation_arguments: UpdateHTTPDocumentationArguments):
2748
2779
  GeneralUtilities.write_message_to_stdout(f"Update HTTP-documentation for for {update_http_documentation_arguments.product_name}.")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ScriptCollection
3
- Version: 3.5.31
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.7
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=6tMhEThExEJse33i7HgfJEvRqndNkSOzoXDQA8lUfHw,35809
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=OYVN6uOsQgwVk4CCGwNZPiuqblf7zaXLrO_G2Vq57ic,101921
9
- ScriptCollection/TasksForCommonProjectStructure.py,sha256=lrypLs_dF5a0CCKinMwZhbg0LxJkVHxlmqJF4B6I31U,195223
10
- ScriptCollection/UpdateCertificates.py,sha256=Eynbgu7k9jLxApP2D_8Il77B6BFjJap6K7oTeEAZYbk,7790
11
- ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
- ScriptCollection-3.5.31.dist-info/METADATA,sha256=AmndyxGsXVmE1zsut5NOoZyk1sMChMoqGdcXiP6wA0w,7684
13
- ScriptCollection-3.5.31.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
14
- ScriptCollection-3.5.31.dist-info/entry_points.txt,sha256=yASwR6hWZ_b5d4W49YeX1htD8ngfWbwgjpfQiJdtUAU,2322
15
- ScriptCollection-3.5.31.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
16
- ScriptCollection-3.5.31.dist-info/RECORD,,