1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 openssl,
7 setuptools,
8 cryptography,
9 pytestCheckHook,
10 pretend,
11 sphinxHook,
12 sphinx-rtd-theme,
13 pytest-rerunfailures,
14}:
15
16buildPythonPackage rec {
17 pname = "pyopenssl";
18 version = "24.2.1";
19 pyproject = true;
20
21 src = fetchFromGitHub {
22 owner = "pyca";
23 repo = "pyopenssl";
24 rev = "refs/tags/${version}";
25 hash = "sha256-/TQnDWdycN4hQ7ZGvBhMJEZVafmL+0wy9eJ8hC6rfio=";
26 };
27
28 outputs = [
29 "out"
30 "dev"
31 "doc"
32 ];
33
34 build-system = [ setuptools ];
35
36 nativeBuildInputs = [
37 openssl
38 sphinxHook
39 sphinx-rtd-theme
40 ];
41
42 pythonRelaxDeps = [ "cryptography" ];
43
44 dependencies = [ cryptography ];
45
46 nativeCheckInputs = [
47 pretend
48 pytest-rerunfailures
49 pytestCheckHook
50 ];
51
52 __darwinAllowLocalNetworking = true;
53
54 preCheck = ''
55 export LANG="en_US.UTF-8"
56 '';
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}