ScriptCollection 3.5.80__py3-none-any.whl → 3.5.82__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.
@@ -943,11 +943,21 @@ class GeneralUtilities:
943
943
  def assert_file_exists(file: str) -> str:
944
944
  GeneralUtilities.assert_condition(os.path.isfile(file), f"File '{file}' does not exist.")
945
945
 
946
+ @staticmethod
947
+ @check_arguments
948
+ def assert_file_does_not_exist(file: str) -> str:
949
+ GeneralUtilities.assert_condition(not os.path.isfile(file), f"File '{file}' exists.")
950
+
946
951
  @staticmethod
947
952
  @check_arguments
948
953
  def assert_folder_exists(folder: str) -> str:
949
954
  GeneralUtilities.assert_condition(os.path.isdir(folder), f"Folder '{folder}' does not exist.")
950
955
 
956
+ @staticmethod
957
+ @check_arguments
958
+ def assert_folder_does_not_exist(folder: str) -> str:
959
+ GeneralUtilities.assert_condition(not os.path.isdir(folder), f"Folder '{folder}' exists.")
960
+
951
961
  @staticmethod
952
962
  @check_arguments
953
963
  def retry_action(action, amount_of_attempts: int,action_name:str=None) -> None:
@@ -32,7 +32,7 @@ from .ProgramRunnerBase import ProgramRunnerBase
32
32
  from .ProgramRunnerPopen import ProgramRunnerPopen
33
33
  from .ProgramRunnerEpew import ProgramRunnerEpew, CustomEpewArgument
34
34
 
35
- version = "3.5.80"
35
+ version = "3.5.82"
36
36
  __version__ = version
37
37
 
38
38
 
@@ -1826,6 +1826,41 @@ DNS = {domain}
1826
1826
  GeneralUtilities.write_message_to_stdout(f"Update package {package_name}...")
1827
1827
  self.run_program("dotnet", f"add {csproj_filename} package {package_name}", folder,print_errors_as_information=True)
1828
1828
 
1829
+
1830
+ @GeneralUtilities.check_arguments
1831
+ def dotnet_package_is_available(self,package_name:str,package_version:str,source:str):
1832
+ default_source_address="nuget.org"
1833
+ if source==default_source_address:
1834
+ GeneralUtilities.write_message_to_stdout(f"Wait until package {package_name} v{package_version} is available on {source}.")
1835
+ headers = {'Cache-Control': 'no-cache'}
1836
+ r=requests.get(f"https://api.{default_source_address}/v3-flatcontainer/{package_name.lower()}/{package_version}/{package_name.lower()}.nuspec", timeout=5,headers=headers)
1837
+ return r.status_code==200
1838
+ else:
1839
+ raise ValueError(f"dotnet_package_is_available is not implemented yet for other sources than {default_source_address}.")
1840
+
1841
+ @GeneralUtilities.check_arguments
1842
+ def wait_until_dotnet_package_is_available(self,package_name:str,package_version:str,source:str):
1843
+ while not self.dotnet_package_is_available(package_name,package_version,source):
1844
+ time.sleep(5)
1845
+
1846
+
1847
+ @GeneralUtilities.check_arguments
1848
+ def python_package_is_available(self,package_name:str,package_version:str,source:str):
1849
+ default_source_address="pypi.org"
1850
+ if source==default_source_address:
1851
+ GeneralUtilities.write_message_to_stdout(f"Wait until package {package_name} v{package_version} is available on {source}.")
1852
+ headers = {'Cache-Control': 'no-cache'}
1853
+ r=requests.get(f"https://{default_source_address}/pypi/{package_name}/{package_version}/json", timeout=5,headers=headers)
1854
+ return r.status_code==200
1855
+ else:
1856
+ raise ValueError(f"python_package_is_available is not implemented yet for other sources than {default_source_address}.")
1857
+
1858
+ @GeneralUtilities.check_arguments
1859
+ def python_until_dotnet_package_is_available(self,package_name:str,package_version:str,source:str):
1860
+ while not self.python_package_is_available(package_name,package_version,source):
1861
+ time.sleep(5)
1862
+
1863
+
1829
1864
  @GeneralUtilities.check_arguments
1830
1865
  def create_deb_package(self, toolname: str, binary_folder: str, control_file_content: str, deb_output_folder: str, verbosity: int, permission_of_executable_file_as_octet_triple: int) -> None:
1831
1866
 
@@ -494,13 +494,13 @@ class TasksForCommonProjectStructure:
494
494
  csproj_file = os.path.join(codeunit_folder, csproj_project_name, csproj_project_name+".csproj")
495
495
  result1: tuple[bool, str] = self.__standardized_task_verify_standard_format_for_project_csproj_file(csproj_file, codeunit_folder, codeunit_name, codeunit_version)
496
496
  if not result1[0]:
497
- raise ValueError(f"{csproj_file} with content '{GeneralUtilities.read_text_from_file(csproj_file)}' does not match the standardized .csproj-file-format which is defined by the regex '{result1[1]}'.")
497
+ raise ValueError(f"'{csproj_file}' with content '{GeneralUtilities.read_text_from_file(csproj_file)}' does not match the standardized .csproj-file-format which is defined by the regex '{result1[1]}'.")
498
498
 
499
499
  test_csproj_project_name = csproj_project_name+"Tests"
500
500
  test_csproj_file = os.path.join(codeunit_folder, test_csproj_project_name, test_csproj_project_name+".csproj")
501
501
  result2: tuple[bool, str] = self.__standardized_task_verify_standard_format_for_test_csproj_file(test_csproj_file, codeunit_name, codeunit_version)
502
502
  if not result2[0]:
503
- raise ValueError(f"{test_csproj_file} with content '{GeneralUtilities.read_text_from_file(test_csproj_file)}' does not match the standardized .csproj-file-format which is defined by the regex '{result2[1]}'.")
503
+ raise ValueError(f"'{test_csproj_file}' with content '{GeneralUtilities.read_text_from_file(test_csproj_file)}' does not match the standardized .csproj-file-format which is defined by the regex '{result2[1]}'.")
504
504
 
505
505
  def __standardized_task_verify_standard_format_for_project_csproj_file(self, csproj_file: str, codeunit_folder: str, codeunit_name: str, codeunit_version: str) -> tuple[bool, str]:
506
506
  self.assert_is_codeunit_folder(codeunit_folder)
@@ -1951,6 +1951,13 @@ class TasksForCommonProjectStructure:
1951
1951
  trg_file_pfx = os.path.join(trg_folder, f"{domain}.pfx")
1952
1952
  trg_file_psw = os.path.join(trg_folder, f"{domain}.password")
1953
1953
 
1954
+ GeneralUtilities.assert_file_exists(src_file_pfx)
1955
+ GeneralUtilities.assert_file_exists(src_file_psw)
1956
+ GeneralUtilities.ensure_file_does_not_exist(trg_file_pfx)
1957
+ GeneralUtilities.ensure_file_does_not_exist(trg_file_psw)
1958
+
1959
+ GeneralUtilities.ensure_directory_exists(trg_folder)
1960
+
1954
1961
  GeneralUtilities.ensure_directory_exists(trg_folder)
1955
1962
  shutil.copyfile(src_file_pfx, trg_file_pfx)
1956
1963
  shutil.copyfile(src_file_psw, trg_file_psw)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: ScriptCollection
3
- Version: 3.5.80
3
+ Version: 3.5.82
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
@@ -1,16 +1,16 @@
1
1
  ScriptCollection/Executables.py,sha256=KAs82A9AsrpTY39Ohg1UrtZN-6e5_Ql17UbLlO0fZfA,30037
2
- ScriptCollection/GeneralUtilities.py,sha256=ShcDc8N7B_Ad9V--cbmsuirfBaUYvuhkbq9NMR03bDA,40370
2
+ ScriptCollection/GeneralUtilities.py,sha256=VVbbGFD4qLwWV211-E-n3faP2fZGc8mOBlKLd0oKHl4,40765
3
3
  ScriptCollection/ProcessesRunner.py,sha256=3mu4ZxzZleQo0Op6o9EYTCFiJfb6kx5ov2YfZfT89mU,1395
4
4
  ScriptCollection/ProgramRunnerBase.py,sha256=2kMIAqdc65UjBAddOZkzy_aFx9h5roZ5a4bQNM6RV6Y,2480
5
5
  ScriptCollection/ProgramRunnerEpew.py,sha256=4pjEd0r9Fcz3TTDv0MdTSd5KkigYXcWUVI1X43regfU,6477
6
6
  ScriptCollection/ProgramRunnerPopen.py,sha256=BPY7-ZMIlqT7JOKz8qlB5c0laF2Js-ijzqk09GxZC48,3821
7
7
  ScriptCollection/RPStream.py,sha256=NRRHL3YSP3D9MuAV2jB_--0KUKCsvJGxeKnxgrRZ9kY,1545
8
- ScriptCollection/ScriptCollectionCore.py,sha256=mmN46mmzPacTWpzVC67d04nO9SK2tCXe30TQy2DPiWM,119176
9
- ScriptCollection/TasksForCommonProjectStructure.py,sha256=5OEQbNQ-YIhQHb-8Xmh4odLB4S7iNBmXTSDm3gSKLSQ,215580
8
+ ScriptCollection/ScriptCollectionCore.py,sha256=rJhF9af5vR3NeHMjZDpjCK2Jz1FGlMHz_ZRG_gwrY-U,121187
9
+ ScriptCollection/TasksForCommonProjectStructure.py,sha256=Zq6GSGegm3PkBX-jddHH5T7IDEFAFR71AEd_b6MT4y8,215915
10
10
  ScriptCollection/UpdateCertificates.py,sha256=Eynbgu7k9jLxApP2D_8Il77B6BFjJap6K7oTeEAZYbk,7790
11
11
  ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
- ScriptCollection-3.5.80.dist-info/METADATA,sha256=qRZCy5hI6j9-cxf5mFgy5GPhT-dzbJAKSg7bwnrgOvg,7664
13
- ScriptCollection-3.5.80.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
14
- ScriptCollection-3.5.80.dist-info/entry_points.txt,sha256=1jAL5AuB8mvdw2v-6E7wCZFThurQxchiQynL8DCi-Yg,3545
15
- ScriptCollection-3.5.80.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
16
- ScriptCollection-3.5.80.dist-info/RECORD,,
12
+ ScriptCollection-3.5.82.dist-info/METADATA,sha256=Mkg8JuYED_bQbgl1qQzYnWol_sEkm7NrlYSpCYsgojs,7664
13
+ ScriptCollection-3.5.82.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
14
+ ScriptCollection-3.5.82.dist-info/entry_points.txt,sha256=1jAL5AuB8mvdw2v-6E7wCZFThurQxchiQynL8DCi-Yg,3545
15
+ ScriptCollection-3.5.82.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
16
+ ScriptCollection-3.5.82.dist-info/RECORD,,