From c64c04e8bf17967aecce87a9389b062ae3ee749b Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Tue, 9 Jan 2024 17:46:49 +0000 Subject: [PATCH] pythonInterpreters.pypy39_prebuilt: fix `tests` eval (#278950) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without the change `test-pythonPackagesExtensions` test fails the eval as: $ nix build -f. pythonInterpreters.pypy39_prebuilt.tests --show-trace error: … while evaluating an attribute name at pkgs/development/interpreters/python/tests.nix:151:16: 150| }); 151| in pkgs_.${python.pythonAttr}.pkgs.foo; | ^ 152| }); error: value is null while a string was expected This happens because `pypy39_prebuilt` exposes `pythonAttr` attribute, but it has a `null` value. Fix the test to filter out prebuilt pypy. --- pkgs/development/interpreters/python/tests.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkgs/development/interpreters/python/tests.nix b/pkgs/development/interpreters/python/tests.nix index 67670ceb6546..df4484f9ec68 100644 --- a/pkgs/development/interpreters/python/tests.nix +++ b/pkgs/development/interpreters/python/tests.nix @@ -125,6 +125,9 @@ let extension = self: super: { foobar = super.numpy; }; + # `pythonInterpreters.pypy39_prebuilt` does not expose an attribute + # name (is not present in top-level `pkgs`). + is_prebuilt = python: python.pythonAttr == null; in lib.optionalAttrs (python.isPy3k) ({ test-packageOverrides = let myPython = let @@ -138,7 +141,10 @@ let # test-overrideScope = let # myPackages = python.pkgs.overrideScope extension; # in assert myPackages.foobar == myPackages.numpy; myPackages.python.withPackages(ps: with ps; [ foobar ]); - } // lib.optionalAttrs (python ? pythonAttr) { + # + # Have to skip prebuilt python as it's not present in top-level + # `pkgs` as an attribute. + } // lib.optionalAttrs (python ? pythonAttr && !is_prebuilt python) { # Test applying overrides using pythonPackagesOverlays. test-pythonPackagesExtensions = let pkgs_ = pkgs.extend(final: prev: {