2021-12-06 16:07:01 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2021-01-17 00:15:33 +00:00
|
|
|
, buildPythonPackage
|
2023-04-29 16:46:19 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, cython
|
2020-04-24 23:36:52 +00:00
|
|
|
, certifi
|
2021-12-06 16:07:01 +00:00
|
|
|
, CFNetwork
|
2020-04-24 23:36:52 +00:00
|
|
|
, cmake
|
2021-12-06 16:07:01 +00:00
|
|
|
, CoreFoundation
|
2022-08-21 13:32:41 +00:00
|
|
|
, libcxxabi
|
2020-04-24 23:36:52 +00:00
|
|
|
, openssl
|
2021-01-17 00:15:33 +00:00
|
|
|
, Security
|
2023-04-29 16:46:19 +00:00
|
|
|
, pytestCheckHook
|
|
|
|
, pytest-asyncio
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "uamqp";
|
2023-11-16 04:20:00 +00:00
|
|
|
version = "1.6.5";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-04-29 16:46:19 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Azure";
|
|
|
|
repo = "azure-uamqp-python";
|
2023-11-16 04:20:00 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
hash = "sha256-q8FxM4PBXLD5q68nrUJ+TGkui1yQJ3HHNF7jn+e+HkA=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
patches = lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [
|
|
|
|
./darwin-azure-c-shared-utility-corefoundation.patch
|
2023-11-16 04:20:00 +00:00
|
|
|
] ++ [
|
|
|
|
# Fix incompatible function pointer conversion error with clang 16.
|
|
|
|
./clang-fix-incompatible-function-pointer-conversion.patch
|
2022-06-16 17:23:12 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
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
|
2023-04-29 16:46:19 +00:00
|
|
|
sed -z -i \
|
|
|
|
-e 's/OpenSSL 3\nif(LINUX)/OpenSSL 3\nif(1)/' \
|
|
|
|
src/vendor/azure-uamqp-c/deps/azure-c-shared-utility/CMakeLists.txt
|
2022-06-16 17:23:12 +00:00
|
|
|
'';
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
2023-04-29 16:46:19 +00:00
|
|
|
cython
|
2021-12-06 16:07:01 +00:00
|
|
|
];
|
|
|
|
|
2023-04-29 16:46:19 +00:00
|
|
|
buildInputs = [
|
|
|
|
openssl
|
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
2021-12-06 16:07:01 +00:00
|
|
|
CoreFoundation
|
|
|
|
CFNetwork
|
|
|
|
Security
|
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
certifi
|
|
|
|
];
|
|
|
|
|
2022-08-21 13:32:41 +00:00
|
|
|
LDFLAGS = lib.optionals stdenv.isDarwin [
|
|
|
|
"-L${lib.getLib libcxxabi}/lib"
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
dontUseCmakeConfigure = true;
|
|
|
|
|
2023-04-29 16:46:19 +00:00
|
|
|
preCheck = ''
|
|
|
|
# remove src module, so tests use the installed module instead
|
|
|
|
rm -r uamqp
|
|
|
|
'';
|
|
|
|
|
|
|
|
nativeCheckInputs = [
|
|
|
|
pytestCheckHook
|
|
|
|
pytest-asyncio
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"uamqp"
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "An AMQP 1.0 client library for Python";
|
|
|
|
homepage = "https://github.com/Azure/azure-uamqp-python";
|
|
|
|
license = licenses.mit;
|
2020-11-19 00:13:47 +00:00
|
|
|
maintainers = with maintainers; [ maxwilson ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|