ScriptCollection 4.2.137__py3-none-any.whl → 4.2.138__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.137"
41
+ version = "4.2.138"
42
42
  __version__ = version
43
43
 
44
44
  class VSCodeWorkspaceShellTask:
@@ -284,7 +284,8 @@ class TFCPS_CodeUnit_BuildCodeUnits:
284
284
  except Exception:
285
285
  image="ghcr.io/betterleaks/betterleaks:latest"
286
286
  config_file = os.path.join(self.repository, ".betterleaks.toml")
287
- if self.sc.is_running_in_build_container():
287
+ running_in_container = os.path.exists("/.dockerenv") or self.sc.is_running_in_build_container()
288
+ if running_in_container:
288
289
  # We run inside the build-container with the docker-socket forwarded to the host-daemon.
289
290
  # A bind-mount of our in-container repository-path (e.g. "/__w/<repo>/<repo>" on a
290
291
  # GitHub-runner or "/Workspace/Repository" when the pipeline is run locally) would be
@@ -320,18 +321,28 @@ class TFCPS_CodeUnit_BuildCodeUnits:
320
321
  @GeneralUtilities.check_arguments
321
322
  def __get_own_container_id(self) -> str:
322
323
  # Determine the id of the container this process runs in so its volumes can be shared with
323
- # sibling-containers via "docker run --volumes-from". The id is read from the proc-filesystem
324
- # (most reliable) and falls back to the hostname, which equals the short container-id for
325
- # containers that were started without an explicit hostname.
326
- for proc_file in ["/proc/self/mountinfo", "/proc/self/cgroup"]:
327
- try:
328
- with open(proc_file, "r", encoding="utf-8") as file_handle:
329
- content = file_handle.read()
330
- except Exception:
331
- continue
332
- match = re.search(r"[0-9a-f]{64}", content)
333
- if match is not None:
334
- return match.group(0)
324
+ # sibling-containers via "docker run --volumes-from".
325
+ # In mountinfo the own container-id only appears reliably in the source-path of the
326
+ # "/etc/hostname"/"/etc/hosts"/"/etc/resolv.conf"-mounts (".../containers/<id>/..."). A plain
327
+ # 64-hex-match there would also hit overlay-layer-hashes (which are not containers), so the
328
+ # "containers/"-prefix must be matched explicitly.
329
+ try:
330
+ with open("/proc/self/mountinfo", "r", encoding="utf-8") as file_handle:
331
+ match = re.search(r"/containers/([0-9a-f]{64})/", file_handle.read())
332
+ if match is not None:
333
+ return match.group(1)
334
+ except Exception:
335
+ pass
336
+ # cgroup (v1): the container-id is part of the cgroup-path; here a plain 64-hex-match is safe.
337
+ try:
338
+ with open("/proc/self/cgroup", "r", encoding="utf-8") as file_handle:
339
+ match = re.search(r"[0-9a-f]{64}", file_handle.read())
340
+ if match is not None:
341
+ return match.group(0)
342
+ except Exception:
343
+ pass
344
+ # Fallback: the hostname equals the short container-id for containers started without an
345
+ # explicit hostname.
335
346
  return socket.gethostname()
336
347
 
337
348
  @GeneralUtilities.check_arguments
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scriptcollection
3
- Version: 4.2.137
3
+ Version: 4.2.138
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=RXsiceQ8W6a8YDk_2BPscVbIAmDIpIxqe9WHBy2r4CM,5233
11
11
  ScriptCollection/SCLog.py,sha256=Z-HhC_CRtU3HdQflNsabFh9IJOucHcXmxMDcf58fli0,4671
12
- ScriptCollection/ScriptCollectionCore.py,sha256=obr7gYratrqnSXNDotb89UqzODlIGH2UuW2dKma7rkU,214596
12
+ ScriptCollection/ScriptCollectionCore.py,sha256=np8B5hkEE-BRuKknPf40RP77d6cHggdjleoNNsySznA,214596
13
13
  ScriptCollection/UnassignedVariablesCheck.py,sha256=v59qLQ5RRvx31ouuCW7NWZj3McWENvGBPkV5ZGBmqJE,4344
14
14
  ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
15
  ScriptCollection/OCIImages/AbstractImageHandler.py,sha256=o129UYDtLymCRjMZBP9Puaj19ueMHoNt6UTLspfnaRc,1758
@@ -28,7 +28,7 @@ ScriptCollection/Resources/Dependencies/OpenAPIGenerator/Version.txt,sha256=hdAg
28
28
  ScriptCollection/Resources/MaintenanceSite/MaintenanceSite.html,sha256=CX9S1bdOz6xU2aGfr03tJRGczQrlpn-IeODc15d5kc0,232
29
29
  ScriptCollection/TFCPS/TFCPS_CodeUnitSpecific_Base.py,sha256=sWnTspNrdwWFuPNX0dCZYFv7U0ggtUL_-iYqToaYSV4,28896
30
30
  ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnit.py,sha256=WT4IzlzBaY46ogBeT2rvm_TnOE7HMw-cchJyTlmH5Og,9412
31
- ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py,sha256=yngSKzx_JutZnODk7vI1HxJaB8MV3wtfkrJKdVxy9ws,22468
31
+ ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py,sha256=YnR9tiFgLGXdQnCs8fTMf9xHBPPjco8-Em8ln1tt-jA,23138
32
32
  ScriptCollection/TFCPS/TFCPS_CreateRelease.py,sha256=X2NgZgbOkJsdZ6wMHB_RuS_rQCuz5oQCqzYrxyXBN9Q,6680
33
33
  ScriptCollection/TFCPS/TFCPS_Generic.py,sha256=5vCFfDiU8bvfcnoKNs2ATS8nsl6mYXcIuX7XfYE0tvg,2116
34
34
  ScriptCollection/TFCPS/TFCPS_MergeToMain.py,sha256=BsSV4a-NZY86MZ20d-_rYxNVAI4UzAfmEwXlRZ8qWQc,7685
@@ -55,8 +55,8 @@ ScriptCollection/TFCPS/Python/TFCPS_CodeUnitSpecific_Python.py,sha256=fqGhXNx8tK
55
55
  ScriptCollection/TFCPS/Python/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
56
56
  ScriptCollection/TFCPS/Rust/TFCPS_CodeUnitSpecific_Rust.py,sha256=WhOsMpJxNGqnQGA3nJ99ruyqymxBeJxCcpK98zJduTo,1680
57
57
  ScriptCollection/TFCPS/Rust/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
58
- scriptcollection-4.2.137.dist-info/METADATA,sha256=2-e-EWKP8UEK1TRDhAmgmEZ_aQzrnS0NANvkMax_Uag,7817
59
- scriptcollection-4.2.137.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
60
- scriptcollection-4.2.137.dist-info/entry_points.txt,sha256=Uh2xhKqpyqQX60Nbhq0CDDVOZKN5Gv5J9visugccKuc,5217
61
- scriptcollection-4.2.137.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
62
- scriptcollection-4.2.137.dist-info/RECORD,,
58
+ scriptcollection-4.2.138.dist-info/METADATA,sha256=SMpqXvMr8WAVy9rHkHPwsdC7EOt0u5e_B247RhQvkQc,7817
59
+ scriptcollection-4.2.138.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
60
+ scriptcollection-4.2.138.dist-info/entry_points.txt,sha256=Uh2xhKqpyqQX60Nbhq0CDDVOZKN5Gv5J9visugccKuc,5217
61
+ scriptcollection-4.2.138.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
62
+ scriptcollection-4.2.138.dist-info/RECORD,,