Skip to content

Commit

Permalink
build.hook.mkVirtualEnv: Set no globbing for make-venv hook
Browse files Browse the repository at this point in the history
Inserting globs seems to have broken. I thought it was adequetaly escaped but apparently not.
  • Loading branch information
adisbladis committed Jan 10, 2025
1 parent c7fd60f commit 6251dce
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
15 changes: 15 additions & 0 deletions build/checks/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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"
{
Expand Down
2 changes: 2 additions & 0 deletions build/hooks/pyproject-make-venv-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions build/packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
}:
let
inherit (resolvers) resolveCyclic resolveNonCyclic;
inherit (lib) makeScope concatStringsSep escapeShellArg;
inherit (lib) makeScope concatStringsSep;

mkResolveBuildSystem =
set:
Expand Down Expand Up @@ -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
);
};

Expand Down

0 comments on commit 6251dce

Please sign in to comment.