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.0.0";
20 pyproject = true;
21
22 src = fetchFromGitHub {
23 owner = "pyca";
24 repo = "pyopenssl";
25 tag = version;
26 hash = "sha256-CQHLEtNb2jX7WNAYlmv5EIgepetMl81Xl3AJuRqOHow=";
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 [
60 # https://github.com/pyca/pyopenssl/issues/692
61 # These tests, we disable always.
62 "test_set_default_verify_paths"
63 "test_fallback_default_verify_paths"
64 # https://github.com/pyca/pyopenssl/issues/768
65 "test_wantWriteError"
66 # https://github.com/pyca/pyopenssl/issues/1043
67 "test_alpn_call_failure"
68 ]
69 ++ lib.optionals (lib.hasPrefix "libressl" openssl.meta.name) [
70 # https://github.com/pyca/pyopenssl/issues/791
71 # These tests, we disable in the case that libressl is passed in as openssl.
72 "test_op_no_compression"
73 "test_npn_advertise_error"
74 "test_npn_select_error"
75 "test_npn_client_fail"
76 "test_npn_success"
77 "test_use_certificate_chain_file_unicode"
78 "test_use_certificate_chain_file_bytes"
79 "test_add_extra_chain_cert"
80 "test_set_session_id_fail"
81 "test_verify_with_revoked"
82 "test_set_notAfter"
83 "test_set_notBefore"
84 ]
85 ++ lib.optionals (lib.versionAtLeast (lib.getVersion openssl.name) "1.1") [
86 # these tests are extremely tightly wed to the exact output of the openssl cli tool, including exact punctuation.
87 "test_dump_certificate"
88 "test_dump_privatekey_text"
89 "test_dump_certificate_request"
90 "test_export_text"
91 ]
92 ++ lib.optionals stdenv.hostPlatform.is32bit [
93 # https://github.com/pyca/pyopenssl/issues/974
94 "test_verify_with_time"
95 ];
96
97 meta = with lib; {
98 description = "Python wrapper around the OpenSSL library";
99 homepage = "https://github.com/pyca/pyopenssl";
100 changelog = "https://github.com/pyca/pyopenssl/blob/${version}/CHANGELOG.rst";
101 license = licenses.asl20;
102 maintainers = [ ];
103 };
104}