clan-cli: another try to fix the CI bug
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
import tempfile
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
@@ -62,11 +63,15 @@ def nix_config() -> dict[str, Any]:
|
|||||||
|
|
||||||
def nix_test_store() -> Path | None:
|
def nix_test_store() -> Path | None:
|
||||||
store = os.environ.get("CLAN_TEST_STORE", None)
|
store = os.environ.get("CLAN_TEST_STORE", None)
|
||||||
|
lock_nix = os.environ.get("LOCK_NIX", "")
|
||||||
|
|
||||||
|
if not lock_nix:
|
||||||
|
lock_nix = tempfile.NamedTemporaryFile().name # NOQA: SIM115
|
||||||
if not os.environ.get("IN_NIX_SANDBOX"):
|
if not os.environ.get("IN_NIX_SANDBOX"):
|
||||||
return None
|
return None
|
||||||
if store:
|
if store:
|
||||||
Path.mkdir(Path(store), exist_ok=True)
|
Path.mkdir(Path(store), exist_ok=True)
|
||||||
with locked_open(filename=Path(store) / "lockfile", mode="a"):
|
with locked_open(Path(lock_nix), "w"):
|
||||||
return Path(store)
|
return Path(store)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|||||||
@@ -136,9 +136,6 @@ pythonRuntime.pkgs.buildPythonApplication {
|
|||||||
cd ./src
|
cd ./src
|
||||||
|
|
||||||
export NIX_STATE_DIR=$TMPDIR/nix IN_NIX_SANDBOX=1 PYTHONWARNINGS=error
|
export NIX_STATE_DIR=$TMPDIR/nix IN_NIX_SANDBOX=1 PYTHONWARNINGS=error
|
||||||
mkdir -p $TMPDIR/nix/var/nix/profiles
|
|
||||||
mkdir -p $TMPDIR/nix/var/nix/gcroots
|
|
||||||
ln -sfT $TMPDIR/nix/var/nix/profiles $TMPDIR/nix/var/nix/gcroots/profiles
|
|
||||||
|
|
||||||
# required to prevent concurrent 'nix flake lock' operations
|
# required to prevent concurrent 'nix flake lock' operations
|
||||||
export CLAN_TEST_STORE=$TMPDIR/store
|
export CLAN_TEST_STORE=$TMPDIR/store
|
||||||
|
|||||||
Reference in New Issue
Block a user