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 substituteInPlace _version.json \
28 --replace-fail '"version": "2.9",' '"version": "${version}",'
29 '';
30
31 patches = [
32 # fix pyasn1 0.5.0 compatibility
33 # https://github.com/cannatag/ldap3/pull/983
34 (fetchpatch {
35 url = "https://github.com/cannatag/ldap3/commit/ca689f4893b944806f90e9d3be2a746ee3c502e4.patch";
36 hash = "sha256-A8qI0t1OV3bkKaSdhVWHFBC9MoSkWynqxpgznV+5gh8=";
37 })
38 ];
39
40 nativeBuildInputs = [ dos2unix ];
41
42 build-system = [ setuptools ];
43
44 dependencies = [ pyasn1 ];
45
46 nativeCheckInputs = [ unittestCheckHook ];
47
48 enabledTestPaths = [ "test/" ];
49
50 preCheck = ''
51 export SERVER=NONE
52 '';
53
54 meta = with lib; {
55 homepage = "https://github.com/cannatag/ldap3";
56 description = "Strictly RFC 4510 conforming LDAP V3 pure Python client library";
57 license = licenses.lgpl3Plus;
58 maintainers = [ ];
59 };
60}