ScriptCollection 3.5.36__py3-none-any.whl → 3.5.38__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.
@@ -880,3 +880,12 @@ class GeneralUtilities:
880
880
  @check_arguments
881
881
  def replace_variable_in_string(input_string: str, variable_name: str, variable_value: str) -> None:
882
882
  return input_string.replace(f"__[{variable_name}]__", variable_value)
883
+
884
+ @staticmethod
885
+ @check_arguments
886
+ def input(prompt: str, print_result: bool) -> str: # This function is a workaround for usescases like python scripts which calls input(...) using epew because then the prompt is not printed by the built-in-input-function.
887
+ GeneralUtilities.write_message_to_stdout(prompt)
888
+ result = input()
889
+ if print_result:
890
+ GeneralUtilities.write_message_to_stdout(f"Result: {print_result}")
891
+ return result
@@ -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.36"
34
+ version = "3.5.38"
35
35
  __version__ = version
36
36
 
37
37
 
@@ -1,4 +1,4 @@
1
- from datetime import datetime
1
+ from datetime import datetime, timedelta
2
2
  from graphlib import TopologicalSorter
3
3
  import os
4
4
  from pathlib import Path
@@ -1538,6 +1538,58 @@ class TasksForCommonProjectStructure:
1538
1538
  # Generate diff-report
1539
1539
  self.generate_diff_report(repository_folder, codeunit_name, codeunit_version)
1540
1540
 
1541
+ @GeneralUtilities.check_arguments
1542
+ def __suport_information_exists(self, repository_folder: str, version_of_product: str) -> bool:
1543
+ folder = os.path.join(repository_folder, "Other", "Resources", "Support")
1544
+ file = os.path.join(folder, "InformationAboutSupportedVersions.csv")
1545
+ if not os.path.isfile(file):
1546
+ return False
1547
+ entries = GeneralUtilities.read_csv_file(file, True)
1548
+ for entry in entries:
1549
+ if entry[0] == version_of_product:
1550
+ return True
1551
+ return False
1552
+
1553
+ @GeneralUtilities.check_arguments
1554
+ def get_versions(self, repository_folder: str) -> list[(str, datetime, datetime)]:
1555
+ folder = os.path.join(repository_folder, "Other", "Resources", "Support")
1556
+ file = os.path.join(folder, "InformationAboutSupportedVersions.csv")
1557
+ result: list[str] = list[(str, datetime, datetime)]()
1558
+ if not os.path.isfile(file):
1559
+ return result
1560
+ entries = GeneralUtilities.read_csv_file(file, True)
1561
+ for entry in entries:
1562
+ result.append((entry[0], GeneralUtilities.string_to_datetime(entry[1]), GeneralUtilities.string_to_datetime(entry[2])))
1563
+ return result
1564
+
1565
+ @GeneralUtilities.check_arguments
1566
+ def get_supported_versions(self, repository_folder: str, moment: datetime) -> list[(str, datetime, datetime)]:
1567
+ result: list[str] = list[(str, datetime, datetime)]()
1568
+ for entry in self.get_versions(repository_folder):
1569
+ if entry[1] <= moment and moment <= entry[2]:
1570
+ result.append(entry)
1571
+ return result
1572
+
1573
+ @GeneralUtilities.check_arguments
1574
+ def get_unsupported_versions(self, repository_folder: str, moment: datetime) -> list[(str, datetime, datetime)]:
1575
+ result: list[str] = list[(str, datetime, datetime)]()
1576
+ for entry in self.get_versions(repository_folder):
1577
+ if not (entry[1] <= moment and moment <= entry[2]):
1578
+ result.append(entry)
1579
+ return result
1580
+
1581
+ @GeneralUtilities.check_arguments
1582
+ def mark_current_version_as_supported(self, repository_folder: str, version_of_product: str, supported_from: datetime, supported_until: datetime):
1583
+ if self.__suport_information_exists(repository_folder, version_of_product):
1584
+ raise ValueError(f"Version-support for v{version_of_product} already defined.")
1585
+ folder = os.path.join(repository_folder, "Other", "Resources", "Support")
1586
+ GeneralUtilities.ensure_directory_exists(folder)
1587
+ file = os.path.join(folder, "InformationAboutSupportedVersions.csv")
1588
+ if not os.path.isfile(file):
1589
+ GeneralUtilities.ensure_file_exists(file)
1590
+ GeneralUtilities.append_line_to_file(file, "Version;SupportBegin;SupportEnd")
1591
+ GeneralUtilities.append_line_to_file(file, f"{version_of_product};{GeneralUtilities.datetime_to_string(supported_from)};{GeneralUtilities.datetime_to_string(supported_until)}")
1592
+
1541
1593
  @GeneralUtilities.check_arguments
1542
1594
  def get_codeunit_owner_name(self, codeunit_file: str) -> None:
1543
1595
  namespaces = {'cps': 'https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/tree/main/Conventions/RepositoryStructure/CommonProjectStructure',
@@ -2346,6 +2398,13 @@ class TasksForCommonProjectStructure:
2346
2398
  raise ValueError(f"{repository_folder} does not have a codeunit with name {codeunit_name}.")
2347
2399
  sorted_codeunits = self.get_sorted_codeunits(codeunits_with_dependent_codeunits)
2348
2400
  project_version = self.get_version_of_project(repository_folder)
2401
+
2402
+ now = datetime.now()
2403
+ if not self.__suport_information_exists(repository_folder, project_version):
2404
+ support_time = timedelta(days=365*2*31) # TODO make this configurable
2405
+ until = now + support_time
2406
+ self.mark_current_version_as_supported(repository_folder, project_version, now, until)
2407
+
2349
2408
  if len(sorted_codeunits) == 0:
2350
2409
  raise ValueError(f'No codeunit found in subfolders of "{repository_folder}".')
2351
2410
  else:
@@ -2787,6 +2846,7 @@ class TasksForCommonProjectStructure:
2787
2846
  build_repository_folder = GeneralUtilities.resolve_relative_path("../..", folder_of_this_file)
2788
2847
 
2789
2848
  repository_folder = GeneralUtilities.resolve_relative_path(f"../../Submodules/{generic_prepare_new_release_arguments.product_name}", folder_of_this_file)
2849
+ reference_folder = GeneralUtilities.resolve_relative_path(f"../../Submodules/{generic_prepare_new_release_arguments.product_name}Reference", folder_of_this_file)
2790
2850
  verbosity: int = TasksForCommonProjectStructure.get_verbosity_from_commandline_arguments(generic_prepare_new_release_arguments.commandline_arguments, 1)
2791
2851
 
2792
2852
  merge_source_branch = "other/next-release" # TODO make this configurable
@@ -2794,13 +2854,21 @@ class TasksForCommonProjectStructure:
2794
2854
 
2795
2855
  # prepare
2796
2856
  self.assert_no_uncommitted_changes(repository_folder)
2857
+ self.assert_no_uncommitted_changes(reference_folder)
2797
2858
  self.__sc.git_checkout(repository_folder, merge_source_branch)
2798
2859
  self.assert_no_uncommitted_changes(repository_folder)
2860
+ self.assert_no_uncommitted_changes(reference_folder)
2799
2861
 
2800
2862
  if "--dependencyupdate" in generic_prepare_new_release_arguments.commandline_arguments:
2801
2863
  self.generic_update_dependencies(repository_folder)
2802
2864
  self.assert_no_uncommitted_changes(repository_folder)
2803
2865
 
2866
+ now = datetime.now()
2867
+ for unsupported_version in self.get_unsupported_versions(repository_folder, now):
2868
+ reference_folder = f"{reference_folder}/ReferenceContent/v{unsupported_version}"
2869
+ GeneralUtilities.ensure_directory_does_not_exist(reference_folder)
2870
+ self.__sc.git_commit(reference_folder, "Removed reference of outdated versions.")
2871
+
2804
2872
  merge_source_branch_commit_id = self.__sc.git_get_commit_id(repository_folder, merge_source_branch)
2805
2873
  main_branch_commit_id = self.__sc.git_get_commit_id(repository_folder, main_branch)
2806
2874
  if merge_source_branch_commit_id == main_branch_commit_id:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ScriptCollection
3
- Version: 3.5.36
3
+ Version: 3.5.38
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
@@ -33,7 +33,7 @@ Requires-Dist: ntplib>=0.4.0
33
33
  Requires-Dist: Pillow>=11.0.0
34
34
  Requires-Dist: pycdlib>=1.14.0
35
35
  Requires-Dist: Pygments>=2.18.0
36
- Requires-Dist: pylint>=3.3.2
36
+ Requires-Dist: pylint>=3.3.3
37
37
  Requires-Dist: pyOpenSSL>=24.3.0
38
38
  Requires-Dist: PyPDF2>=3.0.1
39
39
  Requires-Dist: pytest>=8.3.4
@@ -1,16 +1,16 @@
1
1
  ScriptCollection/Executables.py,sha256=ls3wGZpt48YwwtO0QGWWyIImSE87SyzbL-WxhpwQJug,20837
2
- ScriptCollection/GeneralUtilities.py,sha256=d_K9pI4hHF8Ha7gnt8N9CQnElrUhHpqyXL7p_6lQ4Nc,36386
2
+ ScriptCollection/GeneralUtilities.py,sha256=T7nOrV6MJyLi603Xb83lF3_DuIZWKJudcY5HG7y3Cp0,36871
3
3
  ScriptCollection/ProcessesRunner.py,sha256=3mu4ZxzZleQo0Op6o9EYTCFiJfb6kx5ov2YfZfT89mU,1395
4
4
  ScriptCollection/ProgramRunnerBase.py,sha256=7QAjoqOz6XPmJH19F2k-Z1fFQB_uZnPFvn-T54IJcHQ,2324
5
5
  ScriptCollection/ProgramRunnerEpew.py,sha256=C2Rs3YWOWWWJct7XmKphp5CF1tf0j4Fp-ljV2drLTfs,6349
6
6
  ScriptCollection/ProgramRunnerPopen.py,sha256=G3LgQUVCfaq7XjBsGzalElH31Hbr0etttGR2_H87YzA,3512
7
7
  ScriptCollection/RPStream.py,sha256=NRRHL3YSP3D9MuAV2jB_--0KUKCsvJGxeKnxgrRZ9kY,1545
8
- ScriptCollection/ScriptCollectionCore.py,sha256=8lOqtv7HFQoTI8eLaait1nPDMuzeyfKs8Jxtj_g4SSY,102878
9
- ScriptCollection/TasksForCommonProjectStructure.py,sha256=JCk-itC1ScDot4yxKPvV6yYEwXhSCJIv838pIB-LgjY,203571
8
+ ScriptCollection/ScriptCollectionCore.py,sha256=s3F9FJCsoRkFo99a0o9SiG8W2eNh5pbeTfKCBhdwugI,102878
9
+ ScriptCollection/TasksForCommonProjectStructure.py,sha256=niMk1lor857i23agOqA1D2t7H997a_cSwOUwzPA3NgQ,207535
10
10
  ScriptCollection/UpdateCertificates.py,sha256=Eynbgu7k9jLxApP2D_8Il77B6BFjJap6K7oTeEAZYbk,7790
11
11
  ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
- ScriptCollection-3.5.36.dist-info/METADATA,sha256=Nh-xxH6RDbRA1s5t9Hj1a2-pjLREoPNeAqQrbSNDIzw,7664
13
- ScriptCollection-3.5.36.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
14
- ScriptCollection-3.5.36.dist-info/entry_points.txt,sha256=_O7BmQ81LdDfrj5uOhjshg9Xc-tABHQJIxDOyOGRzzI,2397
15
- ScriptCollection-3.5.36.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
16
- ScriptCollection-3.5.36.dist-info/RECORD,,
12
+ ScriptCollection-3.5.38.dist-info/METADATA,sha256=4by0GF3Tw8kad6E8YqT3wypaAWB6K9WSNqCVvAY2_L4,7664
13
+ ScriptCollection-3.5.38.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
14
+ ScriptCollection-3.5.38.dist-info/entry_points.txt,sha256=_O7BmQ81LdDfrj5uOhjshg9Xc-tABHQJIxDOyOGRzzI,2397
15
+ ScriptCollection-3.5.38.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
16
+ ScriptCollection-3.5.38.dist-info/RECORD,,