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:
@@ -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)")
|
||||
|
||||
Reference in New Issue
Block a user