1{ lib
2, buildPythonPackage
3, fetchPypi
4, cmake
5, perl
6, stdenv
7, gcc10
8, CoreFoundation
9, Security
10, pythonOlder
11}:
12
13buildPythonPackage rec {
14 pname = "awscrt";
15 version = "0.15.1";
16 format = "setuptools";
17
18 disabled = pythonOlder "3.7";
19
20 src = fetchPypi {
21 inherit pname version;
22 hash = "sha256-2VBdad9NL19eW2Djot2gkynyjSCUvG4f0KnEub6M0vg=";
23 };
24
25 buildInputs = lib.optionals stdenv.isDarwin [
26 CoreFoundation
27 Security
28 ];
29
30 # Required to suppress -Werror
31 # https://github.com/NixOS/nixpkgs/issues/39687
32 hardeningDisable = lib.optionals stdenv.cc.isClang [
33 "strictoverflow"
34 ];
35
36 postPatch = ''
37 substituteInPlace setup.py \
38 --replace "extra_link_args += ['-Wl,-fatal_warnings']" ""
39 '';
40
41 # gcc <10 is not supported, LLVM on darwin is just fine
42 nativeBuildInputs = [
43 cmake
44 ] ++ lib.optionals (!stdenv.isDarwin && stdenv.isAarch64) [
45 gcc10
46 perl
47 ];
48
49 dontUseCmakeConfigure = true;
50
51 pythonImportsCheck = [
52 "awscrt"
53 ];
54
55 # Unable to import test module
56 # https://github.com/awslabs/aws-crt-python/issues/281
57 doCheck = false;
58
59 meta = with lib; {
60 homepage = "https://github.com/awslabs/aws-crt-python";
61 description = "Python bindings for the AWS Common Runtime";
62 license = licenses.asl20;
63 maintainers = with maintainers; [ davegallant ];
64 };
65}