1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, setuptools
5, six
6, pytestCheckHook
7, pyopenssl
8, pyspnego
9, namedlist
10, pydes
11, cryptography
12}:
13
14buildPythonPackage rec {
15 pname = "python-tds";
16 version = "1.13.0";
17 pyproject = true;
18
19 src = fetchFromGitHub {
20 owner = "denisenkom";
21 repo = "pytds";
22 rev = version;
23 hash = "sha256-ubAXCifSfNtxbFIJZD8IuK/8oPT9vo77YBCexoO9zsw=";
24 };
25
26 postPatch = ''
27 substituteInPlace setup.py \
28 --replace "version.get_git_version()" '"${version}"'
29 '';
30
31 nativeBuildInputs = [
32 setuptools
33 ];
34
35 propagatedBuildInputs = [
36 six
37 ];
38
39 nativeCheckInputs = [
40 pytestCheckHook
41 pyopenssl
42 pyspnego
43 namedlist
44 pydes
45 cryptography
46 ];
47
48 disabledTests = [
49 # ImportError: To use NTLM authentication you need to install ntlm-auth module
50 # ntlm-auth has been removed from nixpkgs
51 "test_ntlm"
52
53 # TypeError: CertificateBuilder.add_extension() got an unexpected keyword argument 'extension'
54 # Tests are broken for pyOpenSSL>=23.0.0
55 # https://github.com/denisenkom/pytds/blob/1.13.0/test_requirements.txt
56 "test_with_simple_server_req_encryption"
57 "test_both_server_and_client_encryption_on"
58 "test_server_has_enc_on_but_client_is_off"
59 "test_only_login_encrypted"
60 "test_server_encryption_not_supported"
61 "test_server_with_bad_name_in_cert"
62 "test_cert_with_san"
63 "test_encrypted_socket"
64 ];
65
66 pythonImportsCheck = [ "pytds" ];
67
68 meta = with lib; {
69 description = "Python DBAPI driver for MSSQL using pure Python TDS (Tabular Data Stream) protocol implementation";
70 homepage = "https://python-tds.readthedocs.io/";
71 license = licenses.mit;
72 maintainers = with maintainers; [ mbalatsko ];
73 };
74}