ScriptCollection 4.2.127__py3-none-any.whl → 4.2.129__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.
@@ -38,7 +38,7 @@ from .ProgramRunnerBase import ProgramRunnerBase
38
38
  from .ProgramRunnerPopen import ProgramRunnerPopen
39
39
  from .SCLog import SCLog, LogLevel
40
40
 
41
- version = "4.2.127"
41
+ version = "4.2.129"
42
42
  __version__ = version
43
43
 
44
44
  class VSCodeWorkspaceShellTask:
@@ -997,9 +997,9 @@ class ScriptCollectionCore:
997
997
  @GeneralUtilities.check_arguments
998
998
  def assert_no_uncommitted_changes(self, repository_folder: str,custom_message:str=None) -> None:
999
999
  if self.git_repository_has_uncommitted_changes(repository_folder):
1000
- status_result = self.run_program("git", "status --porcelain=v1", repository_folder, throw_exception_if_exitcode_is_not_zero=False)
1000
+ diff_result = self.run_program("git", "diff HEAD", repository_folder, throw_exception_if_exitcode_is_not_zero=False)
1001
1001
  GeneralUtilities.write_message_to_stderr(f"Uncommitted changes in '{repository_folder}':")
1002
- GeneralUtilities.write_message_to_stderr(status_result[1])
1002
+ GeneralUtilities.write_message_to_stderr(diff_result[1])
1003
1003
  if custom_message:
1004
1004
  raise ValueError(f"Repository '{repository_folder}' has uncommitted changes: "+custom_message)
1005
1005
  else:
@@ -2221,9 +2221,10 @@ class ScriptCollectionCore:
2221
2221
 
2222
2222
  @GeneralUtilities.check_arguments
2223
2223
  def get_version_from_gitversion(self, folder: str, variable: str) -> str:
2224
+ # /nofetch and /nonormalize: avoid network calls / branch normalization (no auth, no DNS, deterministic in containers and offline).
2224
2225
  # called twice as workaround for issue 1877 in gitversion ( https://github.com/GitTools/GitVersion/issues/1877 )
2225
- result = self.run_program_argsasarray("gitversion", ["/showVariable", variable], folder)
2226
- result = self.run_program_argsasarray("gitversion", ["/showVariable", variable], folder)
2226
+ result = self.run_program_argsasarray("gitversion", ["/nofetch", "/nonormalize", "/showVariable", variable], folder)
2227
+ result = self.run_program_argsasarray("gitversion", ["/nofetch", "/nonormalize", "/showVariable", variable], folder)
2227
2228
  result = GeneralUtilities.strip_new_line_character(result[1])
2228
2229
 
2229
2230
  return result
@@ -358,11 +358,14 @@ class TFCPS_CodeUnitSpecific_Base(ABC):
358
358
  history_folder = f"{codeunitname}/Other/Resources/TestCoverageHistory"
359
359
  history_folder_full = os.path.join(repository_folder, history_folder)
360
360
  GeneralUtilities.ensure_directory_exists(history_folder_full)
361
+ files_before = set(GeneralUtilities.get_direct_files_of_folder(history_folder_full))
361
362
  history_argument = f" -historydir:{history_folder}"
362
363
  argument = f"-reports:{codeunitname}/Other/Artifacts/TestCoverage/TestCoverage.xml -targetdir:{codeunitname}/Other/Artifacts/TestCoverageReport --verbosity:{verbose_argument_for_reportgenerator}{history_argument} -title:{codeunitname} -tag:v{codeunit_version}"
363
364
  self._protected_sc.run_program("reportgenerator", argument, repository_folder)
364
365
  if not add_testcoverage_history_entry:
365
- os.remove(GeneralUtilities.get_direct_files_of_folder(history_folder_full)[-1])
366
+ files_after = set(GeneralUtilities.get_direct_files_of_folder(history_folder_full))
367
+ for new_file in files_after - files_before:
368
+ GeneralUtilities.ensure_file_does_not_exist(new_file)
366
369
 
367
370
  # Generating badges
368
371
  if generate_badges:
@@ -117,11 +117,11 @@ class TFCPS_Tools_General:
117
117
  self.ensure_androidappbundletool_is_available(self.__sc.get_global_cache_folder(), enforce_update)
118
118
 
119
119
  @GeneralUtilities.check_arguments
120
- def ensure_file_from_github_assets_is_available_with_retry(self, githubuser: str, githubprojectname: str, local_resource_name: str, local_filename: str, get_filename_on_github, amount_of_attempts: int = 5,enforce_update:bool=False) -> str:
121
- return GeneralUtilities.retry_action(lambda: self.ensure_file_from_github_assets_is_available(githubuser, githubprojectname, local_resource_name, local_filename, get_filename_on_github,enforce_update), amount_of_attempts)
120
+ def ensure_file_from_github_assets_is_available_with_retry(self, githubuser: str, githubprojectname: str, local_resource_name: str, local_filename: str, get_filename_on_github, amount_of_attempts: int = 5,enforce_update:bool=False,pinned_version:str=None) -> str:
121
+ return GeneralUtilities.retry_action(lambda: self.ensure_file_from_github_assets_is_available(githubuser, githubprojectname, local_resource_name, local_filename, get_filename_on_github,enforce_update,pinned_version), amount_of_attempts)
122
122
 
123
123
  @GeneralUtilities.check_arguments
124
- def ensure_file_from_github_assets_is_available(self,githubuser: str, githubprojectname: str, local_resource_name: str, local_filename: str, get_filename_on_github,enforce_update:bool) -> str:
124
+ def ensure_file_from_github_assets_is_available(self,githubuser: str, githubprojectname: str, local_resource_name: str, local_filename: str, get_filename_on_github,enforce_update:bool,pinned_version:str=None) -> str:
125
125
  #TODO use or remove target_folder-parameter
126
126
  resource_folder =os.path.join( self.__sc.get_global_cache_folder(),"Tools",local_resource_name)
127
127
  file = f"{resource_folder}/{local_filename}"
@@ -135,14 +135,18 @@ class TFCPS_Tools_General:
135
135
  GeneralUtilities.ensure_directory_exists(resource_folder)
136
136
  headers = { 'User-Agent': 'Mozilla/5.0'}
137
137
  self.__add_github_api_key_if_available(headers)
138
- url = f"https://api.github.com/repos/{githubuser}/{githubprojectname}/releases/latest"
139
- self.__sc.log.log(f"Download \"{url}\"...", LogLevel.Debug)
140
- time.sleep(2)
141
- response = requests.get(url, headers=headers, allow_redirects=True, timeout=(10, 10))
142
- response_json=response.json()
143
- latest_version = response_json["tag_name"]
144
- filename_on_github = get_filename_on_github(latest_version)
145
- link = f"https://github.com/{githubuser}/{githubprojectname}/releases/download/{latest_version}/{filename_on_github}"
138
+ if pinned_version is not None:
139
+ version_to_download = pinned_version
140
+ self.__sc.log.log(f"Using pinned version '{version_to_download}' for {local_resource_name}.", LogLevel.Debug)
141
+ else:
142
+ url = f"https://api.github.com/repos/{githubuser}/{githubprojectname}/releases/latest"
143
+ self.__sc.log.log(f"Download \"{url}\"...", LogLevel.Debug)
144
+ time.sleep(2)
145
+ response = requests.get(url, headers=headers, allow_redirects=True, timeout=(10, 10))
146
+ response_json=response.json()
147
+ version_to_download = response_json["tag_name"]
148
+ filename_on_github = get_filename_on_github(version_to_download)
149
+ link = f"https://github.com/{githubuser}/{githubprojectname}/releases/download/{version_to_download}/{filename_on_github}"
146
150
  time.sleep(2)
147
151
  with requests.get(link, headers=headers, stream=True, allow_redirects=True, timeout=(5, 600)) as r:
148
152
  r.raise_for_status()
@@ -594,20 +598,25 @@ class TFCPS_Tools_General:
594
598
  def generate_svg_files_from_plantuml_files_for_repository(self, repository_folder: str,use_cache:bool) -> None:
595
599
  self.__sc.log.log("Generate svg-files from plantuml-files...")
596
600
  self.__sc.assert_is_git_repository(repository_folder)
597
- plantuml_jar_file=self.ensure_plantuml_is_available(not use_cache)
601
+ plantuml_jar_file=self.ensure_plantuml_is_available(not use_cache, repository_folder)
598
602
  target_folder = os.path.join(repository_folder, "Other", "Reference")
599
603
  self.__generate_svg_files_from_plantuml(target_folder, plantuml_jar_file)
600
604
 
601
605
  @GeneralUtilities.check_arguments
602
606
  def generate_svg_files_from_plantuml_files_for_codeunit(self, codeunit_folder: str,use_cache:bool) -> None:
603
607
  self.assert_is_codeunit_folder(codeunit_folder)
604
- plantuml_jar_file=self.ensure_plantuml_is_available(not use_cache)
608
+ plantuml_jar_file=self.ensure_plantuml_is_available(not use_cache, os.path.dirname(codeunit_folder))
605
609
  target_folder = os.path.join(codeunit_folder, "Other", "Reference")
606
610
  self.__generate_svg_files_from_plantuml(target_folder, plantuml_jar_file)
607
611
 
608
612
  @GeneralUtilities.check_arguments
609
- def ensure_plantuml_is_available(self,enforce_update:bool) -> str:
610
- return self.ensure_file_from_github_assets_is_available_with_retry("plantuml", "plantuml", "PlantUML", "plantuml.jar", lambda latest_version: "plantuml.jar",enforce_update=enforce_update)
613
+ def ensure_plantuml_is_available(self, enforce_update: bool, repository_folder: str = None) -> str:
614
+ pinned_version: str = None
615
+ if repository_folder is not None:
616
+ version_file = os.path.join(repository_folder, "Other", "Resources", "Dependencies", "PlantUML", "Version.txt")
617
+ if os.path.isfile(version_file):
618
+ pinned_version = GeneralUtilities.read_text_from_file(version_file).strip()
619
+ return self.ensure_file_from_github_assets_is_available_with_retry("plantuml", "plantuml", "PlantUML", "plantuml.jar", lambda latest_version: "plantuml.jar", enforce_update=enforce_update, pinned_version=pinned_version)
611
620
 
612
621
  @GeneralUtilities.check_arguments
613
622
  def __generate_svg_files_from_plantuml(self, diagrams_files_folder: str, plantuml_jar_file: str) -> None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scriptcollection
3
- Version: 4.2.127
3
+ Version: 4.2.129
4
4
  Summary: The ScriptCollection is the place for reusable scripts.
5
5
  Author-email: Marius Göcke <marius.goecke@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/anionDev/ScriptCollection
@@ -9,7 +9,7 @@ ScriptCollection/ProgramRunnerMock.py,sha256=uTu-aFle1W_oKjeQEmuPsFPQpvo0kRf2FrR
9
9
  ScriptCollection/ProgramRunnerPopen.py,sha256=8tP0xWKeRYoGlaNB3iUh4o61O-tKtcxrS7IUqtU85C4,4091
10
10
  ScriptCollection/ProgramRunnerSudo.py,sha256=4lxbUFMIWMbthM5Q_QaFjvZfAsNpKlXeqfEbiofg_DI,5109
11
11
  ScriptCollection/SCLog.py,sha256=8TRy1LeYMsPOIuWUcnUNNbO5pd-cNBS-3cn-kdzP8FU,4768
12
- ScriptCollection/ScriptCollectionCore.py,sha256=qwYM3QCup1AbrVCahrGL-3y1fgESJQw-b6BLjcQncms,206304
12
+ ScriptCollection/ScriptCollectionCore.py,sha256=o1hV5jRYHVu_m44zKs19R9Jfin-xBTckFzMIh7UTvAA,206484
13
13
  ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  ScriptCollection/OCIImages/AbstractImageHandler.py,sha256=o129UYDtLymCRjMZBP9Puaj19ueMHoNt6UTLspfnaRc,1758
15
15
  ScriptCollection/OCIImages/OCIImageManager.py,sha256=en97kK75sc7ZJOkX7VE_ZwycfasTBAQQCSQdPIYC91s,12451
@@ -24,7 +24,7 @@ ScriptCollection/OCIImages/ConcreteImageHandlers/__init__.py,sha256=47DEQpj8HBSa
24
24
  ScriptCollection/Resources/CultureChooser/CultureChooser.js,sha256=5-4pwGDq5j1UnpTZy850ZMoxlM9tYPeu781QpZBtCWM,951
25
25
  ScriptCollection/Resources/CultureChooser/index.html,sha256=gxQzbrSp4WU52TqN-gcBEtz2gJXmmM14OwTSFtFVRvw,276
26
26
  ScriptCollection/Resources/MaintenanceSite/MaintenanceSite.html,sha256=CX9S1bdOz6xU2aGfr03tJRGczQrlpn-IeODc15d5kc0,232
27
- ScriptCollection/TFCPS/TFCPS_CodeUnitSpecific_Base.py,sha256=he_UT4-WeHMjoMghwFVBfAHFeV_kNzALhGCvi5kTqTU,28649
27
+ ScriptCollection/TFCPS/TFCPS_CodeUnitSpecific_Base.py,sha256=CvqSHXTzQ4JA5pUym8Cu_1ed_p_p41y-buyn3rBPeqU,28875
28
28
  ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnit.py,sha256=wLOCoMJVkhqKilJrYA_8KYesh68oUPQQnGwhxBSwZbA,9217
29
29
  ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py,sha256=884wbxBvYIIqx-5pT0AMDZXYodWuLBETEpvSX-ci5lk,19774
30
30
  ScriptCollection/TFCPS/TFCPS_CreateRelease.py,sha256=yqGstRjRfVVGbqrcBgtYStqth2x2SvBb3y2Ht8GsuMQ,6554
@@ -32,7 +32,7 @@ ScriptCollection/TFCPS/TFCPS_Generic.py,sha256=Tpzgiz6m3-cYCkObZOG5Uu7oM-EMoWFzz
32
32
  ScriptCollection/TFCPS/TFCPS_MergeToMain.py,sha256=Vwj7IWmvwIICXiv7I-c6MkxbqlRWCEwzaKW6dgEUjCM,7480
33
33
  ScriptCollection/TFCPS/TFCPS_MergeToStable.py,sha256=m8YGyt3w31U2izXm-DsM2tHjJfXTsceSCu_VjfCilxA,22225
34
34
  ScriptCollection/TFCPS/TFCPS_PreBuildCodeunitsScript.py,sha256=f0Uq1cA_4LvmL72cal0crrbKF6PcxL13D9wBKuQ1YBw,2328
35
- ScriptCollection/TFCPS/TFCPS_Tools_General.py,sha256=j0erTZMbLKj50pXOEAxkqi9fXEWN3o6YwhLJdfCki2o,107454
35
+ ScriptCollection/TFCPS/TFCPS_Tools_General.py,sha256=949bvmKc3fddp9HQEnnzu15_rD85bBRaYKzPS0Ppaps,108252
36
36
  ScriptCollection/TFCPS/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
37
  ScriptCollection/TFCPS/Docker/TFCPS_CodeUnitSpecific_Docker.py,sha256=wS2yzYUmJ4m0cf6cBYVTHsiXSXfYhHoLFFy8x6yEQvY,19573
38
38
  ScriptCollection/TFCPS/Docker/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -53,8 +53,8 @@ ScriptCollection/TFCPS/Python/TFCPS_CodeUnitSpecific_Python.py,sha256=fqGhXNx8tK
53
53
  ScriptCollection/TFCPS/Python/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
54
54
  ScriptCollection/TFCPS/Rust/TFCPS_CodeUnitSpecific_Rust.py,sha256=WhOsMpJxNGqnQGA3nJ99ruyqymxBeJxCcpK98zJduTo,1680
55
55
  ScriptCollection/TFCPS/Rust/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
56
- scriptcollection-4.2.127.dist-info/METADATA,sha256=1Gu2bXe0YfzNa8g3k40fIC5QezUDsXv8-LNvnq-NSrc,7697
57
- scriptcollection-4.2.127.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
58
- scriptcollection-4.2.127.dist-info/entry_points.txt,sha256=ySZ09rptnBxyfpU-K62zmoUFH-0xWZUxzoPScoXubrg,5045
59
- scriptcollection-4.2.127.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
60
- scriptcollection-4.2.127.dist-info/RECORD,,
56
+ scriptcollection-4.2.129.dist-info/METADATA,sha256=8xUMclwCZf5951kP6Upod8NK8i3ZVss2Ls-7YCrSK8g,7697
57
+ scriptcollection-4.2.129.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
58
+ scriptcollection-4.2.129.dist-info/entry_points.txt,sha256=ySZ09rptnBxyfpU-K62zmoUFH-0xWZUxzoPScoXubrg,5045
59
+ scriptcollection-4.2.129.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
60
+ scriptcollection-4.2.129.dist-info/RECORD,,