From 6251dceabdb355c91e29709fbdf5bfac1199b52c Mon Sep 17 00:00:00 2001 From: adisbladis Date: Sat, 11 Jan 2025 02:15:31 +1300 Subject: [PATCH] build.hook.mkVirtualEnv: Set no globbing for make-venv hook Inserting globs seems to have broken. I thought it was adequetaly escaped but apparently not. --- build/checks/default.nix | 15 +++++++++++++++ build/hooks/pyproject-make-venv-hook.sh | 2 ++ build/packages.nix | 6 +++--- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/build/checks/default.nix b/build/checks/default.nix index c2e1bfb..11015ee 100644 --- a/build/checks/default.nix +++ b/build/checks/default.nix @@ -62,6 +62,21 @@ let touch $out ''; + # Test that glob isn't treated strangely by bash and command doesn't explode + make-venv-flags = + pkgs.runCommand "venv-run-build-flags-test" + { + nativeBuildInputs = [ + (testVenv.overrideAttrs (_old: { + venvIgnoreCollisions = [ "*" ]; + })) + ]; + } + '' + pyproject-build --help > /dev/null + touch $out + ''; + make-venv-unittest = pkgs.runCommand "venv-unittest" { diff --git a/build/hooks/pyproject-make-venv-hook.sh b/build/hooks/pyproject-make-venv-hook.sh index c9f36f7..6091d52 100644 --- a/build/hooks/pyproject-make-venv-hook.sh +++ b/build/hooks/pyproject-make-venv-hook.sh @@ -4,7 +4,9 @@ pyprojectMakeVenv() { echo "Executing pyprojectMakeVenv" runHook preInstall + set -f @pythonInterpreter@ @makeVenvScript@ --python @python@ "$out" --env "NIX_PYPROJECT_DEPS" $mkVirtualenvFlags + set +f runHook postInstall echo "Finished executing pyprojectMakeVenv" diff --git a/build/packages.nix b/build/packages.nix index 2999385..2f570ed 100644 --- a/build/packages.nix +++ b/build/packages.nix @@ -4,7 +4,7 @@ }: let inherit (resolvers) resolveCyclic resolveNonCyclic; - inherit (lib) makeScope concatStringsSep escapeShellArg; + inherit (lib) makeScope concatStringsSep; mkResolveBuildSystem = set: @@ -58,8 +58,8 @@ let NIX_PYPROJECT_DEPS = concatStringsSep ":" (pkgsFinal.resolveVirtualEnv spec); dontMoveLib64 = true; mkVirtualenvFlags = concatStringsSep " " ( - map (path: "--skip ${escapeShellArg path}") finalAttrs.venvSkip - ++ map (pat: "--ignore-collisions ${escapeShellArg pat}") finalAttrs.venvIgnoreCollisions + map (path: "--skip ${path}") finalAttrs.venvSkip + ++ map (pat: "--ignore-collisions ${pat}") finalAttrs.venvIgnoreCollisions ); };