summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/ldap3/default.nix
blob: 4d4b6997409ac7bb8722cd8e91951de0e061c781 (about) (plain)
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
{
  lib,
  fetchFromGitHub,
  fetchpatch,
  buildPythonPackage,
  dos2unix,
  setuptools,
  pyasn1,
  unittestCheckHook,
}:

buildPythonPackage rec {
  pname = "ldap3";
  version = "2.9.1";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "cannatag";
    repo = "ldap3";
    tag = "v${version}";
    hash = "sha256-B+Sb6zMifkSKfaPYrXML5ugHGanbH5CPKeVdHshe3R4=";
  };

  prePatch = ''
    # patch fails to apply because of line endings
    dos2unix ldap3/utils/asn1.py
    substituteInPlace _version.json \
      --replace-fail '"version": "2.9",' '"version": "${version}",'
  '';

  patches = [
    # fix pyasn1 0.5.0 compatibility
    # https://github.com/cannatag/ldap3/pull/983
    (fetchpatch {
      url = "https://github.com/cannatag/ldap3/commit/ca689f4893b944806f90e9d3be2a746ee3c502e4.patch";
      hash = "sha256-A8qI0t1OV3bkKaSdhVWHFBC9MoSkWynqxpgznV+5gh8=";
    })
  ];

  nativeBuildInputs = [ dos2unix ];

  build-system = [ setuptools ];

  dependencies = [ pyasn1 ];

  nativeCheckInputs = [ unittestCheckHook ];

  enabledTestPaths = [ "test/" ];

  preCheck = ''
    export SERVER=NONE
  '';

  meta = with lib; {
    homepage = "https://github.com/cannatag/ldap3";
    description = "Strictly RFC 4510 conforming LDAP V3 pure Python client library";
    license = licenses.lgpl3Plus;
    maintainers = [ ];
  };
}