Skip to content

Commit

Permalink
work on overrides for manylinux
Browse files Browse the repository at this point in the history
  • Loading branch information
elikoga committed Jan 27, 2025
1 parent 3559eff commit 8cbb48a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
5 changes: 3 additions & 2 deletions hooks/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ let
substitutions = {
# NOTE: We have to use a non-overlayed Python here because otherwise we run into an infinite recursion
# because building of tomlkit and its dependencies also use these hooks.
pythonPath = nonOverlayedPython.pkgs.makePythonPath [ nonOverlayedPython ];
pythonInterpreter = nonOverlayedPython.interpreter;
# pythonPath = nonOverlayedPython.pkgs.makePythonPath [ nonOverlayedPython ];
inherit pythonSitePackages;
inherit pythonInterpreter;
inherit pyprojectPatchScript;
inherit fields;
inherit kind;
Expand Down
26 changes: 18 additions & 8 deletions overrides/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,16 @@ lib.composeManyExtensions [
rm $out/bin/tensorboard
'';
};
pythonFromPkgs = {
"3.6" = pkgs.python36;
"3.7" = pkgs.python37;
"3.8" = pkgs.python38;
"3.9" = pkgs.python39;
"3.10" = pkgs.python310;
"3.11" = pkgs.python311;
"3.12" = pkgs.python312;
"3.13" = pkgs.python313;
}.${lib.versions.majorMinor prev.python.version};
in

{
Expand Down Expand Up @@ -410,13 +420,13 @@ lib.composeManyExtensions [
# apply necessary patches in postInstall if the source is a wheel
postInstall = lib.optionalString (old.src.isWheel or false) ''
pushd "$out/${final.python.sitePackages}"
for patch in ${lib.concatMapStringsSep " " (p: "${p}") pkgs.python3.pkgs.cairocffi.patches}; do
for patch in ${lib.concatMapStringsSep " " (p: "${p}") pythonFromPkgs.pkgs.cairocffi.patches}; do
patch -p1 < "$patch"
done
popd
'';
} // lib.optionalAttrs (!(old.src.isWheel or false)) {
inherit (pkgs.python3.pkgs.cairocffi) patches;
inherit (pythonFromPkgs.pkgs.cairocffi) patches;
}
);

Expand Down Expand Up @@ -1288,7 +1298,7 @@ lib.composeManyExtensions [

jira = prev.jira.overridePythonAttrs (
old: {
inherit (pkgs.python3Packages.jira) patches;
inherit (pythonFromPkgs.pkgs.jira) patches;
buildInputs = old.buildInputs or [ ] ++ [
final.pytestrunner
final.cryptography
Expand Down Expand Up @@ -1837,7 +1847,7 @@ lib.composeManyExtensions [
};
};
in
{
{
# fails to build with format=pyproject and setuptools >= 65
format =
if ((old.format or null) == "poetry2nix") then
Expand Down Expand Up @@ -2235,7 +2245,7 @@ lib.composeManyExtensions [
pillow = prev.pillow.overridePythonAttrs (
old:
let
preConfigure = (old.preConfigure or "") + pkgs.python3.pkgs.pillow.preConfigure;
preConfigure = (old.preConfigure or "") + pythonFromPkgs.pkgs.pillow.preConfigure;
in
{
nativeBuildInputs = old.nativeBuildInputs or [ ]
Expand Down Expand Up @@ -3821,7 +3831,7 @@ lib.composeManyExtensions [

# Fix library paths
postPatch = lib.optionalString (!(old.src.isWheel or false)) (old.postPatch or "" + ''
${pkgs.python3.interpreter} ${./shapely-rewrite.py} shapely/geos.py
${pythonFromPkgs.interpreter} ${./shapely-rewrite.py} shapely/geos.py
substituteInPlace pyproject.toml --replace-warn 'setuptools<64' 'setuptools'
'');
}
Expand Down Expand Up @@ -4046,7 +4056,7 @@ lib.composeManyExtensions [

vispy = prev.vispy.overrideAttrs (
_: {
inherit (pkgs.python3.pkgs.vispy) patches;
inherit (pythonFromPkgs.pkgs.vispy) patches;
}
);

Expand Down Expand Up @@ -4139,7 +4149,7 @@ lib.composeManyExtensions [

weasyprint = prev.weasyprint.overridePythonAttrs (
old: {
inherit (pkgs.python3.pkgs.weasyprint) patches;
inherit (pythonFromPkgs.pkgs.weasyprint) patches;
nativeBuildInputs = old.nativeBuildInputs or [ ] ++ [ final.pytest-runner ];
buildInputs = old.buildInputs or [ ] ++ [ final.pytest-runner ];
}
Expand Down

0 comments on commit 8cbb48a

Please sign in to comment.