nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ buildPythonPackage, fetchPypi
2, pyasn1, pyasn1-modules
3, pythonAtLeast, pytestCheckHook
4, openldap, cyrus_sasl, lib, stdenv }:
5
6buildPythonPackage rec {
7 pname = "python-ldap";
8 version = "3.4.0";
9
10 src = fetchPypi {
11 inherit pname version;
12 sha256 = "60464c8fc25e71e0fd40449a24eae482dcd0fb7fcf823e7de627a6525b3e0d12";
13 };
14
15 patches = [
16 ./0001-Check-whether-libldap-is-threadsafe-on-startup.patch
17 ];
18
19 propagatedBuildInputs = [ pyasn1 pyasn1-modules ];
20
21 checkInputs = [ pytestCheckHook ];
22 buildInputs = [ openldap cyrus_sasl ];
23
24 preCheck = ''
25 # Needed by tests to setup a mockup ldap server.
26 export BIN="${openldap}/bin"
27 export SBIN="${openldap}/bin"
28 export SLAPD="${openldap}/libexec/slapd"
29 export SCHEMA="${openldap}/etc/schema"
30 '';
31
32 disabledTests = lib.optionals (pythonAtLeast "3.9") [
33 # See https://github.com/python-ldap/python-ldap/issues/407
34 "test_simple_bind_noarg"
35 ];
36
37 doCheck = !stdenv.isDarwin;
38
39 meta = with lib; {
40 description = "Python modules for implementing LDAP clients";
41 homepage = "https://www.python-ldap.org/";
42 license = licenses.psfl;
43 };
44}