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