1{ lib
2, stdenv
3, buildPythonPackage
4, fetchFromGitHub
5, cython
6, gcc
7, click
8, pytestCheckHook
9, pythonOlder
10}:
11
12buildPythonPackage rec {
13 pname = "primer3";
14 version = "2.0.1";
15 format = "setuptools";
16
17 disabled = pythonOlder "3.7";
18
19 src = fetchFromGitHub {
20 owner = "libnano";
21 repo = "primer3-py";
22 rev = "refs/tags/v${version}";
23 hash = "sha256-WYn88Xv7WSc67TfYCq+i05tG8aKtWLUgc6axntvLF+8=";
24 };
25
26 nativeBuildInputs = [
27 cython
28 ] ++ lib.optionals stdenv.isDarwin [
29 gcc
30 ];
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 = [
46 "primer3"
47 ];
48
49 meta = with lib; {
50 description = "Oligo analysis and primer design";
51 homepage = "https://github.com/libnano/primer3-py";
52 changelog = "https://github.com/libnano/primer3-py/blob/v${version}/CHANGES";
53 license = with licenses; [ gpl2Only ];
54 maintainers = with maintainers; [ fab ];
55 };
56}