nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, stdenv
3, buildPythonPackage
4, fetchPypi
5, openssl
6, cryptography
7, pytestCheckHook
8, pretend
9, flaky
10}:
11
12buildPythonPackage rec {
13 pname = "pyopenssl";
14 version = "22.0.0";
15
16 src = fetchPypi {
17 pname = "pyOpenSSL";
18 inherit version;
19 sha256 = "sha256-ZgsbFCWqxKG+odlBaKhdmfCzFEyGndQ5DSdinQCH8b8=";
20 };
21
22 outputs = [ "out" "dev" ];
23
24 # Seems to fail unpredictably on Darwin. See https://hydra.nixos.org/build/49877419/nixlog/1
25 # for one example, but I've also seen ContextTests.test_set_verify_callback_exception fail.
26 doCheck = !stdenv.isDarwin;
27
28 nativeBuildInputs = [ openssl ];
29 propagatedBuildInputs = [ cryptography ];
30
31 checkInputs = [ pytestCheckHook pretend flaky ];
32
33 preCheck = ''
34 export LANG="en_US.UTF-8"
35 '';
36
37 disabledTests = [
38 # https://github.com/pyca/pyopenssl/issues/692
39 # These tests, we disable always.
40 "test_set_default_verify_paths"
41 "test_fallback_default_verify_paths"
42 # https://github.com/pyca/pyopenssl/issues/768
43 "test_wantWriteError"
44 # https://github.com/pyca/pyopenssl/issues/1043
45 "test_alpn_call_failure"
46 ] ++ lib.optionals (lib.hasPrefix "libressl" openssl.meta.name) [
47 # https://github.com/pyca/pyopenssl/issues/791
48 # These tests, we disable in the case that libressl is passed in as openssl.
49 "test_op_no_compression"
50 "test_npn_advertise_error"
51 "test_npn_select_error"
52 "test_npn_client_fail"
53 "test_npn_success"
54 "test_use_certificate_chain_file_unicode"
55 "test_use_certificate_chain_file_bytes"
56 "test_add_extra_chain_cert"
57 "test_set_session_id_fail"
58 "test_verify_with_revoked"
59 "test_set_notAfter"
60 "test_set_notBefore"
61 ] ++ lib.optionals (lib.versionAtLeast (lib.getVersion openssl.name) "1.1") [
62 # these tests are extremely tightly wed to the exact output of the openssl cli tool, including exact punctuation.
63 "test_dump_certificate"
64 "test_dump_privatekey_text"
65 "test_dump_certificate_request"
66 "test_export_text"
67 ] ++ lib.optionals stdenv.is32bit [
68 # https://github.com/pyca/pyopenssl/issues/974
69 "test_verify_with_time"
70 ];
71
72 meta = with lib; {
73 description = "Python wrapper around the OpenSSL library";
74 homepage = "https://github.com/pyca/pyopenssl";
75 license = licenses.asl20;
76 maintainers = with maintainers; [ SuperSandro2000 ];
77 # https://github.com/pyca/pyopenssl/issues/873
78 broken = stdenv.isDarwin && stdenv.isAarch64;
79 };
80}