Files
nixpkgs/pkgs/development/python-modules/pyqtgraph/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

81 lines
2.0 KiB
Nix

{
lib,
stdenv,
buildPythonPackage,
fetchFromGitHub,
scipy,
numpy,
pyqt6,
pyopengl,
qt6,
pytestCheckHook,
freefont_ttf,
makeFontsConf,
setuptools,
}:
let
fontsConf = makeFontsConf { fontDirectories = [ freefont_ttf ]; };
in
buildPythonPackage rec {
pname = "pyqtgraph";
version = "0.13.7";
format = "pyproject";
src = fetchFromGitHub {
owner = "pyqtgraph";
repo = "pyqtgraph";
rev = "refs/tags/pyqtgraph-${version}";
hash = "sha256-MUwg1v6oH2TGmJ14Hp9i6KYierJbzPggK59QaHSXHVA=";
};
nativeBuildInputs = [ setuptools ];
propagatedBuildInputs = [
numpy
scipy
pyopengl
];
buildInputs = [
# Not propagating it so that every consumer of this package will be able to
# use any of the upstream supported Qt Library, See:
# https://pyqtgraph.readthedocs.io/en/pyqtgraph-0.13.7/getting_started/how_to_use.html#pyqt-and-pyside
pyqt6
];
nativeCheckInputs = [ pytestCheckHook ];
preCheck = ''
export QT_PLUGIN_PATH="${lib.getBin qt6.qtbase}/${qt6.qtbase.qtPluginPrefix}"
export QT_QPA_PLATFORM=offscreen
export DYLD_FRAMEWORK_PATH=/System/Library/Frameworks
export FONTCONFIG_FILE=${fontsConf}
'';
pytestFlagsArray = [
# we only want to run unittests
"tests"
];
disabledTests =
lib.optionals (!stdenv.hostPlatform.isx86) [
# small precision-related differences on other architectures,
# upstream doesn't consider it serious.
# https://github.com/pyqtgraph/pyqtgraph/issues/2110
"test_PolyLineROI"
]
++ lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) [
# https://github.com/pyqtgraph/pyqtgraph/issues/2645
"test_rescaleData"
];
meta = {
description = "Scientific Graphics and GUI Library for Python";
homepage = "https://www.pyqtgraph.org/";
changelog = "https://github.com/pyqtgraph/pyqtgraph/blob/master/CHANGELOG";
license = lib.licenses.mit;
platforms = lib.platforms.unix;
maintainers = with lib.maintainers; [ koral doronbehar ];
};
}