Lokal abweichenden Ablageort der Plugin-Klone unterstuetzen (#6)

hallo.py, setup_workspace.py und link_qgis_profile.py gingen bisher fest
davon aus, dass die Repos aus workspace.toml direkte Unterordner von
Projektwissen sind. Eine optionale, nicht versionierte workspace.local.toml
mit [workspace] repos_root = "..." kann das jetzt lokal ueberschreiben, z. B.
wenn die Klone zusaetzlich unter einem separaten src-Ordner liegen und von
dort in mehrere QGIS-Profile verlinkt werden. Ohne diese Datei bleibt das
Verhalten fuer alle unveraendert.
This commit is contained in:
Michael Otto
2026-09-14 11:36:55 +02:00
parent 3d1e9b4b3d
commit 85a34e4d1d
3 changed files with 54 additions and 4 deletions
+13 -1
View File
@@ -24,9 +24,20 @@ import tomllib
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
LOKALE_ÜBERSCHREIBUNG = ROOT / "workspace.local.toml"
ROLLEN_MIT_PLUGIN = {"plattform", "fachplugin", "geruest"}
def repos_root() -> Path:
"""Ordner der Plugin-/Daten-Klone, siehe workspace.local.toml (nicht versioniert)."""
if not LOKALE_ÜBERSCHREIBUNG.is_file():
return ROOT
with LOKALE_ÜBERSCHREIBUNG.open("rb") as f:
lokal = tomllib.load(f)
pfad = lokal.get("workspace", {}).get("repos_root")
return Path(pfad).expanduser() if pfad else ROOT
def profil_plugin_ordner(profil: str) -> Path:
if sys.platform.startswith("win"):
basis = Path(os.environ.get("APPDATA", Path.home() / "AppData" / "Roaming"))
@@ -99,8 +110,9 @@ def main() -> int:
print(" (existiert noch nicht – QGIS mit diesem Profil einmal starten oder --pfad prüfen)")
rc = 0
rroot = repos_root()
for paket in gewuenscht:
quelle = ROOT / repos[paket]["name"]
quelle = rroot / repos[paket]["name"]
ziel = plugin_ordner / paket
if not (quelle / "__init__.py").is_file():
print(f"[{paket}] übersprungen: {quelle.name} enthält kein Plugin (__init__.py fehlt)")