diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 57c3379..78e3277 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,4 +32,4 @@ jobs: environments: ${{ matrix.environment }} - run: pixi run fmt-check - run: pixi run lint-check - - run: pixi run test + - run: pixi run test --color=yes diff --git a/conda b/conda index 1d2115e..8bc8421 100755 --- a/conda +++ b/conda @@ -11,15 +11,28 @@ import traceback from functools import lru_cache from pathlib import Path +ON_WINDOWS = os.name == "nt" ENABLE_LOGGING = True # assuming __file__ is .pixi/envs//libexec/conda # or .pixi\envs\\libexec\conda.bat\..\conda.py PIXI_ENVIRONMENT_FILE = Path(__file__).resolve().parent.parent / "conda-meta" / "pixi" +DEFAULT_PIXI_EXECUTABLE_PATH = ( + Path(Path.home()) / ".pixi" / "bin" / f"pixi{'.exe' if ON_WINDOWS else ''}" +) def pixi(cmd): - out = subprocess.check_output(["pixi", *cmd]) + try: + out = subprocess.check_output(["pixi", *cmd]) + except FileNotFoundError as e: + # if pixi is not on PATH, try to run it from the default location + # see https://pixi.sh/install.sh or https://pixi.sh/install.ps1 + try: + out = subprocess.check_output([str(DEFAULT_PIXI_EXECUTABLE_PATH), *cmd]) + except FileNotFoundError: + msg = "pixi not found. Is it installed in your PATH?" + raise FileNotFoundError(msg) from e return out.decode(locale.getpreferredencoding()) diff --git a/pixi.toml b/pixi.toml index b8ac0db..b3bbc64 100644 --- a/pixi.toml +++ b/pixi.toml @@ -1,6 +1,6 @@ [project] name = "pixi-pycharm" -version = "0.0.6" +version = "0.0.7" description = "Conda shim for PyCharm that proxies pixi" authors = ["Pavel Zwerschke "] channels = ["conda-forge"]