1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 openssl,
7 setuptools,
8 cryptography,
9 typing-extensions,
10 pytestCheckHook,
11 pretend,
12 sphinxHook,
13 sphinx-rtd-theme,
14 pytest-rerunfailures,
15}:
16
17buildPythonPackage rec {
18 pname = "pyopenssl";
19 version = "25.1.0";
20 pyproject = true;
21
22 src = fetchFromGitHub {
23 owner = "pyca";
24 repo = "pyopenssl";
25 tag = version;
26 hash = "sha256-QF511MVyjfddmkTd2H7RNJeoWs+e0me4i55YGP4t910=";
27 };
28
29 outputs = [
30 "out"
31 "dev"
32 "doc"
33 ];
34
35 build-system = [ setuptools ];
36
37 nativeBuildInputs = [
38 openssl
39 sphinxHook
40 sphinx-rtd-theme
41 ];
42
43 pythonRelaxDeps = [ "cryptography" ];
44
45 dependencies = [
46 cryptography
47 typing-extensions
48 ];
49
50 nativeCheckInputs = [
51 pretend
52 pytest-rerunfailures
53 pytestCheckHook
54 ];
55
56 __darwinAllowLocalNetworking = true;
57
58 disabledTests = [
59 # https://github.com/pyca/pyopenssl/issues/692
60 # These tests, we disable always.
61 "test_set_default_verify_paths"
62 "test_fallback_default_verify_paths"
63 # https://github.com/pyca/pyopenssl/issues/768
64 "test_wantWriteError"
65 # https://github.com/pyca/pyopenssl/issues/1043
66 "test_alpn_call_failure"
67 ]
68 ++ lib.optionals (lib.hasPrefix "libressl" openssl.meta.name) [
69 # https://github.com/pyca/pyopenssl/issues/791
70 # These tests, we disable in the case that libressl is passed in as openssl.
71 "test_op_no_compression"
72 "test_npn_advertise_error"
73 "test_npn_select_error"
74 "test_npn_client_fail"
75 "test_npn_success"
76 "test_use_certificate_chain_file_unicode"
77 "test_use_certificate_chain_file_bytes"
78 "test_add_extra_chain_cert"
79 "test_set_session_id_fail"
80 "test_verify_with_revoked"
81 "test_set_notAfter"
82 "test_set_notBefore"
83 ]
84 ++ lib.optionals (lib.versionAtLeast (lib.getVersion openssl.name) "1.1") [
85 # these tests are extremely tightly wed to the exact output of the openssl cli tool, including exact punctuation.
86 "test_dump_certificate"
87 "test_dump_privatekey_text"
88 "test_dump_certificate_request"
89 "test_export_text"
90 ]
91 ++ lib.optionals stdenv.hostPlatform.is32bit [
92 # https://github.com/pyca/pyopenssl/issues/974
93 "test_verify_with_time"
94 ];
95
96 meta = with lib; {
97 description = "Python wrapper around the OpenSSL library";
98 homepage = "https://github.com/pyca/pyopenssl";
99 changelog = "https://github.com/pyca/pyopenssl/blob/${version}/CHANGELOG.rst";
100 license = licenses.asl20;
101 maintainers = [ ];
102 };
103}