about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/tools/poetry2nix/poetry2nix/pep425.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/tools/poetry2nix/poetry2nix/pep425.nix')
-rw-r--r--nixpkgs/pkgs/development/tools/poetry2nix/poetry2nix/pep425.nix11
1 files changed, 9 insertions, 2 deletions
diff --git a/nixpkgs/pkgs/development/tools/poetry2nix/poetry2nix/pep425.nix b/nixpkgs/pkgs/development/tools/poetry2nix/poetry2nix/pep425.nix
index 496c4ff15818..7135cace2878 100644
--- a/nixpkgs/pkgs/development/tools/poetry2nix/poetry2nix/pep425.nix
+++ b/nixpkgs/pkgs/development/tools/poetry2nix/poetry2nix/pep425.nix
@@ -20,7 +20,9 @@ let
   #
   toWheelAttrs = str:
     let
-      entries = splitString "-" str;
+      entries' = splitString "-" str;
+      # Hack: Remove version "suffixes" like 2.11.4-1
+      entries = builtins.filter (x: builtins.match "[0-9]" x == null) entries';
       p = removeSuffix ".whl" (builtins.elemAt entries 4);
     in
     {
@@ -60,7 +62,12 @@ let
   selectWheel = files:
     let
       filesWithoutSources = (builtins.filter (x: hasSuffix ".whl" x.file) files);
-      isPyAbiCompatible = pyabi: x: x == "none" || pyabi == x;
+      isPyAbiCompatible = pyabi: x: x == "none" || lib.hasPrefix pyabi x || (
+        # The CPython stable ABI is abi3 as in the shared library suffix.
+        python.passthru.implementation == "cpython" &&
+          builtins.elemAt (lib.splitString "." python.version) 0 == "3" &&
+          x == "abi3"
+      );
       withPython = ver: abi: x: (isPyVersionCompatible ver x.pyVer) && (isPyAbiCompatible abi x.abi);
       withPlatform =
         if isLinux