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.1.0";
17 pyproject = true;
18
19 disabled = pythonOlder "3.7";
20
21 src = fetchFromGitHub {
22 owner = "libnano";
23 repo = "primer3-py";
24 tag = "v${version}";
25 hash = "sha256-Kp4JH57gEdj7SzY+7XGBzGloWuTSwUQRBK9QbgXQfUE=";
26 };
27
28 build-system = [ setuptools ];
29
30 nativeBuildInputs = [ cython ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ gcc ];
31
32 nativeCheckInputs = [
33 click
34 pytestCheckHook
35 ];
36 # We are not sure why exactly this is need. It seems `pytestCheckHook`
37 # doesn't find extension modules installed in $out/${python.sitePackages},
38 # and the tests rely upon them. This was initially reported upstream at
39 # https://github.com/libnano/primer3-py/issues/120 and we investigate this
40 # downstream at: https://github.com/NixOS/nixpkgs/issues/255262.
41 preCheck = ''
42 python setup.py build_ext --inplace
43 '';
44
45 pythonImportsCheck = [ "primer3" ];
46
47 meta = with lib; {
48 description = "Oligo analysis and primer design";
49 homepage = "https://github.com/libnano/primer3-py";
50 changelog = "https://github.com/libnano/primer3-py/blob/${src.tag}/CHANGES";
51 license = licenses.gpl2Only;
52 maintainers = with maintainers; [ fab ];
53 };
54}