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