summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/pcre2-py/default.nix
blob: 893ca748162fb37850fd05ca881cdb44a6a40d7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
{
  build,
  bzip2,
  cmake,
  cython,
  editline,
  gitpython,
  pytestCheckHook,
  buildPythonPackage,
  fetchFromGitHub,
  haskellPackages,
  lib,
  libedit,
  libz,
  pcre2,
  scikit-build,
  setuptools,
  twine,
  readline,
  requests,
}:

buildPythonPackage rec {
  pname = "pcre2-py";
  version = "0.5.2";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "grtetrault";
    repo = "pcre2.py";
    tag = "v${version}";
    hash = "sha256-W3oKluXC4orw1ThYM1Beeu8+6rNMr8FSCqep84SmXLE=";
    fetchSubmodules = false;
  };

  postPatch = ''
    substituteInPlace CMakeLists.txt \
      --replace-fail "add_subdirectory(src/libpcre2)" "" \
      --replace-fail "install" "#install"
    substituteInPlace src/pcre2/CMakeLists.txt \
      --replace-fail "\''${PCRE2_INCLUDE_DIR}" "${pcre2.dev}/include" \
      --replace-fail "pcre2-8-static" "pcre2-8"
  '';

  dontUseCmakeConfigure = true;

  build-system = [
    cmake
    cython
    scikit-build
    setuptools
  ];

  dependencies = [
    haskellPackages.bz2
    haskellPackages.memfd
  ]
  ++ [
    build
    bzip2
    editline
    libedit
    libz
    pcre2
    readline
    requests
  ];

  nativeCheckInputs = [
    pytestCheckHook
    twine
    gitpython
  ];

  pythonImportsCheck = [ "pcre2" ];

  postCheck = ''
    cd $out
    rm -rf *.t* *.py requirements Makefile LICENSE *.md
  '';

  meta = {
    description = "Python bindings for the PCRE2 library created by Philip Hazel";
    homepage = "https://github.com/grtetrault/pcre2.py";
    changelog = "https://github.com/grtetrault/pcre2.py/releases/tag/v${version}";
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [ tochiaha ];
  };
}