From 4246654992ec971d7dc434e04994ed4ea43e8458 Mon Sep 17 00:00:00 2001 From: squalus Date: Thu, 25 Aug 2022 17:42:46 -0700 Subject: [PATCH] writers.makePythonWriter: fix cross compile The check script needs to run at build time. Add a new argument to makePythonWriter for the appropriate buildPackages version of pythonPackages, and use this to run the check script. --- pkgs/build-support/writers/default.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkgs/build-support/writers/default.nix b/pkgs/build-support/writers/default.nix index 3ec1796458d0..9fbc571daab4 100644 --- a/pkgs/build-support/writers/default.nix +++ b/pkgs/build-support/writers/default.nix @@ -237,7 +237,7 @@ let # makePythonWriter takes python and compatible pythonPackages and produces python script writer, # which validates the script with flake8 at build time. If any libraries are specified, # python.withPackages is used as interpreter, otherwise the "bare" python is used. - makePythonWriter = python: pythonPackages: name: { libraries ? [], flakeIgnore ? [] }: + makePythonWriter = python: pythonPackages: buildPythonPackages: name: { libraries ? [], flakeIgnore ? [] }: let ignoreAttribute = optionalString (flakeIgnore != []) "--ignore ${concatMapStringsSep "," escapeShellArg flakeIgnore}"; in @@ -248,7 +248,7 @@ let else "${python.withPackages (ps: libraries)}/bin/python" ; check = optionalString python.isPy3k (writeDash "pythoncheck.sh" '' - exec ${pythonPackages.flake8}/bin/flake8 --show-source ${ignoreAttribute} "$1" + exec ${buildPythonPackages.flake8}/bin/flake8 --show-source ${ignoreAttribute} "$1" ''); } name; @@ -264,7 +264,7 @@ let # # print Test.a # '' - writePyPy2 = makePythonWriter pkgs.pypy2 pkgs.pypy2Packages; + writePyPy2 = makePythonWriter pkgs.pypy2 pkgs.pypy2Packages buildPackages.pypy2Packages; # writePyPy2Bin takes the same arguments as writePyPy2 but outputs a directory (like writeScriptBin) writePyPy2Bin = name: @@ -282,7 +282,7 @@ let # """) # print(y[0]['test']) # '' - writePython3 = makePythonWriter pkgs.python3 pkgs.python3Packages; + writePython3 = makePythonWriter pkgs.python3 pkgs.python3Packages buildPackages.python3Packages; # writePython3Bin takes the same arguments as writePython3 but outputs a directory (like writeScriptBin) writePython3Bin = name: @@ -300,7 +300,7 @@ let # """) # print(y[0]['test']) # '' - writePyPy3 = makePythonWriter pkgs.pypy3 pkgs.pypy3Packages; + writePyPy3 = makePythonWriter pkgs.pypy3 pkgs.pypy3Packages buildPackages.pypy3Packages; # writePyPy3Bin takes the same arguments as writePyPy3 but outputs a directory (like writeScriptBin) writePyPy3Bin = name: