1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 cython,
7 gcc,
8 click,
9 pytestCheckHook,
10 pythonOlder,
11 setuptools,
12}:
13
14buildPythonPackage rec {
15 pname = "primer3";
16 version = "2.0.3";
17 pyproject = true;
18
19 disabled = pythonOlder "3.7";
20
21 src = fetchFromGitHub {
22 owner = "libnano";
23 repo = "primer3-py";
24 rev = "refs/tags/v${version}";
25 hash = "sha256-O8BFjkjG9SfknSrK34s9EJnqTrtCf4zW9A+N+/MHl2w=";
26 };
27
28 nativeBuildInputs = [
29 cython
30 setuptools
31 ] ++ lib.optionals stdenv.isDarwin [ gcc ];
32
33 nativeCheckInputs = [
34 click
35 pytestCheckHook
36 ];
37 # We are not sure why exactly this is need. It seems `pytestCheckHook`
38 # doesn't find extension modules installed in $out/${python.sitePackages},
39 # and the tests rely upon them. This was initially reported upstream at
40 # https://github.com/libnano/primer3-py/issues/120 and we investigate this
41 # downstream at: https://github.com/NixOS/nixpkgs/issues/255262.
42 preCheck = ''
43 python setup.py build_ext --inplace
44 '';
45
46 pythonImportsCheck = [ "primer3" ];
47
48 meta = with lib; {
49 description = "Oligo analysis and primer design";
50 homepage = "https://github.com/libnano/primer3-py";
51 changelog = "https://github.com/libnano/primer3-py/blob/v${version}/CHANGES";
52 license = with licenses; [ gpl2Only ];
53 maintainers = with maintainers; [ fab ];
54 };
55}