ScriptCollection 4.2.117__py3-none-any.whl → 4.2.118__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.
- ScriptCollection/ScriptCollectionCore.py +47 -1
- {scriptcollection-4.2.117.dist-info → scriptcollection-4.2.118.dist-info}/METADATA +1 -1
- {scriptcollection-4.2.117.dist-info → scriptcollection-4.2.118.dist-info}/RECORD +6 -6
- {scriptcollection-4.2.117.dist-info → scriptcollection-4.2.118.dist-info}/WHEEL +0 -0
- {scriptcollection-4.2.117.dist-info → scriptcollection-4.2.118.dist-info}/entry_points.txt +0 -0
- {scriptcollection-4.2.117.dist-info → scriptcollection-4.2.118.dist-info}/top_level.txt +0 -0
|
@@ -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.
|
|
41
|
+
version = "4.2.118"
|
|
42
42
|
__version__ = version
|
|
43
43
|
|
|
44
44
|
class VSCodeWorkspaceShellTask:
|
|
@@ -3010,6 +3010,12 @@ OCR-content:
|
|
|
3010
3010
|
if os.path.isfile(os.path.join(example_folder,"Parameters.env")):
|
|
3011
3011
|
argument=argument+" --env-file Parameters.env"
|
|
3012
3012
|
argument=argument+" up --detach"
|
|
3013
|
+
if in_build_container:
|
|
3014
|
+
# In a DooD-setup the test-service-containers are siblings on the docker-daemon and resolve their bind-mount-sources against the DAEMON's
|
|
3015
|
+
# filesystem, not against this build-container's filesystem. Clearing the source-folders from within this build-container (as the *Start.py-
|
|
3016
|
+
# scripts do) therefore does not reset what the containers actually mount. Reset them daemon-side first so that e.g. a database starts on a
|
|
3017
|
+
# clean data-directory instead of stale content (which could otherwise keep an outdated pg_hba.conf and reject the build-container's connection).
|
|
3018
|
+
self.__reset_compose_bind_mounted_volumes_daemon_side(docker_compose_file, example_folder, title.lower())
|
|
3013
3019
|
try:
|
|
3014
3020
|
self.run_program("docker", argument, example_folder, title=title,print_live_output=True)
|
|
3015
3021
|
finally:
|
|
@@ -3027,6 +3033,46 @@ OCR-content:
|
|
|
3027
3033
|
# start because the containers get a new IP every time.
|
|
3028
3034
|
self.__register_test_service_containers_in_etc_hosts(docker_compose_file)
|
|
3029
3035
|
|
|
3036
|
+
@GeneralUtilities.check_arguments
|
|
3037
|
+
def __reset_compose_bind_mounted_volumes_daemon_side(self, docker_compose_file: str, example_folder: str, project_name: str) -> None:
|
|
3038
|
+
# Empties the bind-mounted directories of all compose-services on the DAEMON's filesystem, i.e. exactly where the (sibling-)containers will mount
|
|
3039
|
+
# them. In a DooD-setup a bind-mount-source like "./Volumes/..." is resolved by the docker-daemon and not inside this build-container, so deleting
|
|
3040
|
+
# the folder from within this build-container does not reset what e.g. a database-container mounts (which would otherwise start on stale data, like
|
|
3041
|
+
# an outdated pg_hba.conf). The directories are emptied via a throwaway-container of the service's own image (compose resolves the image and mounts
|
|
3042
|
+
# the volumes exactly like for the real container); only the directory-content is removed, not the mount-root itself. Failures are tolerated because
|
|
3043
|
+
# a not-yet existing source-directory simply needs no clearing.
|
|
3044
|
+
env_file_arguments: list[str] = []
|
|
3045
|
+
if os.path.isfile(os.path.join(example_folder, "Parameters.env")):
|
|
3046
|
+
env_file_arguments = ["--env-file", "Parameters.env"]
|
|
3047
|
+
with open(docker_compose_file, encoding="utf-8") as stream:
|
|
3048
|
+
loaded = yaml.safe_load(stream)
|
|
3049
|
+
services = loaded.get("services", dict())
|
|
3050
|
+
for service_name, service_definition in services.items():
|
|
3051
|
+
service_definition = service_definition or dict()
|
|
3052
|
+
for volume in service_definition.get("volumes", list()):
|
|
3053
|
+
source = None
|
|
3054
|
+
target = None
|
|
3055
|
+
if isinstance(volume, str):
|
|
3056
|
+
volume_parts = volume.split(":")
|
|
3057
|
+
if 2 <= len(volume_parts):
|
|
3058
|
+
source = volume_parts[0]
|
|
3059
|
+
target = volume_parts[1]
|
|
3060
|
+
elif isinstance(volume, dict):
|
|
3061
|
+
if volume.get("type", "bind") == "bind":
|
|
3062
|
+
source = volume.get("source")
|
|
3063
|
+
target = volume.get("target")
|
|
3064
|
+
if not GeneralUtilities.string_has_content(source) or not GeneralUtilities.string_has_content(target):
|
|
3065
|
+
continue
|
|
3066
|
+
# Named volumes (a source without a path-indicator) are managed by docker itself and must not be cleared this way.
|
|
3067
|
+
if not (source.startswith(".") or source.startswith("/") or source.startswith("~")):
|
|
3068
|
+
continue
|
|
3069
|
+
# Empty the directory-content using only a POSIX-shell (no dependency on "find"/"-delete", which busybox-based images may not provide). The
|
|
3070
|
+
# three globs cover normal entries, dotfiles and double-dot-prefixed entries (but never "." or ".."); the trailing "; true" keeps the
|
|
3071
|
+
# exitcode at 0 even when a glob does not expand (already-empty directory). This works for any service-image that ships a shell (which all
|
|
3072
|
+
# real stateful images do); images without a shell (distroless/scratch) do not have a resettable bind-mounted data-directory here anyway.
|
|
3073
|
+
clear_command = f"rm -rf \"{target}\"/..?* \"{target}\"/.[!.]* \"{target}\"/* 2>/dev/null; true"
|
|
3074
|
+
self.run_program_argsasarray("docker", ["compose", "-p", project_name] + env_file_arguments + ["run", "--rm", "--no-deps", "--entrypoint", "sh", service_name, "-c", clear_command], example_folder, throw_exception_if_exitcode_is_not_zero=False)
|
|
3075
|
+
|
|
3030
3076
|
@GeneralUtilities.check_arguments
|
|
3031
3077
|
def __generate_localhost_ports_override_file(self, docker_compose_file: str) -> str:
|
|
3032
3078
|
with open(docker_compose_file, encoding="utf-8") as stream:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: scriptcollection
|
|
3
|
-
Version: 4.2.
|
|
3
|
+
Version: 4.2.118
|
|
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
|
|
@@ -15,7 +15,7 @@ ScriptCollection/ProgramRunnerMock.py,sha256=uTu-aFle1W_oKjeQEmuPsFPQpvo0kRf2FrR
|
|
|
15
15
|
ScriptCollection/ProgramRunnerPopen.py,sha256=8tP0xWKeRYoGlaNB3iUh4o61O-tKtcxrS7IUqtU85C4,4091
|
|
16
16
|
ScriptCollection/ProgramRunnerSudo.py,sha256=4lxbUFMIWMbthM5Q_QaFjvZfAsNpKlXeqfEbiofg_DI,5109
|
|
17
17
|
ScriptCollection/SCLog.py,sha256=8TRy1LeYMsPOIuWUcnUNNbO5pd-cNBS-3cn-kdzP8FU,4768
|
|
18
|
-
ScriptCollection/ScriptCollectionCore.py,sha256=
|
|
18
|
+
ScriptCollection/ScriptCollectionCore.py,sha256=U_TluWTs0RAaBfb9P2J535ouxlLUzhoxX0o0NMZzWCI,205101
|
|
19
19
|
ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
20
|
ScriptCollection/OCIImages/AbstractImageHandler.py,sha256=o129UYDtLymCRjMZBP9Puaj19ueMHoNt6UTLspfnaRc,1758
|
|
21
21
|
ScriptCollection/OCIImages/OCIImageManager.py,sha256=2muW4hJ_a7EfavY3WVnafqZ0HC87RcZsoTuNvA3c0To,11175
|
|
@@ -291,8 +291,8 @@ build/lib/build/lib/build/lib/build/lib/ScriptCollection/TFCPS/Python/TFCPS_Code
|
|
|
291
291
|
build/lib/build/lib/build/lib/build/lib/ScriptCollection/TFCPS/Python/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
292
292
|
build/lib/build/lib/build/lib/build/lib/ScriptCollection/TFCPS/Rust/TFCPS_CodeUnitSpecific_Rust.py,sha256=WhOsMpJxNGqnQGA3nJ99ruyqymxBeJxCcpK98zJduTo,1680
|
|
293
293
|
build/lib/build/lib/build/lib/build/lib/ScriptCollection/TFCPS/Rust/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
294
|
-
scriptcollection-4.2.
|
|
295
|
-
scriptcollection-4.2.
|
|
296
|
-
scriptcollection-4.2.
|
|
297
|
-
scriptcollection-4.2.
|
|
298
|
-
scriptcollection-4.2.
|
|
294
|
+
scriptcollection-4.2.118.dist-info/METADATA,sha256=TqYnvaXCsp51-firRNfJskpqy_SgVF3zBjI3rBtxVMc,7697
|
|
295
|
+
scriptcollection-4.2.118.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
296
|
+
scriptcollection-4.2.118.dist-info/entry_points.txt,sha256=_vnVTrGJc_z-DTPLvaYyyOpDEQLz0bdO2OLN3_ZmeR8,4978
|
|
297
|
+
scriptcollection-4.2.118.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
|
|
298
|
+
scriptcollection-4.2.118.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|