|
|
@@ -1,7 +1,7 @@
|
|
|
import os
|
|
|
import subprocess
|
|
|
import socket
|
|
|
-from pathlib import Path
|
|
|
+from pathlib import Path, PurePosixPath
|
|
|
|
|
|
is_windows = os.name == "nt"
|
|
|
|
|
|
@@ -10,8 +10,13 @@ data_sources = [
|
|
|
Path.home() / "Documents" / "formations" / "5_jours"
|
|
|
]
|
|
|
|
|
|
-def to_volume_string(vol: str | Path):
|
|
|
- return f"-v {vol}:/mnt/source{vol}:ro"
|
|
|
+
|
|
|
+def to_source_path(path: Path):
|
|
|
+ mount_base = PurePosixPath("/mnt") / "source"
|
|
|
+ inner_path = PurePosixPath(path)
|
|
|
+ with_drive = PurePosixPath(inner_path.parts[0].replace(":", "")).joinpath(*inner_path.parts[1:])
|
|
|
+ return mount_base.joinpath(with_drive)
|
|
|
+
|
|
|
|
|
|
def main():
|
|
|
hostname = socket.gethostname()
|
|
|
@@ -37,7 +42,7 @@ def main():
|
|
|
ssh_key_name = "theenglishway.pub"
|
|
|
|
|
|
volumes += [
|
|
|
- f"{vol}:/mnt/source{vol}:ro" for vol in data_sources
|
|
|
+ f"{vol}:{to_source_path(vol)}:ro" for vol in data_sources
|
|
|
]
|
|
|
|
|
|
volume_args = [a for vol in volumes for a in ["-v", vol]]
|