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 haskellPackages.bz2
56 haskellPackages.memfd
57 ]
58 ++ [
59 build
60 bzip2
61 editline
62 libedit
63 libz
64 pcre2
65 readline
66 requests
67 ];
68
69 nativeCheckInputs = [
70 pytestCheckHook
71 twine
72 gitpython
73 ];
74
75 pythonImportsCheck = [ "pcre2" ];
76
77 postCheck = ''
78 cd $out
79 rm -rf *.t* *.py requirements Makefile LICENSE *.md
80 '';
81
82 meta = {
83 description = "Python bindings for the PCRE2 library created by Philip Hazel";
84 homepage = "https://github.com/grtetrault/pcre2.py";
85 changelog = "https://github.com/grtetrault/pcre2.py/releases/tag/v{version}";
86 license = lib.licenses.bsd3;
87 maintainers = with lib.maintainers; [ tochiaha ];
88 };
89}