fix(ci): use mamba nox backend only if it exists
This commit is contained in:
parent
1fc37c9995
commit
63e93f82ce
1 changed files with 18 additions and 2 deletions
20
noxfile.py
20
noxfile.py
|
|
@ -1,15 +1,31 @@
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import nox
|
import nox
|
||||||
import nox.registry
|
import nox.registry
|
||||||
|
|
||||||
nox.options.default_venv_backend = "mamba"
|
MICROMAMBA = shutil.which("micromamba")
|
||||||
nox.options.reuse_existing_virtualenvs = True
|
|
||||||
|
|
||||||
CURRENT_DIR = Path(__file__).parent.resolve()
|
CURRENT_DIR = Path(__file__).parent.resolve()
|
||||||
TARGET_DIR = CURRENT_DIR / "target"
|
TARGET_DIR = CURRENT_DIR / "target"
|
||||||
COVERAGE_DIR = TARGET_DIR / "debug/coverage"
|
COVERAGE_DIR = TARGET_DIR / "debug/coverage"
|
||||||
|
|
||||||
|
if MICROMAMBA:
|
||||||
|
BIN_DIR = CURRENT_DIR / "build" / "bin"
|
||||||
|
BIN_DIR.mkdir(exist_ok=True, parents=True)
|
||||||
|
CONDA = BIN_DIR / "conda"
|
||||||
|
if not CONDA.is_file():
|
||||||
|
CONDA.hardlink_to(MICROMAMBA)
|
||||||
|
os.environ["PATH"] = os.pathsep.join([str(BIN_DIR), os.environ["PATH"]])
|
||||||
|
nox.options.default_venv_backend = "conda"
|
||||||
|
elif shutil.which("mamba"):
|
||||||
|
nox.options.default_venv_backend = "mamba"
|
||||||
|
else:
|
||||||
|
nox.options.default_venv_backend = "conda"
|
||||||
|
|
||||||
|
nox.options.reuse_existing_virtualenvs = True
|
||||||
|
|
||||||
ENV = dict(
|
ENV = dict(
|
||||||
CARGO_TARGET_DIR=str(TARGET_DIR),
|
CARGO_TARGET_DIR=str(TARGET_DIR),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue