1{
2 lib,
3 fetchFromGitHub,
4 fetchpatch,
5 buildPythonPackage,
6 dos2unix,
7 setuptools,
8 pyasn1,
9 unittestCheckHook,
10}:
11
12buildPythonPackage rec {
13 pname = "ldap3";
14 version = "2.9.1";
15 pyproject = true;
16
17 src = fetchFromGitHub {
18 owner = "cannatag";
19 repo = "ldap3";
20 tag = "v${version}";
21 hash = "sha256-B+Sb6zMifkSKfaPYrXML5ugHGanbH5CPKeVdHshe3R4=";
22 };
23
24 prePatch = ''
25 # patch fails to apply because of line endings
26 dos2unix ldap3/utils/asn1.py
27 '';
28
29 patches = [
30 # fix pyasn1 0.5.0 compatibility
31 # https://github.com/cannatag/ldap3/pull/983
32 (fetchpatch {
33 url = "https://github.com/cannatag/ldap3/commit/ca689f4893b944806f90e9d3be2a746ee3c502e4.patch";
34 hash = "sha256-A8qI0t1OV3bkKaSdhVWHFBC9MoSkWynqxpgznV+5gh8=";
35 })
36 ];
37
38 nativeBuildInputs = [ dos2unix ];
39
40 build-system = [ setuptools ];
41
42 dependencies = [ pyasn1 ];
43
44 nativeCheckInputs = [ unittestCheckHook ];
45
46 enabledTestPaths = [ "test/" ];
47
48 preCheck = ''
49 export SERVER=NONE
50 '';
51
52 meta = with lib; {
53 homepage = "https://github.com/cannatag/ldap3";
54 description = "Strictly RFC 4510 conforming LDAP V3 pure Python client library";
55 license = licenses.lgpl3;
56 maintainers = [ ];
57 };
58}