Files
nixpkgs/pkgs/development/python-modules/demesdraw/default.nix
T
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

62 lines
1.3 KiB
Nix

{
lib,
stdenv,
buildPythonPackage,
fetchPypi,
setuptools-scm,
demes,
matplotlib,
numpy,
scipy,
pythonOlder,
pytestCheckHook,
pytest-xdist,
mpmath,
}:
buildPythonPackage rec {
pname = "demesdraw";
version = "0.4.0";
format = "pyproject";
disabled = pythonOlder "3.7";
src = fetchPypi {
inherit pname version;
hash = "sha256-n7dz+kYf2yyr66TBx452W6z4qT6bT81u0J4aMAYuGCc=";
};
nativeBuildInputs = [ setuptools-scm ];
propagatedBuildInputs = [
demes
matplotlib
numpy
scipy
];
postPatch = ''
# remove coverage arguments to pytest
sed -i '/--cov/d' setup.cfg
'';
# This variable is needed to suppress the "Trace/BPT trap: 5" error in Darwin's checkPhase.
# Not sure of the details, but we can avoid it by changing the matplotlib backend during testing.
env.MPLBACKEND = lib.optionalString stdenv.hostPlatform.isDarwin "Agg";
nativeCheckInputs = [
pytestCheckHook
pytest-xdist
mpmath
];
pythonImportsCheck = [ "demesdraw" ];
meta = with lib; {
description = "Drawing functions for Demes demographic models";
mainProgram = "demesdraw";
homepage = "https://github.com/grahamgower/demesdraw";
license = licenses.isc;
maintainers = with maintainers; [ alxsimon ];
};
}