1{ lib, writeText, buildPythonPackage, isPy3k, fetchPypi
2, openldap, cyrus_sasl, openssl, pytest }:
3
4buildPythonPackage rec {
5 pname = "python-ldap";
6 version = "2.4.41";
7 name = "${pname}-${version}";
8 disabled = isPy3k;
9
10 src = fetchPypi {
11 inherit pname version;
12 sha256 = "6d430ecf040f2fc704ee316d3390cb1f5419c191371e1e131baef54a0e42cef0";
13 };
14
15 buildInputs = [ pytest ];
16
17 checkPhase = ''
18 # Needed by tests to setup a mockup ldap server.
19 export BIN="${openldap}/bin"
20 export SBIN="${openldap}/bin"
21 export SLAPD="${openldap}/libexec/slapd"
22 export SCHEMA="${openldap}/etc/schema"
23
24 # AssertionError: expected errno=107, got 57 -> nix sandbox related ?
25 py.test -k 'not TestLdapCExtension and \
26 not Test01_SimpleLDAPObject and \
27 not Test02_ReconnectLDAPObject' Tests/*.py
28 '';
29
30 patches = lib.singleton (writeText "avoid-syslog.diff" ''
31 diff a/Lib/slapdtest.py b/Lib/slapdtest.py
32 --- a/Lib/slapdtest.py
33 +++ b/Lib/slapdtest.py
34 @@ -60,7 +60,8 @@ def combined_logger(
35 pass
36 # for writing to syslog
37 new_logger = logging.getLogger(log_name)
38 - if sys_log_format:
39 + # /dev/log does not exist in nix build environment.
40 + if False:
41 my_syslog_formatter = logging.Formatter(
42 fmt=' '.join((log_name, sys_log_format)))
43 my_syslog_handler = logging.handlers.SysLogHandler(
44 '');
45
46 NIX_CFLAGS_COMPILE = "-I${cyrus_sasl.dev}/include/sasl";
47 propagatedBuildInputs = [openldap cyrus_sasl openssl];
48}