move flake configuration to .config/clan/flakes rather than $XDG_DATA_DIRS

This commit is contained in:
Jörg Thalheim
2023-11-10 12:50:11 +01:00
parent cb2145be65
commit 48d7968cf9
3 changed files with 3 additions and 2 deletions

View File

@@ -68,7 +68,7 @@ def clan_config_dir() -> Path:
def clan_flakes_dir() -> Path: def clan_flakes_dir() -> Path:
path = clan_data_dir() / "flake" path = clan_config_dir() / "flakes"
if not path.exists(): if not path.exists():
log.debug(f"Creating path with parents {path}") log.debug(f"Creating path with parents {path}")
path.mkdir(parents=True) path.mkdir(parents=True)

View File

@@ -55,7 +55,7 @@ def create_flake(
template = Path(__file__).parent / flake_name template = Path(__file__).parent / flake_name
# copy the template to a new temporary location # copy the template to a new temporary location
flake = temporary_home / ".local/share/clan/flake" / flake_name flake = temporary_home / ".config/clan/flakes" / flake_name
shutil.copytree(template, flake) shutil.copytree(template, flake)
# lookup the requested machines in ./test_machines and include them # lookup the requested machines in ./test_machines and include them

View File

@@ -21,6 +21,7 @@ def temporary_home(monkeypatch: pytest.MonkeyPatch) -> Iterator[Path]:
else: else:
with tempfile.TemporaryDirectory(prefix="pytest-") as dirpath: with tempfile.TemporaryDirectory(prefix="pytest-") as dirpath:
monkeypatch.setenv("HOME", str(dirpath)) monkeypatch.setenv("HOME", str(dirpath))
monkeypatch.setenv("XDG_CONFIG_HOME", str(Path(dirpath) / ".config"))
monkeypatch.setenv("XDG_DATA_HOME", str(Path(dirpath) / ".local/share")) monkeypatch.setenv("XDG_DATA_HOME", str(Path(dirpath) / ".local/share"))
monkeypatch.chdir(str(dirpath)) monkeypatch.chdir(str(dirpath))
log.debug("Temp HOME directory: %s", str(dirpath)) log.debug("Temp HOME directory: %s", str(dirpath))