nixpkgs/pkgs/development/python-modules/uamqp/default.nix
2023-01-05 13:20:39 +01:00

81 lines
1.6 KiB
Nix

{ lib
, stdenv
, buildPythonPackage
, certifi
, CFNetwork
, cmake
, CoreFoundation
, enum34
, fetchpatch
, fetchPypi
, isPy3k
, libcxxabi
, openssl
, Security
, six
}:
buildPythonPackage rec {
pname = "uamqp";
version = "1.6.3";
src = fetchPypi {
inherit pname version;
sha256 = "sha256-fOA+tGANKKHeq0uGbzd9Tq5/yc3Gfj6I94jV8daD3IY=";
};
patches = lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [
./darwin-azure-c-shared-utility-corefoundation.patch
];
postPatch = lib.optionalString (stdenv.isDarwin && !stdenv.isx86_64) ''
# force darwin aarch64 to use openssl instead of applessl, removing
# some quirks upstream thinks they need to use openssl on macos
sed -i \
-e '/^use_openssl =/cuse_openssl = True' \
-e 's/\bazssl\b/ssl/' \
-e 's/\bazcrypto\b/crypto/' \
setup.py
sed -i \
-e '/#define EVP_PKEY_id/d' \
src/vendor/azure-uamqp-c/deps/azure-c-shared-utility/adapters/x509_openssl.c
'';
nativeBuildInputs = [
cmake
];
buildInputs = lib.optionals stdenv.isDarwin [
CoreFoundation
CFNetwork
Security
];
propagatedBuildInputs = [
certifi
openssl
six
] ++ lib.optionals (!isPy3k) [
enum34
];
LDFLAGS = lib.optionals stdenv.isDarwin [
"-L${lib.getLib libcxxabi}/lib"
];
dontUseCmakeConfigure = true;
# Project has no tests
doCheck = false;
pythonImportsCheck = [
"uamqp"
];
meta = with lib; {
description = "An AMQP 1.0 client library for Python";
homepage = "https://github.com/Azure/azure-uamqp-python";
license = licenses.mit;
maintainers = with maintainers; [ maxwilson ];
};
}