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

56 lines
1.4 KiB
Nix

{
lib,
stdenv,
buildPythonPackage,
fetchFromGitHub,
cython,
gcc,
click,
pytestCheckHook,
pythonOlder,
setuptools,
}:
buildPythonPackage rec {
pname = "primer3";
version = "2.0.3";
pyproject = true;
disabled = pythonOlder "3.7";
src = fetchFromGitHub {
owner = "libnano";
repo = "primer3-py";
rev = "refs/tags/v${version}";
hash = "sha256-O8BFjkjG9SfknSrK34s9EJnqTrtCf4zW9A+N+/MHl2w=";
};
nativeBuildInputs = [
cython
setuptools
] ++ lib.optionals stdenv.hostPlatform.isDarwin [ gcc ];
nativeCheckInputs = [
click
pytestCheckHook
];
# We are not sure why exactly this is need. It seems `pytestCheckHook`
# doesn't find extension modules installed in $out/${python.sitePackages},
# and the tests rely upon them. This was initially reported upstream at
# https://github.com/libnano/primer3-py/issues/120 and we investigate this
# downstream at: https://github.com/NixOS/nixpkgs/issues/255262.
preCheck = ''
python setup.py build_ext --inplace
'';
pythonImportsCheck = [ "primer3" ];
meta = with lib; {
description = "Oligo analysis and primer design";
homepage = "https://github.com/libnano/primer3-py";
changelog = "https://github.com/libnano/primer3-py/blob/v${version}/CHANGES";
license = with licenses; [ gpl2Only ];
maintainers = with maintainers; [ fab ];
};
}