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 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ gcc ];
35
36 preConfigure = ''
37 cd Source
38 ${python.pythonOnBuildForHost.interpreter} setup.py backport
39 ${python.pythonOnBuildForHost.interpreter} setup.py configure \
40 --apr-inc-dir=${apr.dev}/include \
41 --apu-inc-dir=${aprutil.dev}/include \
42 --pycxx-dir=${pycxx.dev}/include \
43 --svn-inc-dir=${subversion.dev}/include/subversion-1 \
44 --pycxx-src-dir=${pycxx.dev}/src \
45 --apr-lib-dir=${apr.out}/lib \
46 --svn-lib-dir=${subversion.out}/lib \
47 --svn-bin-dir=${subversion.out}/bin
48 '';
49
50 checkPhase = ''
51 runHook preCheck
52
53 # It is not only shebangs, some tests also write scripts dynamically
54 # so it is easier to simply search and replace
55 sed -i "s|/bin/bash|${lib.getExe bash}|" ../Tests/test-*.sh
56 make -C ../Tests
57
58 runHook postCheck
59 '';
60
61 pythonImportsCheck = [ "pysvn" ];
62
63 installPhase = ''
64 dest=$(toPythonPath $out)/pysvn
65 mkdir -p $dest
66 cp pysvn/__init__.py $dest/
67 cp pysvn/_pysvn*.so $dest/
68 mkdir -p $out/share/doc
69 mv -v ../Docs $out/share/doc/pysvn-${version}
70 rm -v $out/share/doc/pysvn-${version}/generate_cpp_docs_from_html_docs.py
71 '';
72
73 meta = with lib; {
74 description = "Python bindings for Subversion";
75 homepage = "https://pysvn.sourceforge.io/";
76 license = licenses.asl20;
77 maintainers = with maintainers; [ dotlambda ];
78 # g++: command not found
79 broken = stdenv.hostPlatform.isDarwin;
80 };
81}