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