|
6 | 6 | , cryptography |
7 | 7 | , pyasn1 |
8 | 8 | , idna |
9 | | -, pytest |
| 9 | +, pytestCheckHook |
10 | 10 | , pretend |
11 | 11 | , flaky |
12 | 12 | , glibcLocales |
13 | 13 | , six |
14 | 14 | }: |
15 | 15 |
|
16 | | -let |
17 | | - # https://github.com/pyca/pyopenssl/issues/791 |
18 | | - # These tests, we disable in the case that libressl is passed in as openssl. |
19 | | - failingLibresslTests = [ |
| 16 | +buildPythonPackage rec { |
| 17 | + pname = "pyopenssl"; |
| 18 | + version = "21.0.0"; |
| 19 | + |
| 20 | + src = fetchPypi { |
| 21 | + pname = "pyOpenSSL"; |
| 22 | + inherit version; |
| 23 | + sha256 = "5e2d8c5e46d0d865ae933bef5230090bdaf5506281e9eec60fa250ee80600cb3"; |
| 24 | + }; |
| 25 | + |
| 26 | + outputs = [ "out" "dev" ]; |
| 27 | + |
| 28 | + # Seems to fail unpredictably on Darwin. See https://hydra.nixos.org/build/49877419/nixlog/1 |
| 29 | + # for one example, but I've also seen ContextTests.test_set_verify_callback_exception fail. |
| 30 | + doCheck = !stdenv.isDarwin; |
| 31 | + |
| 32 | + nativeBuildInputs = [ openssl ]; |
| 33 | + propagatedBuildInputs = [ cryptography pyasn1 idna six ]; |
| 34 | + |
| 35 | + checkInputs = [ pytestCheckHook pretend flaky glibcLocales ]; |
| 36 | + |
| 37 | + preCheck = '' |
| 38 | + export LANG="en_US.UTF-8" |
| 39 | + ''; |
| 40 | + |
| 41 | + disabledTests = [ |
| 42 | + # https://github.com/pyca/pyopenssl/issues/692 |
| 43 | + # These tests, we disable always. |
| 44 | + "test_set_default_verify_paths" |
| 45 | + "test_fallback_default_verify_paths" |
| 46 | + # https://github.com/pyca/pyopenssl/issues/768 |
| 47 | + "test_wantWriteError" |
| 48 | + # https://github.com/pyca/pyopenssl/issues/1043 |
| 49 | + "test_alpn_call_failure" |
| 50 | + ] ++ lib.optionals (lib.hasPrefix "libressl" openssl.meta.name) [ |
| 51 | + # https://github.com/pyca/pyopenssl/issues/791 |
| 52 | + # These tests, we disable in the case that libressl is passed in as openssl. |
20 | 53 | "test_op_no_compression" |
21 | 54 | "test_npn_advertise_error" |
22 | 55 | "test_npn_select_error" |
|
29 | 62 | "test_verify_with_revoked" |
30 | 63 | "test_set_notAfter" |
31 | 64 | "test_set_notBefore" |
32 | | - ]; |
33 | | - |
34 | | - # these tests are extremely tightly wed to the exact output of the openssl cli tool, |
35 | | - # including exact punctuation. |
36 | | - failingOpenSSL_1_1Tests = [ |
| 65 | + ] ++ lib.optionals (lib.versionAtLeast (lib.getVersion openssl.name) "1.1") [ |
| 66 | + # these tests are extremely tightly wed to the exact output of the openssl cli tool, including exact punctuation. |
37 | 67 | "test_dump_certificate" |
38 | 68 | "test_dump_privatekey_text" |
39 | 69 | "test_dump_certificate_request" |
40 | 70 | "test_export_text" |
41 | | - ]; |
42 | | - |
43 | | - disabledTests = [ |
44 | | - # https://github.com/pyca/pyopenssl/issues/692 |
45 | | - # These tests, we disable always. |
46 | | - "test_set_default_verify_paths" |
47 | | - "test_fallback_default_verify_paths" |
48 | | - # https://github.com/pyca/pyopenssl/issues/768 |
49 | | - "test_wantWriteError" |
50 | | - ] ++ ( |
51 | | - lib.optionals (lib.hasPrefix "libressl" openssl.meta.name) failingLibresslTests |
52 | | - ) ++ ( |
53 | | - lib.optionals (lib.versionAtLeast (lib.getVersion openssl.name) "1.1") failingOpenSSL_1_1Tests |
54 | | - ) ++ ( |
| 71 | + ] ++ lib.optionals stdenv.is32bit [ |
55 | 72 | # https://github.com/pyca/pyopenssl/issues/974 |
56 | | - lib.optionals stdenv.is32bit [ "test_verify_with_time" ] |
57 | | - ); |
58 | | - |
59 | | - # Compose the final string expression, including the "-k" and the single quotes. |
60 | | - testExpression = lib.optionalString (disabledTests != []) |
61 | | - "-k 'not ${lib.concatStringsSep " and not " disabledTests}'"; |
62 | | - |
63 | | -in |
64 | | - |
65 | | -buildPythonPackage rec { |
66 | | - pname = "pyopenssl"; |
67 | | - version = "20.0.1"; |
| 73 | + "test_verify_with_time" |
| 74 | + ]; |
68 | 75 |
|
69 | | - src = fetchPypi { |
70 | | - pname = "pyOpenSSL"; |
71 | | - inherit version; |
72 | | - sha256 = "4c231c759543ba02560fcd2480c48dcec4dae34c9da7d3747c508227e0624b51"; |
| 76 | + meta = with lib; { |
| 77 | + description = "Python wrapper around the OpenSSL library"; |
| 78 | + homepage = "https://github.com/pyca/pyopenssl"; |
| 79 | + license = licenses.asl20; |
| 80 | + maintainers = with maintainers; [ SuperSandro2000 ]; |
73 | 81 | }; |
74 | | - |
75 | | - outputs = [ "out" "dev" ]; |
76 | | - |
77 | | - checkPhase = '' |
78 | | - runHook preCheck |
79 | | - export LANG="en_US.UTF-8" |
80 | | - py.test tests ${testExpression} |
81 | | - runHook postCheck |
82 | | - ''; |
83 | | - |
84 | | - # Seems to fail unpredictably on Darwin. See https://hydra.nixos.org/build/49877419/nixlog/1 |
85 | | - # for one example, but I've also seen ContextTests.test_set_verify_callback_exception fail. |
86 | | - doCheck = !stdenv.isDarwin; |
87 | | - |
88 | | - nativeBuildInputs = [ openssl ]; |
89 | | - propagatedBuildInputs = [ cryptography pyasn1 idna six ]; |
90 | | - |
91 | | - checkInputs = [ pytest pretend flaky glibcLocales ]; |
92 | 82 | } |
0 commit comments