mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-07-20 15:41:16 +00:00
wrapPythonPrograms: support structuredAttrs, modify gi-docgen and freecell-solver to verify (#471986)
This commit is contained in:
@@ -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";
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user