nixpkgs/pkgs/development/python-modules/fipy/default.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

73 lines
1.7 KiB
Nix

{
lib,
buildPythonPackage,
numpy,
scipy,
pyamg,
future,
matplotlib,
tkinter,
mpi4py,
scikit-fmm,
gmsh,
python,
stdenv,
openssh,
fetchFromGitHub,
pythonAtLeast,
pythonOlder,
}:
buildPythonPackage rec {
pname = "fipy";
version = "3.4.5";
format = "setuptools";
# Python 3.12 is not yet supported.
# https://github.com/usnistgov/fipy/issues/997
# https://github.com/usnistgov/fipy/pull/1023
disabled = pythonOlder "3.7" || pythonAtLeast "3.12";
src = fetchFromGitHub {
owner = "usnistgov";
repo = "fipy";
rev = "refs/tags/${version}";
hash = "sha256-345YrGQgHNq0FULjJjLqHksyfm/EHl+KyGfxwS6xK9U=";
};
propagatedBuildInputs = [
numpy
scipy
pyamg
matplotlib
tkinter
mpi4py
future
scikit-fmm
openssh
] ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ gmsh ];
nativeCheckInputs = lib.optionals (!stdenv.hostPlatform.isDarwin) [ gmsh ];
# NOTE: Two of the doctests in fipy.matrices.scipyMatrix._ScipyMatrix.CSR fail, and there is no
# clean way to disable them.
doCheck = false;
checkPhase = ''
export OMPI_MCA_plm_rsh_agent=${openssh}/bin/ssh
${python.interpreter} setup.py test --modules
'';
# NOTE: Importing fipy within the sandbox will fail because plm_rsh_agent isn't set and the process isn't able
# to start a daemon on the builder.
# pythonImportsCheck = [ "fipy" ];
meta = with lib; {
homepage = "https://www.ctcms.nist.gov/fipy/";
description = "Finite Volume PDE Solver Using Python";
changelog = "https://github.com/usnistgov/fipy/blob/${version}/CHANGELOG.rst";
license = licenses.free;
maintainers = with maintainers; [ wd15 ];
};
}