1{ lib
2, stdenv
3, buildPythonPackage
4, certifi
5, CFNetwork
6, cmake
7, CoreFoundation
8, enum34
9, fetchpatch
10, fetchPypi
11, isPy3k
12, libcxxabi
13, openssl
14, Security
15, six
16}:
17
18buildPythonPackage rec {
19 pname = "uamqp";
20 version = "1.6.0";
21
22 src = fetchPypi {
23 inherit pname version;
24 sha256 = "sha256-LDG3ShCFbszyWNc8TQjlysTWBgo0uYNIkL/UK8sTg1A=";
25 };
26
27 patches = lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [
28 ./darwin-azure-c-shared-utility-corefoundation.patch
29 ];
30
31 postPatch = lib.optionalString (stdenv.isDarwin && !stdenv.isx86_64) ''
32 # force darwin aarch64 to use openssl instead of applessl, removing
33 # some quirks upstream thinks they need to use openssl on macos
34 sed -i \
35 -e '/^use_openssl =/cuse_openssl = True' \
36 -e 's/\bazssl\b/ssl/' \
37 -e 's/\bazcrypto\b/crypto/' \
38 setup.py
39 sed -i \
40 -e '/#define EVP_PKEY_id/d' \
41 src/vendor/azure-uamqp-c/deps/azure-c-shared-utility/adapters/x509_openssl.c
42 '';
43
44 nativeBuildInputs = [
45 cmake
46 ];
47
48 buildInputs = lib.optionals stdenv.isDarwin [
49 CoreFoundation
50 CFNetwork
51 Security
52 ];
53
54 propagatedBuildInputs = [
55 certifi
56 openssl
57 six
58 ] ++ lib.optionals (!isPy3k) [
59 enum34
60 ];
61
62 LDFLAGS = lib.optionals stdenv.isDarwin [
63 "-L${lib.getLib libcxxabi}/lib"
64 ];
65
66 dontUseCmakeConfigure = true;
67
68 # Project has no tests
69 doCheck = false;
70
71 pythonImportsCheck = [
72 "uamqp"
73 ];
74
75 meta = with lib; {
76 description = "An AMQP 1.0 client library for Python";
77 homepage = "https://github.com/Azure/azure-uamqp-python";
78 license = licenses.mit;
79 maintainers = with maintainers; [ maxwilson ];
80 };
81}