Skip to content

Commit

Permalink
WIP: python3.pkgs.scipy: Use pypaBuildHook to simplify meson arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
doronbehar committed Jul 12, 2023
1 parent 207088a commit 5da4bd9
Showing 1 changed file with 9 additions and 27 deletions.
36 changes: 9 additions & 27 deletions pkgs/development/python-modules/scipy/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
, python
, pythonOlder
, buildPythonPackage
, pypaBuildHook
, cython
, gfortran
, meson-python
Expand Down Expand Up @@ -59,7 +60,7 @@ let
'';
in buildPythonPackage {
inherit pname version;
format = "pyproject";
format = "other";

src = fetchFromGitHub {
owner = "scipy";
Expand All @@ -79,7 +80,7 @@ in buildPythonPackage {
})
];

nativeBuildInputs = [ cython gfortran meson-python pythran pkg-config wheel ];
nativeBuildInputs = [ pypaBuildHook cython gfortran meson-python pythran pkg-config wheel ];

buildInputs = [
blas
Expand Down Expand Up @@ -110,32 +111,13 @@ in buildPythonPackage {
"cp ${dpath} scipy-data/${d}.dat"
) datasets));

# We always run what's necessary for cross compilation, which is running
# meson with the proper cross compilation related arguments and then passing
# `builddir=build` to meson-python. See also:
# We always run what's necessary for cross compilation, which is passing to
# meson the proper cross compilation related arguments. See also:
# https://meson-python.readthedocs.io/en/latest/how-to-guides/build-directory.html
mesonFlags = [
"-Dblas=${blas.pname}"
"-Dlapack=${lapack.pname}"
"--cross-file=${crossFileScipy}"
];
# NOTE: meson-python team discourages this usage of builddir, but recommends
# to pass arguments to meson setup via:
#
# --config-settings=setup-args="<meson-setup--options>"
#
# As noted here:
# https://meson-python.readthedocs.io/en/latest/how-to-guides/config-settings.html
# However, this requires pip > 23.0.1 which is not yet updated in Nixpkgs.
preBuild = ''
echo "Running meson setup"
mkdir -p build
# Thanks to meson.setupHook, $mesonFlags includes --cross-file flag that
# sets additional cross compilation properties needed for the build
meson setup $mesonFlags build
'';
pipBuildFlags = [
"--config-settings" "builddir=build"
pypaBuildFlags = [
"-Csetup-args=-Dblas=${blas.pname}"
"-Csetup-args=-Dlapack=${lapack.pname}"
"-Csetup-args=--cross-file=${crossFileScipy}"
];

# disable stackprotector on aarch64-darwin for now
Expand Down

0 comments on commit 5da4bd9

Please sign in to comment.