1{
2 stdenv,
3 lib,
4 buildPythonPackage,
5 fetchurl,
6 python,
7 pythonAtLeast,
8 apr,
9 aprutil,
10 bash,
11 gcc,
12 pycxx,
13 subversion,
14}:
15
16buildPythonPackage rec {
17 pname = "pysvn";
18 version = "1.9.23";
19 pyproject = false;
20
21 disabled = pythonAtLeast "3.13";
22
23 src = fetchurl {
24 url = "mirror://sourceforge/project/pysvn/pysvn/V${version}/pysvn-${version}.tar.gz";
25 hash = "sha256-ABru1nng1RaYfZwe0Z0NxE90rU/J2h/BhzUnvgrasCk=";
26 };
27
28 patches = [ ./replace-python-first.patch ];
29
30 buildInputs = [
31 subversion
32 apr
33 aprutil
34 ]
35 ++ lib.optionals stdenv.hostPlatform.isDarwin [ gcc ];
36
37 preConfigure = ''
38 cd Source
39 ${python.pythonOnBuildForHost.interpreter} setup.py backport
40 ${python.pythonOnBuildForHost.interpreter} setup.py configure \
41 --apr-inc-dir=${apr.dev}/include \
42 --apu-inc-dir=${aprutil.dev}/include \
43 --pycxx-dir=${pycxx.dev}/include \
44 --svn-inc-dir=${subversion.dev}/include/subversion-1 \
45 --pycxx-src-dir=${pycxx.dev}/src \
46 --apr-lib-dir=${apr.out}/lib \
47 --svn-lib-dir=${subversion.out}/lib \
48 --svn-bin-dir=${subversion.out}/bin
49 '';
50
51 checkPhase = ''
52 runHook preCheck
53
54 # It is not only shebangs, some tests also write scripts dynamically
55 # so it is easier to simply search and replace
56 sed -i "s|/bin/bash|${lib.getExe bash}|" ../Tests/test-*.sh
57 make -C ../Tests
58
59 runHook postCheck
60 '';
61
62 pythonImportsCheck = [ "pysvn" ];
63
64 installPhase = ''
65 dest=$(toPythonPath $out)/pysvn
66 mkdir -p $dest
67 cp pysvn/__init__.py $dest/
68 cp pysvn/_pysvn*.so $dest/
69 mkdir -p $out/share/doc
70 mv -v ../Docs $out/share/doc/pysvn-${version}
71 rm -v $out/share/doc/pysvn-${version}/generate_cpp_docs_from_html_docs.py
72 '';
73
74 meta = with lib; {
75 description = "Python bindings for Subversion";
76 homepage = "https://pysvn.sourceforge.io/";
77 license = licenses.asl20;
78 maintainers = with maintainers; [ dotlambda ];
79 # g++: command not found
80 broken = stdenv.hostPlatform.isDarwin;
81 };
82}