nix-bitcoin/pkgs/python-packages/specific-versions/cryptography_41/default.nix
Jonas Nick c1b370aaa6
update nixpkgs
btcpayserver: 1.11.2 -> 1.11.4
clightning: 23.05.2 -> 23.08.1
hwi: 2.2.1 -> 2.3.1

Remove custom coincurve, since nixos-23.05 includes the latest version
of coincurve (18) that's required by pyln-proto.

Co-authored-by: Erik Arvstedt <erik.arvstedt@gmail.com>
2023-09-16 13:40:27 +00:00

117 lines
2.6 KiB
Nix

{ lib
, stdenv
, buildPythonPackage
, callPackage
, cargo
, cffi
, fetchPypi
, hypothesis
, iso8601
, isPyPy
, libiconv
, libxcrypt
, openssl
, pkg-config
, pretend
, py
, pytest-subtests
, pytestCheckHook
, pythonOlder
, pytz
, rustc
, rustPlatform
, Security
, setuptoolsRustBuildHook
}:
let
cryptography-vectors = callPackage ./vectors.nix { };
in
buildPythonPackage rec {
pname = "cryptography";
version = "41.0.3"; # Also update the hash in vectors.nix
format = "pyproject";
disabled = pythonOlder "3.7";
src = fetchPypi {
inherit pname version;
hash = "sha256-bRknQRE+9eMNidy1uVbvThV48wRwhwG4tz044+FGHzQ=";
};
cargoDeps = rustPlatform.fetchCargoTarball {
inherit src;
sourceRoot = "${pname}-${version}/${cargoRoot}";
name = "${pname}-${version}";
hash = "sha256-LQu7waympGUs+CZun2yDQd2gUUAgyisKBG5mddrfSo0=";
};
postPatch = ''
substituteInPlace pyproject.toml \
--replace "--benchmark-disable" ""
'';
cargoRoot = "src/rust";
nativeBuildInputs = [
rustPlatform.cargoSetupHook
setuptoolsRustBuildHook
cargo
rustc
pkg-config
] ++ lib.optionals (!isPyPy) [
cffi
];
buildInputs = [
openssl
] ++ lib.optionals stdenv.isDarwin [
Security
libiconv
] ++ lib.optionals (pythonOlder "3.9") [
libxcrypt
];
propagatedBuildInputs = lib.optionals (!isPyPy) [
cffi
];
nativeCheckInputs = [
cryptography-vectors
# Work around `error: infinite recursion encountered`
(hypothesis.override { enableDocumentation = false; })
iso8601
pretend
py
pytestCheckHook
pytest-subtests
pytz
];
pytestFlagsArray = [
"--disable-pytest-warnings"
];
disabledTestPaths = [
# save compute time by not running benchmarks
"tests/bench"
] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
# aarch64-darwin forbids W+X memory, but this tests depends on it:
# * https://cffi.readthedocs.io/en/latest/using.html#callbacks
"tests/hazmat/backends/test_openssl_memleak.py"
];
meta = with lib; {
description = "A package which provides cryptographic recipes and primitives";
longDescription = ''
Cryptography includes both high level recipes and low level interfaces to
common cryptographic algorithms such as symmetric ciphers, message
digests, and key derivation functions.
'';
homepage = "https://github.com/pyca/cryptography";
changelog = "https://cryptography.io/en/latest/changelog/#v"
+ replaceStrings [ "." ] [ "-" ] version;
license = with licenses; [ asl20 bsd3 psfl ];
maintainers = with maintainers; [ SuperSandro2000 ];
};
}