ScriptCollection 4.4.35__py3-none-any.whl → 4.4.36__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.
@@ -1,14 +1,14 @@
1
1
  import os
2
2
  import sys
3
- from subprocess import PIPE, Popen
3
+ from subprocess import DEVNULL, PIPE, Popen
4
4
  from .GeneralUtilities import GeneralUtilities
5
5
  from .ProgramRunnerBase import ProgramRunnerBase
6
6
 
7
7
 
8
8
  class ProgramRunnerPopen(ProgramRunnerBase):
9
9
 
10
- @GeneralUtilities.check_arguments
11
- def run_program_argsasarray_async_helper(self, program: str, arguments_as_array: list[str] = [], working_directory: str = None, custom_argument: object = None, interactive: bool = False, env_vars: dict = None) -> Popen:
10
+ def __get_process_start_information(self, program: str, arguments_as_array: list[str], env_vars: dict) -> tuple[list[str], dict]:
11
+ """Returns the argument-list and the environment with which the given program is started."""
12
12
  arguments_for_process = [program]
13
13
  arguments_for_process.extend(arguments_as_array)
14
14
  # "shell=True" is not allowed because it is not recommended and also something like
@@ -20,6 +20,11 @@ class ProgramRunnerPopen(ProgramRunnerBase):
20
20
  # relative to their working-directory (e.g. a leftover 'tmp/<guid>'-folder inside a codeunit-folder).
21
21
  base_environment = GeneralUtilities._internal_with_absolute_temp_folder_environment_variables(os.environ)
22
22
  env = {**base_environment, **env_vars} if env_vars is not None else base_environment
23
+ return arguments_for_process, env
24
+
25
+ @GeneralUtilities.check_arguments
26
+ def run_program_argsasarray_async_helper(self, program: str, arguments_as_array: list[str] = [], working_directory: str = None, custom_argument: object = None, interactive: bool = False, env_vars: dict = None) -> Popen:
27
+ arguments_for_process, env = self.__get_process_start_information(program, arguments_as_array, env_vars)
23
28
  try:
24
29
  if interactive:
25
30
  result = Popen(arguments_for_process, cwd=working_directory, stdout=PIPE, stderr=PIPE, shell=False, text=True, stdin=sys.stdin, env=env) # pylint: disable=consider-using-with
@@ -53,7 +58,23 @@ class ProgramRunnerPopen(ProgramRunnerBase):
53
58
 
54
59
  @GeneralUtilities.check_arguments
55
60
  def run_program_argsasarray_async(self, program: str, arguments_as_array: list[str] = [], working_directory: str = None, custom_argument: object = None, interactive: bool = False, env_vars: dict = None) -> int:
56
- return self.run_program_argsasarray_async_helper(program, arguments_as_array, working_directory, custom_argument, interactive, env_vars).pid
61
+ """Starts a program which keeps running after this function returned and returns its process-id.
62
+
63
+ The standard-output and the standard-error of the started program are discarded instead of being connected to a pipe.
64
+ A program which is started asynchronously is started to keep running, but nobody reads the pipes of such a program:
65
+ it would be stopped by the operating-system as soon as the pipe is full, and it would be terminated as soon as this
66
+ process ends and closes its end of the pipe. Both would end the program although it is supposed to outlive the caller."""
67
+ arguments_for_process, env = self.__get_process_start_information(program, arguments_as_array, env_vars)
68
+ try:
69
+ if interactive:
70
+ process = Popen(arguments_for_process, cwd=working_directory, stdout=DEVNULL, stderr=DEVNULL, shell=False, text=True, stdin=sys.stdin, env=env) # pylint: disable=consider-using-with
71
+ else:
72
+ process = Popen(arguments_for_process, cwd=working_directory, stdout=DEVNULL, stderr=DEVNULL, shell=False, text=True, env=env) # pylint: disable=consider-using-with
73
+ except FileNotFoundError as fileNotFoundError:
74
+ raise FileNotFoundError(f"Starting '{program}' in '{working_directory}' resulted in a FileNotFoundError: '{str(fileNotFoundError)}'")
75
+ except NotADirectoryError as notADirectoryError:
76
+ raise NotADirectoryError(f"Starting '{program}' in '{working_directory}' resulted in a NotADirectoryError: '{str(notADirectoryError)}'")
77
+ return process.pid
57
78
 
58
79
  @GeneralUtilities.check_arguments
59
80
  def run_program_async(self, program: str, arguments: str = "", working_directory: str = None, custom_argument: object = None, interactive: bool = False, env_vars: dict = None) -> int:
@@ -40,7 +40,7 @@ from .ProgramRunnerBase import ProgramRunnerBase
40
40
  from .ProgramRunnerPopen import ProgramRunnerPopen
41
41
  from .SCLog import SCLog, LogLevel
42
42
 
43
- version = "4.4.35"
43
+ version = "4.4.36"
44
44
  __version__ = version
45
45
 
46
46
  class VSCodeWorkspaceShellTask:
@@ -2730,8 +2730,9 @@ resolving a name requires fontconfig, which does not exist on every system ffmpe
2730
2730
  mock_loader_result = self.__try_load_mock(program, ' '.join(arguments_as_array), working_directory)
2731
2731
  if mock_loader_result[0]:
2732
2732
  return mock_loader_result[1]
2733
- process: Popen = self.__run_program_argsasarray_async_helper(program, arguments_as_array, working_directory, print_errors_as_information, log_file, timeoutInSeconds, addLogOverhead, title, log_namespace, arguments_for_log, custom_argument, interactive, env_vars)
2734
- return process.pid
2733
+ # The program-runner is used directly here (and not the helper which the synchronous functions use), because a program which
2734
+ # is started asynchronously must not be connected to the pipes of this process: it is started to outlive this call.
2735
+ return self.program_runner.run_program_argsasarray_async(program, arguments_as_array, working_directory, custom_argument, interactive, env_vars)
2735
2736
 
2736
2737
  # Return-values program_runner: Pid
2737
2738
  @GeneralUtilities.check_arguments
@@ -98,10 +98,15 @@ class TFCPS_CodeUnitSpecific_Flutter_Functions(TFCPS_CodeUnitSpecific_Base):
98
98
  elif target == "windows":
99
99
  # Windows-builds prefer a Windows-task-runner - even when building on a Windows-client - so that all builds
100
100
  # are produced uniformly in the same defined environment. See the remote-build-article in the reference. If
101
- # no runner is configured, fall back to building locally (only possible when already running on Windows)
102
- # instead of failing, so a development machine without a configured runner is not blocked.
101
+ # no runner is configured, fall back to building locally instead of failing, so a development machine
102
+ # without a configured runner is not blocked. This is the one exception to "no fallbacks": it only applies
103
+ # when this process itself already runs on Windows (a container never does, even on a Windows host, so a
104
+ # containerized build without a configured runner still fails as before) and only when the local
105
+ # prerequisites for it (flutter and the Visual-Studio-C++-toolchain "flutter build windows" needs) are
106
+ # actually available - a machine which lacks them falls through to the runner-branch below, which raises a
107
+ # clear "no runner configured"-error instead of a local build failing with a toolchain-error.
103
108
  windows_release_folder = os.path.join(src_folder, "build/windows/x64/runner/Release")
104
- if platform.system() == "Windows" and not TFCPS_RemoteBuild(self._protected_sc).has_any_runner_configured():
109
+ if platform.system() == "Windows" and not TFCPS_RemoteBuild(self._protected_sc).has_any_runner_configured() and self.__local_windows_build_prerequisites_are_available():
105
110
  self._protected_sc.log.log("No remote-build-runner is configured; building the windows-target locally "
106
111
  "instead. This build is not guaranteed to be produced in the same uniform "
107
112
  "environment as a runner-built one.", LogLevel.Warning)
@@ -197,6 +202,28 @@ class TFCPS_CodeUnitSpecific_Flutter_Functions(TFCPS_CodeUnitSpecific_Base):
197
202
  if add_readme_of_codeunit_to_package or add_license_of_repository_to_package or add_changelog_of_repository_to_package:
198
203
  self.__add_package_registry_files_to_artifacts(artifacts_folder, package_name, add_readme_of_codeunit_to_package, add_license_of_repository_to_package, add_changelog_of_repository_to_package, branch_of_published_state)
199
204
 
205
+ @GeneralUtilities.check_arguments
206
+ def __local_windows_build_prerequisites_are_available(self) -> bool:
207
+ """Whether this machine can build the windows-target of a flutter-app locally: "flutter build windows" needs
208
+ the flutter-tool itself as well as a Visual Studio installation with the "Desktop development with C++"-
209
+ workload, which is not a given on every Windows-machine that otherwise has "flutter" available. Only a
210
+ simple presence-check is done here (not a full "flutter doctor"-verification), because this only decides
211
+ whether the local-build-fallback in build() is attempted at all: an actually broken toolchain still fails
212
+ the "flutter build windows"-call below with its own, real error."""
213
+ if shutil.which("flutter") is None:
214
+ return False
215
+ # Same detection TFCPS_CodeUnitSpecific_CPP_Functions.__find_msbuild_path uses to locate MSBuild: vswhere.exe
216
+ # is installed by every Visual-Studio-installer and can report whether an installation with the C++-desktop-
217
+ # development-component exists, without having to guess a version-specific installation-path.
218
+ program_files_x86 = os.environ.get("ProgramFiles(x86)", r"C:\Program Files (x86)")
219
+ vswhere_path = os.path.join(program_files_x86, "Microsoft Visual Studio", "Installer", "vswhere.exe")
220
+ if not os.path.isfile(vswhere_path):
221
+ return False
222
+ exitcode, installation_path, _, _ = self._protected_sc.run_program_argsasarray(
223
+ vswhere_path, ["-latest", "-products", "*", "-requires", "Microsoft.VisualStudio.Component.VC.Tools.x86.x64", "-property", "installationPath"],
224
+ GeneralUtilities.get_temp_folder(), throw_exception_if_exitcode_is_not_zero=False)
225
+ return exitcode == 0 and GeneralUtilities.string_has_content(installation_path.strip())
226
+
200
227
  @GeneralUtilities.check_arguments
201
228
  def __generate_bom_for_flutter_package(self, package_name: str) -> None:
202
229
  """Generates the bill-of-materials of the codeunit from the "pubspec.lock" of its package.
@@ -134,6 +134,15 @@ class TFCPS_CodeUnit_BuildCodeUnits:
134
134
 
135
135
  self.sc.log.log(f"Start building codeunits at {GeneralUtilities.datetime_to_string_for_readable_entry(start_time,False)}. (Target environment-type: {self.target_environment_type})")
136
136
 
137
+ #ensure common cache-files are available
138
+ #git commit message cache file
139
+ cache_folder=os.path.join(self.repository,".ScriptCollection","Cache")
140
+ GeneralUtilities.ensure_directory_exists(cache_folder)
141
+ git_commit_message_cache_file=os.path.join(cache_folder,"GitCommitMessageDraft.txt")
142
+ GeneralUtilities.ensure_file_exists(git_commit_message_cache_file)
143
+ git_commit_message_cache_file=os.path.join(cache_folder,"GitCommitDescriptionDraft.txt")
144
+ GeneralUtilities.ensure_file_exists(git_commit_message_cache_file)
145
+
137
146
  self.tfcps_tools_general.ensure_required_environment_variables_are_set(self.repository)
138
147
 
139
148
  self.__run_custom_pre_codeunit_build_script()
@@ -1,8 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scriptcollection
3
- Version: 4.4.35
3
+ Version: 4.4.36
4
4
  Summary: The ScriptCollection is the place for reusable scripts.
5
5
  Author-email: Marius Göcke <marius.goecke@gmail.com>
6
+ License-Expression: GPL-3.0-only
6
7
  Project-URL: Homepage, https://github.com/anionDev/ScriptCollection
7
8
  Project-URL: Documentation, https://aniondev.github.io/ScriptCollectionReference/index.html
8
9
  Project-URL: Changelog, https://github.com/anionDev/ScriptCollection/tree/main/Other/Resources/Changelog
@@ -10,7 +11,6 @@ Keywords: package,release,build,management
10
11
  Classifier: Intended Audience :: Developers
11
12
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
12
13
  Classifier: Programming Language :: Python :: 3.11
13
- Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
14
14
  Classifier: Operating System :: POSIX :: Linux
15
15
  Classifier: Operating System :: Microsoft :: Windows :: Windows 10
16
16
  Classifier: Topic :: System :: Logging
@@ -34,7 +34,7 @@ Requires-Dist: Pillow>=11.3.0
34
34
  Requires-Dist: psutil>=7.2.2
35
35
  Requires-Dist: pycdlib>=1.20.0
36
36
  Requires-Dist: Pygments>=2.21.0
37
- Requires-Dist: pylint>=4.0.8
37
+ Requires-Dist: pylint>=4.0.9
38
38
  Requires-Dist: pyOpenSSL>=25.3.0
39
39
  Requires-Dist: PyPDF>=6.19.0
40
40
  Requires-Dist: pytest>=8.4.2
@@ -7,12 +7,12 @@ ScriptCollection/HTTPMaintenanceOverheadHelper.py,sha256=TToNtyO1XzsMbBsTBf3o0xg
7
7
  ScriptCollection/ProcessesRunner.py,sha256=Va9O-ohWoRfe4pO2gPBzc940gkM5BpP4Txcu1CmLOvg,1494
8
8
  ScriptCollection/ProgramRunnerBase.py,sha256=eZenpiIFW1dhvSVCG7cfBs5hO4_KLlOxR7oXoSxUDmk,2286
9
9
  ScriptCollection/ProgramRunnerMock.py,sha256=uTu-aFle1W_oKjeQEmuPsFPQpvo0kRf2FrRjAPIwT5Y,37
10
- ScriptCollection/ProgramRunnerPopen.py,sha256=zVD-gZY85o8wiGFcpYAGNDl-tXaKzipl1Bkhqy2ois4,4681
10
+ ScriptCollection/ProgramRunnerPopen.py,sha256=swRlWMQ3WiAkF3PTerraXU-LAAIdyvKbpW1CrQmee38,6497
11
11
  ScriptCollection/ProgramRunnerSudo.py,sha256=ot9Ib-plQ8wejR9M2XXfnx6GR-va9k8SH1gAC5kjaJ0,5123
12
12
  ScriptCollection/RepositoryDiagramGenerator.py,sha256=K_u2NW_p4ozdWD50irJEkkcDVa70TcUJpZN63TeXSLw,7092
13
13
  ScriptCollection/RepositoryHistoryAnalyzer.py,sha256=rD8eC5lMUe5MHmCBHfYft_G-N9IbvtsFGkU7EMwPjrY,5779
14
14
  ScriptCollection/SCLog.py,sha256=Fjf8Pdi63cXHGMxL_aI6A0dwGm7QIfrv3czjvpSUlaM,4705
15
- ScriptCollection/ScriptCollectionCore.py,sha256=X5dxmzYQQVWo-dbvLMbiODnmSkrc3_Ypeekfp4_3Zc8,300265
15
+ ScriptCollection/ScriptCollectionCore.py,sha256=oqRxDHa1Pd1rl9XNh5i-gRIuu_X8_vrqLVx5oIL6h6s,300376
16
16
  ScriptCollection/TestKind.py,sha256=jqLJwNvQeyea7SZf-UFzMC9pM0znv4do7FIC1xq8u9M,1672
17
17
  ScriptCollection/UnassignedVariablesCheck.py,sha256=8xNcp1D5HeOLO1a1NEerq2TsnpFhw7yzYPkaay-oisY,3804
18
18
  ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -39,7 +39,7 @@ ScriptCollection/TFCPS/SCTaskRunnerServer.py,sha256=tub8_1QBu0nWAaGnBWp2nErOW-SO
39
39
  ScriptCollection/TFCPS/TFCPS_BuildCodeUnitsHook.py,sha256=67_DQwoH5bhxxSmwtuAeoW1NOCMiLMzOy48OqlJX-KY,1744
40
40
  ScriptCollection/TFCPS/TFCPS_CodeUnitSpecific_Base.py,sha256=umUfQDErp7xFLkDnSbQMxzUWnKtcGlrZnIvFcTpfGJs,40499
41
41
  ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnit.py,sha256=Mj9t1SyRpkYZE74cLsGWYv4xB89gXL2ld-RX3xvvGdw,9835
42
- ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py,sha256=DaKH50q4_QusCdrv9RDR_HNQ1WYZP6NU7qUoP9sZcfk,50023
42
+ ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py,sha256=DOD4U0TrlUc5uqhr7VTajmuLE6C7cj_gjty8i6px_yg,50626
43
43
  ScriptCollection/TFCPS/TFCPS_CreateRelease.py,sha256=kpEmSnfzfgB4OjcCuS_X6jgW_ftcphxEnjjoLoAHTLY,6582
44
44
  ScriptCollection/TFCPS/TFCPS_Generic.py,sha256=mRBcf7XuNWOSXbZYc3NuJow18AMZ30D6Z-BtyNYfNcM,2072
45
45
  ScriptCollection/TFCPS/TFCPS_MergeToMain.py,sha256=Krt5oyGNcRAN3szsgU7LoTh8yVTOdHW-Kq7R9MDDV-Q,7673
@@ -59,7 +59,7 @@ ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationGenerate.py,sha256=
59
59
  ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationNoGenerate.py,sha256=i0zEGehj0sttxjjZtoq2KFSKp_ulxVyWp_ZgAhIY_So,241
60
60
  ScriptCollection/TFCPS/DotNet/TFCPS_CodeUnitSpecific_DotNet.py,sha256=GCFzDNAnmm40EeqOYgD_EeuEwDY58ujwJ1-Zn_naamc,61797
61
61
  ScriptCollection/TFCPS/DotNet/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
62
- ScriptCollection/TFCPS/Flutter/TFCPS_CodeUnitSpecific_Flutter.py,sha256=Gj4Akt0t_7e0dmT5qCSzz-o1TCuzPP_AtuG4gW6Vv3Q,55812
62
+ ScriptCollection/TFCPS/Flutter/TFCPS_CodeUnitSpecific_Flutter.py,sha256=R-Ldc6XaPETgwrgGqcX3sJ52bDUabusv3MFmFCHCvGY,58340
63
63
  ScriptCollection/TFCPS/Flutter/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
64
64
  ScriptCollection/TFCPS/Go/TFCPS_CodeUnitSpecific_Go.py,sha256=m4Pax-U6o5XuspLnLfnWjyQMtoC7zBDDNJW9EhLWjeE,9012
65
65
  ScriptCollection/TFCPS/Go/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -73,8 +73,8 @@ ScriptCollection/TFCPS/Rust/TFCPS_CodeUnitSpecific_Rust.py,sha256=yyjWPMHQjPLkML
73
73
  ScriptCollection/TFCPS/Rust/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
74
74
  ScriptCollection/TFCPS/TypeScript/TFCPS_CodeUnitSpecific_TypeScript.py,sha256=ILVhJHvwG5TvPBBqSvyACYb7W9QnWrJpxKgHu8IQu4g,9249
75
75
  ScriptCollection/TFCPS/TypeScript/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
76
- scriptcollection-4.4.35.dist-info/METADATA,sha256=d9CXU1ObLnRbzhZzs_T5koy9agJBD84T96yJpTA_GTc,7690
77
- scriptcollection-4.4.35.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
78
- scriptcollection-4.4.35.dist-info/entry_points.txt,sha256=GNma7tN0J59EvK71su-G1w22RnZ05bXcPrELyLx3AL0,6151
79
- scriptcollection-4.4.35.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
80
- scriptcollection-4.4.35.dist-info/RECORD,,
76
+ scriptcollection-4.4.36.dist-info/METADATA,sha256=57adtdGzdU5J1VzI3KzV9XVpbUoNLjppxnOB7PS6Kv0,7646
77
+ scriptcollection-4.4.36.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
78
+ scriptcollection-4.4.36.dist-info/entry_points.txt,sha256=GNma7tN0J59EvK71su-G1w22RnZ05bXcPrELyLx3AL0,6151
79
+ scriptcollection-4.4.36.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
80
+ scriptcollection-4.4.36.dist-info/RECORD,,