Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pkgs/by-name/fi/fish/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ let
test $fenv_status -eq 0
end # fenv
'';
testPython = python3.withPackages (ps: [ ps.pexpect ]);

in
stdenv.mkDerivation (finalAttrs: {
Expand Down Expand Up @@ -317,6 +318,7 @@ stdenv.mkDerivation (finalAttrs: {
preConfigure = ''
patchShebangs ./build_tools/git_version_gen.sh
patchShebangs ./tests/test_driver.py
substituteInPlace ./tests/test_driver.py --replace-warn '"python3",' '"${testPython}/bin/python3",'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this required on Darwin and not Linux?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On macOS the build runs unsandboxed, so python3 resolves to /usr/bin/python3 instead of the nixpkgs one; pointing to ${testPython}/bin/python3 ensures we always use the interpreter that has pexpect.

Copy link
Member

@szlend szlend Nov 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But patching shebangs in ./tests/test_driver.py should point it to the nixpkgs python, no? I think something else is going on. Are nativeCheckInputs available in preConfigure (for patchShebangs to pick up)?

Maybe moving python to nativeBuildInputs would fix it. Or moving test shebang patching to the check phase.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's propably due to a hardcoded subprocess. It seems it finds PEXPECT (due to patchShebangs and python3 haveing PEXPECT available) and then calling a subprocess with python3 which does not resolve to the sandboxed python environment with PEXPECT but to the system python3:

https://github.com/fish-shell/fish-shell/blob/289057f981cc6ff125bfbde87e798027eb69fa88/tests/test_driver.py#L336-L346

''
+ lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
export CMAKE_PREFIX_PATH=
Expand All @@ -336,7 +338,7 @@ stdenv.mkDerivation (finalAttrs: {
nativeCheckInputs = [
coreutils
glibcLocales
(python3.withPackages (ps: [ ps.pexpect ]))
testPython
procps
sphinx
]
Expand Down
Loading