ScriptCollection 3.5.24__py3-none-any.whl → 3.5.26__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.
@@ -271,8 +271,9 @@ def BuildCodeUnits() -> int:
271
271
  parser.add_argument('--verbosity', required=False, default=1)
272
272
  parser.add_argument('--targetenvironment', required=False, default="QualityCheck")
273
273
  parser.add_argument('--additionalargumentsfile', required=False, default=None)
274
+ parser.add_argument('--removeuncommittedfiles', required=False, default=False, action='store_true')
274
275
  args = parser.parse_args()
275
- TasksForCommonProjectStructure().build_codeunits(args.repositoryfolder, int(args.verbosity), args.targetenvironment, args.additionalargumentsfile, False, None, sys.argv)
276
+ TasksForCommonProjectStructure().build_codeunits(args.repositoryfolder, int(args.verbosity), args.targetenvironment, args.additionalargumentsfile, False, None, sys.argv, args.removeuncommittedfiles)
276
277
  return 0
277
278
 
278
279
 
@@ -4,6 +4,7 @@ import json
4
4
  import binascii
5
5
  import filecmp
6
6
  import hashlib
7
+ import multiprocessing
7
8
  import time
8
9
  from io import BytesIO
9
10
  import itertools
@@ -30,7 +31,7 @@ from .ProgramRunnerBase import ProgramRunnerBase
30
31
  from .ProgramRunnerPopen import ProgramRunnerPopen
31
32
  from .ProgramRunnerEpew import ProgramRunnerEpew, CustomEpewArgument
32
33
 
33
- version = "3.5.24"
34
+ version = "3.5.26"
34
35
  __version__ = version
35
36
 
36
37
 
@@ -1072,7 +1073,7 @@ class ScriptCollectionCore:
1072
1073
  @GeneralUtilities.check_arguments
1073
1074
  def get_docker_debian_version(self, image_tag: str) -> str:
1074
1075
  result = ScriptCollectionCore().run_program_argsasarray("docker", ['run', f'debian:{image_tag}', 'bash', '-c', 'apt-get -y update && apt-get -y install lsb-release && lsb_release -cs'])
1075
- result_line = GeneralUtilities.string_to_lines(result[1])[-2]
1076
+ result_line = GeneralUtilities.string_to_lines(result[1])[-1]
1076
1077
  return result_line
1077
1078
 
1078
1079
  @GeneralUtilities.check_arguments
@@ -1870,3 +1871,17 @@ TXDX
1870
1871
  - [QualityCheck-system](TXDX)
1871
1872
 
1872
1873
  """)
1874
+
1875
+ @GeneralUtilities.check_arguments
1876
+ def run_with_timeout(self, method, timeout_in_seconds: float) -> bool:
1877
+ # Returns true if the method was terminated due to a timeout
1878
+ # Returns false if the method terminates in the given time
1879
+ p = multiprocessing.Process(target=method)
1880
+ p.start()
1881
+ p.join(timeout_in_seconds)
1882
+ if p.is_alive():
1883
+ p.kill()
1884
+ p.join()
1885
+ return True
1886
+ else:
1887
+ return False
@@ -990,7 +990,7 @@ class TasksForCommonProjectStructure:
990
990
  target_folder_base = os.path.join(information.artifacts_folder, information.projectname, project_version)
991
991
  GeneralUtilities.ensure_directory_exists(target_folder_base)
992
992
 
993
- self.build_codeunits(information.repository, information.verbosity, information.target_environmenttype_for_productive, information.additional_arguments_file, False, information.export_target)
993
+ self.build_codeunits(information.repository, information.verbosity, information.target_environmenttype_for_productive, information.additional_arguments_file, False, information.export_target, [], True)
994
994
 
995
995
  reference_folder = os.path.join(information.reference_repository, "ReferenceContent")
996
996
 
@@ -1199,7 +1199,7 @@ class TasksForCommonProjectStructure:
1199
1199
  raise ValueError(f"Can not merge because the source-branch and the target-branch are on the same commit (commit-id: {src_branch_commit_id})")
1200
1200
 
1201
1201
  self.__sc.git_checkout(repository_folder, source_branch)
1202
- self.build_codeunits(repository_folder, verbosity, "QualityCheck", additional_arguments_file, True, None)
1202
+ self.build_codeunits(repository_folder, verbosity, "QualityCheck", additional_arguments_file, True, None, [], True)
1203
1203
  self.__sc.git_merge(repository_folder, source_branch, target_branch, False, False, None)
1204
1204
  self.__sc.git_commit(repository_folder, f'Merge branch {source_branch} into {target_branch}', stage_all_changes=True, no_changes_behavior=1)
1205
1205
  self.__sc.git_checkout(repository_folder, target_branch)
@@ -1258,7 +1258,7 @@ class TasksForCommonProjectStructure:
1258
1258
  self.__sc.run_program("git", "clean -dfx", information.repository, verbosity=information.verbosity, throw_exception_if_exitcode_is_not_zero=True)
1259
1259
  project_version = self.__sc.get_semver_version_from_gitversion(information.repository)
1260
1260
 
1261
- self.build_codeunits(information.repository, information.verbosity, information.target_environmenttype_for_qualitycheck, information.additional_arguments_file, False, information.export_target)
1261
+ self.build_codeunits(information.repository, information.verbosity, information.target_environmenttype_for_qualitycheck, information.additional_arguments_file, False, information.export_target, [], True)
1262
1262
 
1263
1263
  self.assert_no_uncommitted_changes(information.repository)
1264
1264
 
@@ -2161,7 +2161,7 @@ class TasksForCommonProjectStructure:
2161
2161
  codeunit_folder = GeneralUtilities.resolve_relative_path_from_current_working_directory(codeunit_folder)
2162
2162
  codeunit_name = os.path.basename(codeunit_folder)
2163
2163
  repository_folder = os.path.dirname(codeunit_folder)
2164
- self.build_specific_codeunits(repository_folder, [codeunit_name], verbosity, target_environmenttype, additional_arguments_file, is_pre_merge, export_target_directory, assume_dependent_codeunits_are_already_built, commandlinearguments)
2164
+ self.build_specific_codeunits(repository_folder, [codeunit_name], verbosity, target_environmenttype, additional_arguments_file, is_pre_merge, export_target_directory, assume_dependent_codeunits_are_already_built, commandlinearguments, False)
2165
2165
 
2166
2166
  @GeneralUtilities.check_arguments
2167
2167
  def build_codeunitsC(self, repository_folder: str, image: str, verbosity: int = 1, target_environmenttype: str = "QualityCheck", additional_arguments_file: str = None, commandlinearguments: list[str] = []) -> None:
@@ -2173,19 +2173,23 @@ class TasksForCommonProjectStructure:
2173
2173
  self.__sc.run_program("docker", f"run --volume {repository_folder}:/Workspace/Repository " + f"-e repositoryfolder=/Workspace/Repository -e verbosity={verbosity} -e targetenvironment={target_environmenttype} {image}", repository_folder)
2174
2174
 
2175
2175
  @GeneralUtilities.check_arguments
2176
- def build_codeunits(self, repository_folder: str, verbosity: int = 1, target_environmenttype: str = "QualityCheck", additional_arguments_file: str = None, is_pre_merge: bool = False, export_target_directory: str = None, commandline_arguments: list[str] = []) -> None:
2176
+ def build_codeunits(self, repository_folder: str, verbosity: int = 1, target_environmenttype: str = "QualityCheck", additional_arguments_file: str = None, is_pre_merge: bool = False, export_target_directory: str = None, commandline_arguments: list[str] = [], do_git_clean_when_no_changes: bool = False) -> None:
2177
2177
  self.__check_target_environmenttype(target_environmenttype)
2178
2178
  repository_folder = GeneralUtilities.resolve_relative_path_from_current_working_directory(repository_folder)
2179
2179
  codeunits = self.get_codeunits(repository_folder, False)
2180
- self.build_specific_codeunits(repository_folder, codeunits, verbosity, target_environmenttype, additional_arguments_file, is_pre_merge, export_target_directory, False, commandline_arguments)
2180
+ self.build_specific_codeunits(repository_folder, codeunits, verbosity, target_environmenttype, additional_arguments_file, is_pre_merge, export_target_directory, False, commandline_arguments, do_git_clean_when_no_changes)
2181
2181
 
2182
2182
  @GeneralUtilities.check_arguments
2183
- def build_specific_codeunits(self, repository_folder: str, codeunits: list[str], verbosity: int = 1, target_environmenttype: str = "QualityCheck", additional_arguments_file: str = None, is_pre_merge: bool = False, export_target_directory: str = None, assume_dependent_codeunits_are_already_built: bool = True, commandline_arguments: list[str] = []) -> None:
2183
+ def build_specific_codeunits(self, repository_folder: str, codeunits: list[str], verbosity: int = 1, target_environmenttype: str = "QualityCheck", additional_arguments_file: str = None, is_pre_merge: bool = False, export_target_directory: str = None, assume_dependent_codeunits_are_already_built: bool = True, commandline_arguments: list[str] = [], do_git_clean_when_no_changes: bool = False) -> None:
2184
2184
  self.__check_target_environmenttype(target_environmenttype)
2185
2185
  repository_folder = GeneralUtilities.resolve_relative_path_from_current_working_directory(repository_folder)
2186
2186
  contains_uncommitted_changes = self.__sc.git_repository_has_uncommitted_changes(repository_folder)
2187
- if is_pre_merge and contains_uncommitted_changes:
2188
- raise ValueError(f'Repository "{repository_folder}" has uncommitted changes.')
2187
+ if contains_uncommitted_changes:
2188
+ if is_pre_merge:
2189
+ raise ValueError(f'Repository "{repository_folder}" has uncommitted changes.')
2190
+ else:
2191
+ if do_git_clean_when_no_changes:
2192
+ self.__sc.run_program("git", "clean -dfx", repository_folder)
2189
2193
  subfolders = [os.path.join(repository_folder, codeunit) for codeunit in codeunits]
2190
2194
  codeunits_with_dependent_codeunits: dict[str, set[str]] = dict[str, set[str]]()
2191
2195
 
@@ -2615,7 +2619,7 @@ class TasksForCommonProjectStructure:
2615
2619
  else:
2616
2620
  GeneralUtilities.write_message_to_stdout(f"There are no dependencies to update in codeunit {codeunit}.")
2617
2621
  if updated_dependencies:
2618
- self.__sc.run_program("scbuildcodeunits", "--targetenvironment QualityCheck", repository_folder, verbosity=verbosity) # TODO set timeout
2622
+ self.__sc.run_program("scbuildcodeunits", "--targetenvironment QualityCheck --removeuncommittedfiles", repository_folder, verbosity=verbosity) # TODO set timeout
2619
2623
  self.__sc.git_commit(repository_folder, "Updated dependencies")
2620
2624
 
2621
2625
  class GenericPrepareNewReleaseArguments:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ScriptCollection
3
- Version: 3.5.24
3
+ Version: 3.5.26
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
- ScriptCollection/Executables.py,sha256=rdyVf_rWHIHeAeOngTeyohYYIimb0BqtZxUBDDpQSDQ,20028
1
+ ScriptCollection/Executables.py,sha256=57f2bopoRUchbyyCZTseBk0ynEyHfXc2u4-LraxI7qg,20161
2
2
  ScriptCollection/GeneralUtilities.py,sha256=AElXv2NO30cTw-Qs3qVmO-YCOQ5FvBQM3RZMywuKQ_Y,35121
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=n3ealK4b0pLWoqRSgdWiFDuSPbG-ZzSAedPqF2cyEOE,100571
9
- ScriptCollection/TasksForCommonProjectStructure.py,sha256=2s_oiUzfcBgKWc33kYphcqDlfdnwpYkn8oCUxKeWmhc,193504
8
+ ScriptCollection/ScriptCollectionCore.py,sha256=xpuR9YHgFS_4Q1UGzp5XgnEps6Wjz1YgeUGeVLOcNnQ,101078
9
+ ScriptCollection/TasksForCommonProjectStructure.py,sha256=sBCq3yRe-qj4RJ798MRfihyJh7QJwFebWL6zS77g2IU,193837
10
10
  ScriptCollection/UpdateCertificates.py,sha256=Eynbgu7k9jLxApP2D_8Il77B6BFjJap6K7oTeEAZYbk,7790
11
11
  ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
- ScriptCollection-3.5.24.dist-info/METADATA,sha256=CwcFBnSIeqIYzTRMSCzdMS1VQTwzqbP0013R3SPEM-M,7684
13
- ScriptCollection-3.5.24.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
14
- ScriptCollection-3.5.24.dist-info/entry_points.txt,sha256=yASwR6hWZ_b5d4W49YeX1htD8ngfWbwgjpfQiJdtUAU,2322
15
- ScriptCollection-3.5.24.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
16
- ScriptCollection-3.5.24.dist-info/RECORD,,
12
+ ScriptCollection-3.5.26.dist-info/METADATA,sha256=M-KtqbiHOThnfw35SL_aJWSOJln9cK-M9z2cb93FIyE,7684
13
+ ScriptCollection-3.5.26.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
14
+ ScriptCollection-3.5.26.dist-info/entry_points.txt,sha256=yASwR6hWZ_b5d4W49YeX1htD8ngfWbwgjpfQiJdtUAU,2322
15
+ ScriptCollection-3.5.26.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
16
+ ScriptCollection-3.5.26.dist-info/RECORD,,