ScriptCollection 3.5.7__py3-none-any.whl → 3.5.8__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.
@@ -29,7 +29,7 @@ from .ProgramRunnerBase import ProgramRunnerBase
29
29
  from .ProgramRunnerPopen import ProgramRunnerPopen
30
30
  from .ProgramRunnerEpew import ProgramRunnerEpew, CustomEpewArgument
31
31
 
32
- version = "3.5.7"
32
+ version = "3.5.8"
33
33
  __version__ = version
34
34
 
35
35
 
@@ -94,8 +94,7 @@ class ScriptCollectionCore:
94
94
  versiononlyregex = f"^{versionregex}$"
95
95
  pattern = re.compile(versiononlyregex)
96
96
  if pattern.match(new_version):
97
- GeneralUtilities.write_text_to_file(nuspec_file, re.sub(
98
- f"<version>{versionregex}<\\/version>", f"<version>{new_version}</version>", GeneralUtilities.read_text_from_file(nuspec_file)))
97
+ GeneralUtilities.write_text_to_file(nuspec_file, re.sub(f"<version>{versionregex}<\\/version>", f"<version>{new_version}</version>", GeneralUtilities.read_text_from_file(nuspec_file)))
99
98
  else:
100
99
  raise ValueError(
101
100
  f"Version '{new_version}' does not match version-regex '{versiononlyregex}'")
@@ -200,8 +199,7 @@ class ScriptCollectionCore:
200
199
  elif exit_code == 1:
201
200
  return False
202
201
  else:
203
- raise ValueError(
204
- f"Can not calculate if {ancestor} is an ancestor of {descendant} in repository {repository_folder}.")
202
+ raise ValueError(f"Can not calculate if {ancestor} is an ancestor of {descendant} in repository {repository_folder}.")
205
203
 
206
204
  @GeneralUtilities.check_arguments
207
205
  def __git_changes_helper(self, repository_folder: str, arguments_as_array: list[str]) -> bool:
@@ -242,8 +240,7 @@ class ScriptCollectionCore:
242
240
 
243
241
  @GeneralUtilities.check_arguments
244
242
  def git_get_commit_id(self, repository_folder: str, commit: str = "HEAD") -> str:
245
- result: tuple[int, str, str, int] = self.run_program_argsasarray(
246
- "git", ["rev-parse", "--verify", commit], repository_folder, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
243
+ result: tuple[int, str, str, int] = self.run_program_argsasarray("git", ["rev-parse", "--verify", commit], repository_folder, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
247
244
  return result[1].replace('\n', '')
248
245
 
249
246
  @GeneralUtilities.check_arguments
@@ -256,31 +253,50 @@ class ScriptCollectionCore:
256
253
 
257
254
  @GeneralUtilities.check_arguments
258
255
  def git_fetch(self, folder: str, remotename: str = "--all") -> None:
259
- self.run_program_argsasarray("git", ["fetch", remotename, "--tags", "--prune"],
260
- folder, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
256
+ self.run_program_argsasarray("git", ["fetch", remotename, "--tags", "--prune"], folder, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
261
257
 
262
258
  @GeneralUtilities.check_arguments
263
259
  def git_fetch_in_bare_repository(self, folder: str, remotename, localbranch: str, remotebranch: str) -> None:
264
- self.run_program_argsasarray("git", [
265
- "fetch", remotename, f"{remotebranch}:{localbranch}"], folder, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
260
+ self.run_program_argsasarray("git", ["fetch", remotename, f"{remotebranch}:{localbranch}"], folder, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
266
261
 
267
262
  @GeneralUtilities.check_arguments
268
263
  def git_remove_branch(self, folder: str, branchname: str) -> None:
269
- self.run_program("git", f"branch -D {branchname}", folder,
270
- throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
264
+ self.run_program("git", f"branch -D {branchname}", folder, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
271
265
 
272
266
  @GeneralUtilities.check_arguments
273
267
  def git_push(self, folder: str, remotename: str, localbranchname: str, remotebranchname: str, forcepush: bool = False, pushalltags: bool = True, verbosity: int = 0) -> None:
274
- argument = ["push", "--recurse-submodules=on-demand",
275
- remotename, f"{localbranchname}:{remotebranchname}"]
268
+ argument = ["push", "--recurse-submodules=on-demand", remotename, f"{localbranchname}:{remotebranchname}"]
276
269
  if (forcepush):
277
270
  argument.append("--force")
278
271
  if (pushalltags):
279
272
  argument.append("--tags")
280
- result: tuple[int, str, str, int] = self.run_program_argsasarray("git", argument, folder, throw_exception_if_exitcode_is_not_zero=True,
281
- verbosity=verbosity, print_errors_as_information=True)
273
+ result: tuple[int, str, str, int] = self.run_program_argsasarray("git", argument, folder, throw_exception_if_exitcode_is_not_zero=True, verbosity=verbosity, print_errors_as_information=True)
282
274
  return result[1].replace('\r', '').replace('\n', '')
283
275
 
276
+ @GeneralUtilities.check_arguments
277
+ def git_pull(self, folder: str, remote: str, localbranchname: str, remotebranchname: str) -> None:
278
+ self.run_program("git", f"pull {folder} {remote} {remotebranchname}:{localbranchname}", folder, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
279
+
280
+ @GeneralUtilities.check_arguments
281
+ def git_list_remote_branches(self, folder: str, remote: str, fetch: bool) -> list[str]:
282
+ if fetch:
283
+ self.git_fetch(folder, remote)
284
+ run_program_result = self.run_program("git", f"branch -rl {remote}/*", folder, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
285
+ output = GeneralUtilities.string_to_lines(run_program_result[1])
286
+ result = list[str]()
287
+ for item in output:
288
+ striped_item = item.strip()
289
+ if GeneralUtilities.string_has_content(striped_item):
290
+ branch: str = None
291
+ if " " in striped_item:
292
+ branch = striped_item.split(" ")[0]
293
+ else:
294
+ branch = striped_item
295
+ branchname = branch[len(remote)+1:]
296
+ if branchname != "HEAD":
297
+ result.append(branchname)
298
+ return result
299
+
284
300
  @GeneralUtilities.check_arguments
285
301
  def git_clone(self, clone_target_folder: str, remote_repository_path: str, include_submodules: bool = True, mirror: bool = False) -> None:
286
302
  if (os.path.isdir(clone_target_folder)):
@@ -292,19 +308,16 @@ class ScriptCollectionCore:
292
308
  args.append("--remote-submodules")
293
309
  if mirror:
294
310
  args.append("--mirror")
295
- self.run_program_argsasarray("git", args, os.getcwd(
296
- ), throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
311
+ self.run_program_argsasarray("git", args, os.getcwd(), throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
297
312
 
298
313
  @GeneralUtilities.check_arguments
299
314
  def git_get_all_remote_names(self, directory: str) -> list[str]:
300
- result = GeneralUtilities.string_to_lines(self.run_program_argsasarray(
301
- "git", ["remote"], directory, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)[1], False)
315
+ result = GeneralUtilities.string_to_lines(self.run_program_argsasarray("git", ["remote"], directory, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)[1], False)
302
316
  return result
303
317
 
304
318
  @GeneralUtilities.check_arguments
305
319
  def git_get_remote_url(self, directory: str, remote_name: str) -> str:
306
- result = GeneralUtilities.string_to_lines(self.run_program_argsasarray(
307
- "git", ["remote", "get-url", remote_name], directory, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)[1], False)
320
+ result = GeneralUtilities.string_to_lines(self.run_program_argsasarray("git", ["remote", "get-url", remote_name], directory, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)[1], False)
308
321
  return result[0].replace('\n', '')
309
322
 
310
323
  @GeneralUtilities.check_arguments
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ScriptCollection
3
- Version: 3.5.7
3
+ Version: 3.5.8
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
@@ -5,12 +5,12 @@ ScriptCollection/ProgramRunnerBase.py,sha256=W4MaDroJHARRtcvPkBC2AS_qgDSRIqOkMvG
5
5
  ScriptCollection/ProgramRunnerEpew.py,sha256=lx_jR3W8KavBpZo44u2FrOca_EWWgUb3_w_YKGRrAyM,6471
6
6
  ScriptCollection/ProgramRunnerPopen.py,sha256=5QFplojwfGS8_WdYrg5nE6__QFB5iaMA0EP8OGfgPoY,3526
7
7
  ScriptCollection/RPStream.py,sha256=NRRHL3YSP3D9MuAV2jB_--0KUKCsvJGxeKnxgrRZ9kY,1545
8
- ScriptCollection/ScriptCollectionCore.py,sha256=-HpxrPjlHNPv1Ud4Pxh-vH-dEJJGvw4jyI-_5xsGOKo,96539
8
+ ScriptCollection/ScriptCollectionCore.py,sha256=muGC1Xd3xbBU8ZkIocvnE4_5IJd8mfHdE2b4fwzBGB4,97508
9
9
  ScriptCollection/TasksForCommonProjectStructure.py,sha256=jExRHYZQfRJWY4NDboREI1NfYjHMvIabsKZ05qi8DoA,186707
10
10
  ScriptCollection/UpdateCertificates.py,sha256=lfmVuify-Fqq-vGJusDDUsJVhA-rVLwW2Jx9iLwmkBo,7916
11
11
  ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
- ScriptCollection-3.5.7.dist-info/METADATA,sha256=cG_gwtTzfmBIksPGZK3VGJZ0Tafat4-G1UeTuQSuyts,7679
13
- ScriptCollection-3.5.7.dist-info/WHEEL,sha256=Wyh-_nZ0DJYolHNn1_hMa4lM7uDedD_RGVwbmTjyItk,91
14
- ScriptCollection-3.5.7.dist-info/entry_points.txt,sha256=dwvB9HRGvqst5xlYIGmmwuFN7lBKhxvndmnNrQOfu8w,2153
15
- ScriptCollection-3.5.7.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
16
- ScriptCollection-3.5.7.dist-info/RECORD,,
12
+ ScriptCollection-3.5.8.dist-info/METADATA,sha256=Ek02QzQWx7ZT6xSxEDI8TvGBhUFCRdb735Xj6BjIveE,7679
13
+ ScriptCollection-3.5.8.dist-info/WHEEL,sha256=Wyh-_nZ0DJYolHNn1_hMa4lM7uDedD_RGVwbmTjyItk,91
14
+ ScriptCollection-3.5.8.dist-info/entry_points.txt,sha256=dwvB9HRGvqst5xlYIGmmwuFN7lBKhxvndmnNrQOfu8w,2153
15
+ ScriptCollection-3.5.8.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
16
+ ScriptCollection-3.5.8.dist-info/RECORD,,