1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 fetchFromGitHub, 6 pythonAtLeast, 7 pythonOlder, 8 9 # build-system 10 setuptools, 11 12 # native dependencies 13 openldap, 14 cyrus_sasl, 15 16 # dependencies 17 pyasn1, 18 pyasn1-modules, 19 20 # tests 21 pytestCheckHook, 22}: 23 24buildPythonPackage rec { 25 pname = "python-ldap"; 26 version = "3.4.4"; 27 pyproject = true; 28 29 disabled = pythonOlder "3.6" || pythonAtLeast "3.12"; # requires distutils 30 31 src = fetchFromGitHub { 32 owner = "python-ldap"; 33 repo = "python-ldap"; 34 rev = "refs/tags/python-ldap-${version}"; 35 hash = "sha256-v1cWoRGxbvvFnHqnwoIfmiQQcxfaA8Bf3+M5bE5PtuU="; 36 }; 37 38 build-system = [ setuptools ]; 39 40 buildInputs = [ 41 openldap 42 cyrus_sasl 43 ]; 44 45 dependencies = [ 46 pyasn1 47 pyasn1-modules 48 ]; 49 50 nativeCheckInputs = [ pytestCheckHook ]; 51 52 preCheck = '' 53 # Needed by tests to setup a mockup ldap server. 54 export BIN="${openldap}/bin" 55 export SBIN="${openldap}/bin" 56 export SLAPD="${openldap}/libexec/slapd" 57 export SCHEMA="${openldap}/etc/schema" 58 ''; 59 60 disabledTests = [ 61 # https://github.com/python-ldap/python-ldap/issues/501 62 "test_tls_ext_noca" 63 ]; 64 65 doCheck = !stdenv.isDarwin; 66 67 meta = with lib; { 68 changelog = "https://github.com/python-ldap/python-ldap/releases/tag/python-ldap-${version}"; 69 description = "Python modules for implementing LDAP clients"; 70 downloadPage = "https://github.com/python-ldap/python-ldap"; 71 homepage = "https://www.python-ldap.org/"; 72 license = licenses.psfl; 73 }; 74}