1{
2 build,
3 bzip2,
4 cmake,
5 cython,
6 editline,
7 gitpython,
8 pytestCheckHook,
9 buildPythonPackage,
10 fetchFromGitHub,
11 haskellPackages,
12 lib,
13 libedit,
14 libz,
15 pcre2,
16 scikit-build,
17 setuptools,
18 twine,
19 readline,
20 requests,
21}:
22
23buildPythonPackage rec {
24 pname = "pcre2-py";
25 version = "0.5.2";
26 pyproject = true;
27
28 src = fetchFromGitHub {
29 owner = "grtetrault";
30 repo = "pcre2.py";
31 tag = "v${version}";
32 hash = "sha256-W3oKluXC4orw1ThYM1Beeu8+6rNMr8FSCqep84SmXLE=";
33 fetchSubmodules = false;
34 };
35
36 postPatch = ''
37 substituteInPlace CMakeLists.txt \
38 --replace-fail "add_subdirectory(src/libpcre2)" "" \
39 --replace-fail "install" "#install"
40 substituteInPlace src/pcre2/CMakeLists.txt \
41 --replace-fail "\''${PCRE2_INCLUDE_DIR}" "${pcre2.dev}/include" \
42 --replace-fail "pcre2-8-static" "pcre2-8"
43 '';
44
45 dontUseCmakeConfigure = true;
46
47 build-system = [
48 cmake
49 cython
50 scikit-build
51 setuptools
52 ];
53
54 dependencies =
55 [
56 haskellPackages.bz2
57 haskellPackages.memfd
58 ]
59 ++ [
60 build
61 bzip2
62 editline
63 libedit
64 libz
65 pcre2
66 readline
67 requests
68 ];
69
70 nativeCheckInputs = [
71 pytestCheckHook
72 twine
73 gitpython
74 ];
75
76 pythonImportsCheck = [ "pcre2" ];
77
78 postCheck = ''
79 cd $out
80 rm -rf *.t* *.py requirements Makefile LICENSE *.md
81 '';
82
83 meta = {
84 description = "Python bindings for the PCRE2 library created by Philip Hazel";
85 homepage = "https://github.com/grtetrault/pcre2.py";
86 changelog = "https://github.com/grtetrault/pcre2.py/releases/tag/v{version}";
87 license = lib.licenses.bsd3;
88 maintainers = with lib.maintainers; [ tochiaha ];
89 };
90}