summary refs log tree commit diff
path: root/pkgs/development/python-modules/pysvn/default.nix
blob: 33daf6af75df2070cbd4e76127f304f53d71c131 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
{ stdenv
, lib
, buildPythonPackage
, fetchurl
, isPy3k
, python
, apr
, aprutil
, bash
, e2fsprogs
, expat
, gcc
, glibcLocales
, neon
, openssl
, pycxx
, subversion
}:

buildPythonPackage rec {
  pname = "pysvn";
  version = "1.9.20";
  format = "other";

  src = fetchurl {
    url = "mirror://sourceforge/project/pysvn/pysvn/V${version}/pysvn-${version}.tar.gz";
    hash = "sha256-LbAz+KjEY3nkSJAzJNwlnSRYoWr4i1ITRUPV3ZBH7cc=";
  };

  patches = [
    ./replace-python-first.patch
  ];

  buildInputs = [ bash subversion apr aprutil expat neon openssl ]
    ++ lib.optionals stdenv.isLinux [ e2fsprogs ]
    ++ lib.optionals stdenv.isDarwin [ gcc ];

  preConfigure = ''
    cd Source
    ${python.pythonForBuild.interpreter} setup.py backport
    ${python.pythonForBuild.interpreter} setup.py configure \
      --apr-inc-dir=${apr.dev}/include \
      --apu-inc-dir=${aprutil.dev}/include \
      --pycxx-dir=${pycxx.dev}/include \
      --svn-inc-dir=${subversion.dev}/include/subversion-1 \
      --pycxx-src-dir=${pycxx.dev}/src \
      --apr-lib-dir=${apr.out}/lib \
      --svn-lib-dir=${subversion.out}/lib \
      --svn-bin-dir=${subversion.out}/bin
  '';

  nativeCheckInputs = [ glibcLocales ];

  checkPhase = ''
    runHook preCheck

    # It is not only shebangs, some tests also write scripts dynamically
    # so it is easier to simply search and replace
    sed -i "s|/bin/bash|${bash}/bin/bash|" ../Tests/test-*.sh
    make -C ../Tests

    runHook postCheck
  '';

  pythonImportsCheck = [ "pysvn" ];

  installPhase = ''
    dest=$(toPythonPath $out)/pysvn
    mkdir -p $dest
    cp pysvn/__init__.py $dest/
    cp pysvn/_pysvn*.so $dest/
    mkdir -p $out/share/doc
    mv -v ../Docs $out/share/doc/pysvn-${version}
    rm -v $out/share/doc/pysvn-${version}/generate_cpp_docs_from_html_docs.py
  '';

  meta = with lib; {
    description = "Python bindings for Subversion";
    homepage = "https://pysvn.sourceforge.io/";
    license = licenses.asl20;
    maintainers = with maintainers; [ dotlambda ];
    # g++: command not found
    broken = stdenv.isDarwin;
  };
}