diff --git a/pkgs/by-name/fr/freecell-solver/package.nix b/pkgs/by-name/fr/freecell-solver/package.nix index 8c962bbb5155..5e271ff8a57d 100644 --- a/pkgs/by-name/fr/freecell-solver/package.nix +++ b/pkgs/by-name/fr/freecell-solver/package.nix @@ -11,15 +11,16 @@ pkg-config, python3, rinutils, + versionCheckHook, }: stdenv.mkDerivation (finalAttrs: { pname = "freecell-solver"; - version = "6.14.0"; + version = "6.16.0"; src = fetchurl { url = "https://fc-solve.shlomifish.org/downloads/fc-solve/freecell-solver-${finalAttrs.version}.tar.xz"; - hash = "sha256-HREl2FQivNUhEC18sefIS3aGP+RF3SGHn5d53Gss59w="; + hash = "sha256-cbiILmjxvmJSkGkBjQxzK3UHhmkHfJY0gnlXWEnzQxM="; }; outputs = [ @@ -74,10 +75,29 @@ stdenv.mkDerivation (finalAttrs: { (lib.cmakeBool "BUILD_STATIC_LIBRARY" false) ]; - postFixup = '' - wrapPythonProgramsIn "$out/bin" "$out $pythonPath" + preFixup = '' + # This is a module and should not be wrapped, or it causes import errors + # on the scripts that are actually executable + chmod a-x $out/bin/fc_solve_find_index_s2ints.py ''; + postFixup = '' + wrapPythonProgramsIn "$out/bin" "$out ''${pythonPath[*]}" + ''; + + nativeInstallCheckInputs = [ versionCheckHook ]; + postInstallCheck = '' + # Check that the python wrappers work correctly: + # * fc_solve_find_index_s2ints.py should be unwrapped (we get SyntaxError otherwise) + # * the wrapper should provide all modules from the pythonPath (we get ModuleNotFoundError otherwise) + # * we don't provide valid input so expect IndexError + unset PYTHONPATH + ($out/bin/make_pysol_freecell_board.py 2>&1 | tee /dev/stderr || true) | grep -q "IndexError:" + ''; + doInstallCheck = true; + + __structuredAttrs = true; + meta = { homepage = "https://fc-solve.shlomifish.org/"; description = "FreeCell automatic solver"; diff --git a/pkgs/by-name/gi/gi-docgen/package.nix b/pkgs/by-name/gi/gi-docgen/package.nix index 7053bcd87800..1c6922c5cd7c 100644 --- a/pkgs/by-name/gi/gi-docgen/package.nix +++ b/pkgs/by-name/gi/gi-docgen/package.nix @@ -5,6 +5,7 @@ ninja, python3, gnome, + versionCheckHook, }: python3.pkgs.buildPythonApplication rec { @@ -36,12 +37,17 @@ python3.pkgs.buildPythonApplication rec { typogrify ]; - doCheck = false; # no tests + # For Python this must be placed in nativeCheckInputs instead of nativeInstallCheckInputs + # https://github.com/nixos/nixpkgs/issues/420531 + nativeCheckInputs = [ versionCheckHook ]; + # doCheck = false; # no tests - restore this after versionCheckHook can be moved + + __structuredAttrs = true; postFixup = '' # Do not propagate Python substituteInPlace $out/nix-support/propagated-build-inputs \ - --replace "${python3}" "" + --replace-fail "${python3}" "" ''; passthru = { diff --git a/pkgs/development/interpreters/python/wrap.sh b/pkgs/development/interpreters/python/wrap.sh index f10ba003432b..c4f9270fa202 100644 --- a/pkgs/development/interpreters/python/wrap.sh +++ b/pkgs/development/interpreters/python/wrap.sh @@ -1,7 +1,7 @@ # Wrapper around wrapPythonProgramsIn, below. The $pythonPath # variable is passed in from the buildPythonPackage function. wrapPythonPrograms() { - wrapPythonProgramsIn "$out/bin" "$out $pythonPath" + wrapPythonProgramsIn "$out/bin" "$out ${pythonPath[*]}" } # Builds environment variables like PYTHONPATH and PATH walking through closure