From 9f2d6c03f57ce77b084a494fba0a82bb0a52df7b Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Wed, 3 Jan 2024 17:34:51 +0000 Subject: [PATCH] python3Packages.paddlepaddle: improve `src` eval error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before the change eval raised an unrecoverable failure due to missing attribute dereference: nix-repl> python3Packages.paddlepaddle.src error: … while evaluating the attribute 'paddlepaddle.src' error: attribute 'cp311' missing at pkgs/development/python-modules/paddlepaddle/default.nix:33:10: 32| allHashAndPlatform = import ./binary-hashes.nix; 33| hash = allHashAndPlatform."${stdenv.system}"."${cpuOrGpu}"."${pyShortVersion}" | ^ 34| ; #or (throw "${pname} has no binary-hashes.nix entry for '${stdenv.system}.${cpuOrGpu}.${pyShortVersion}' attribute"); Did you mean one of cp310 or cp39? After the change the error is raised via catchable `throw`: nix-repl> python3Packages.paddlepaddle.src error: … while evaluating the attribute 'paddlepaddle.src' error: paddlepaddle has no binary-hashes.nix entry for 'x86_64-linux.cpu.cp311' attribute This allows for slightly easier scan for syntactic errors over `nixpkgs`. --- pkgs/development/python-modules/paddlepaddle/default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/development/python-modules/paddlepaddle/default.nix b/pkgs/development/python-modules/paddlepaddle/default.nix index b68c75d0c398..b9cc87b21e33 100644 --- a/pkgs/development/python-modules/paddlepaddle/default.nix +++ b/pkgs/development/python-modules/paddlepaddle/default.nix @@ -28,8 +28,10 @@ let version = "2.5.0"; format = "wheel"; pyShortVersion = "cp${builtins.replaceStrings ["."] [""] python.pythonVersion}"; + cpuOrGpu = if cudaSupport then "gpu" else "cpu"; allHashAndPlatform = import ./binary-hashes.nix; - hash = allHashAndPlatform."${stdenv.system}"."${if cudaSupport then "gpu" else "cpu"}"."${pyShortVersion}"; + hash = allHashAndPlatform."${stdenv.system}"."${cpuOrGpu}"."${pyShortVersion}" + or (throw "${pname} has no binary-hashes.nix entry for '${stdenv.system}.${cpuOrGpu}.${pyShortVersion}' attribute"); platform = allHashAndPlatform."${stdenv.system}".platform; src = fetchPypi ({ inherit version format hash platform;