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