Adjust for renaming of pythonForBuild to pythonOnBuildForHost

The upstream Nixpkgs renamed `pythonForBuild` to `pythonOnBuildForHost`
and made `pythonForBuild` emit warnings: NixOS/nixpkgs#265764.  Adjust
the poetry2nix code to avoid warnings with the new version, while still
keeping compatibility with the old one.
This commit is contained in:
Sergey Vlasov 2024-02-01 10:03:24 +03:00
parent e0b44e9e2d
commit 8fb6db1d12
2 changed files with 8 additions and 8 deletions

View file

@ -1,11 +1,11 @@
{ python, stdenv, makeSetupHook, pkgs, lib }: { python, stdenv, makeSetupHook, pkgs, lib }:
let let
inherit (python) pythonForBuild; pythonOnBuildForHost = python.pythonOnBuildForHost or python.pythonForBuild;
inherit (pythonForBuild.pkgs) callPackage; inherit (pythonOnBuildForHost.pkgs) callPackage;
pythonInterpreter = pythonForBuild.interpreter; pythonInterpreter = pythonOnBuildForHost.interpreter;
pythonSitePackages = python.sitePackages; pythonSitePackages = python.sitePackages;
nonOverlayedPython = pkgs.python3.pythonForBuild.withPackages (ps: [ ps.tomlkit ]); nonOverlayedPython = (pkgs.python3.pythonOnBuildForHost or pkgs.python3.pythonForBuild).withPackages (ps: [ ps.tomlkit ]);
makeRemoveSpecialDependenciesHook = makeRemoveSpecialDependenciesHook =
{ fields { fields
, kind , kind

View file

@ -25,13 +25,13 @@ let
true; true;
intendedBuildSystem = intendedBuildSystem =
if attr.buildSystem == "cython" then if attr.buildSystem == "cython" then
self.python.pythonForBuild.pkgs.cython (self.python.pythonOnBuildForHost or self.python.pythonForBuild).pkgs.cython
else else
self.${attr.buildSystem}; self.${attr.buildSystem};
in in
if fromIsValid && untilIsValid then intendedBuildSystem else null if fromIsValid && untilIsValid then intendedBuildSystem else null
else else
if attr == "cython" then self.python.pythonForBuild.pkgs.cython else self.${attr}; if attr == "cython" then (self.python.pythonOnBuildForHost or self.python.pythonForBuild).pkgs.cython else self.${attr};
in in
if (attr == "flit-core" || attr == "flit" || attr == "hatchling") && !self.isPy3k then drv if (attr == "flit-core" || attr == "flit" || attr == "hatchling") && !self.isPy3k then drv
else if drv == null then null else if drv == null then null
@ -101,7 +101,7 @@ lib.composeManyExtensions [
let let
inherit (self.python) stdenv; inherit (self.python) stdenv;
inherit (pkgs.buildPackages) pkg-config; inherit (pkgs.buildPackages) pkg-config;
pyBuildPackages = self.python.pythonForBuild.pkgs; pyBuildPackages = (self.python.pythonOnBuildForHost or self.python.pythonForBuild).pkgs;
selectQt5 = version: selectQt5 = version:
let let
@ -129,7 +129,7 @@ lib.composeManyExtensions [
qtxmlpatterns qtxmlpatterns
]; ];
bootstrappingBase = pkgs.${self.python.pythonAttr}.pythonForBuild.pkgs; bootstrappingBase = (pkgs.${self.python.pythonAttr}.pythonOnBuildForHost or pkgs.${self.python.pythonAttr}.pythonForBuild).pkgs;
in in
{ {