Skip to content

Commit

Permalink
Merge pull request #14664 from ocefpaf/awscrt
Browse files Browse the repository at this point in the history
add awscrt
  • Loading branch information
chrisburr authored Jun 15, 2021
2 parents 75b3b5e + 0b90514 commit 12450e4
Show file tree
Hide file tree
Showing 5 changed files with 132 additions and 0 deletions.
43 changes: 43 additions & 0 deletions recipes/awscrt/0001-Use-aws-libs-from-PREFIX.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
From d6d8f22948046b5c683d442b34d33258615a1ff6 Mon Sep 17 00:00:00 2001
From: "Uwe L. Korn" <[email protected]>
Date: Thu, 10 Jun 2021 21:51:53 +0200
Subject: [PATCH] Use aws-* libs from PREFIX

---
setup.py | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/setup.py b/setup.py
index b7fba7e..d15cb17 100644
--- a/setup.py
+++ b/setup.py
@@ -192,10 +192,6 @@ class awscrt_build_ext(setuptools.command.build_ext.build_ext):
os.chdir(prev_cwd)

def run(self):
- # build dependencies
- for lib in AWS_LIBS:
- self._build_dependency(lib)
-
# update paths so awscrt_ext can access dependencies
self.include_dirs.append(os.path.join(DEP_INSTALL_PATH, 'include'))

@@ -237,13 +233,12 @@ def awscrt_ext():
# HACK: Don't understand why, but if AWS_LIBS are linked normally on macos, we get this error:
# ImportError: dlopen(_awscrt.cpython-37m-darwin.so, 2): Symbol not found: _aws_byte_cursor_eq_ignore_case
# Workaround is to pass them as 'extra_objects' instead of 'libraries'.
- extra_objects = [os.path.join(DEP_INSTALL_PATH, 'lib', 'lib{}.a'.format(x)) for x in libraries]
- libraries = []
+ libraries = ['{}'.format(x) for x in libraries]

else: # unix
# linker will prefer shared libraries over static if it can find both.
# force linker to choose static variant by using using "-l:libcrypto.a" syntax instead of just "-lcrypto".
- libraries = [':lib{}.a'.format(x) for x in libraries]
+ libraries = ['{}'.format(x) for x in libraries]
libraries += ['rt']

if distutils.ccompiler.get_default_compiler() != 'msvc':
--
2.30.2

25 changes: 25 additions & 0 deletions recipes/awscrt/0002-Remove-Werror-from-compile-arguments.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
From f21b57a87ebfa5a875c4bf02ab5490d7af34894d Mon Sep 17 00:00:00 2001
From: "Uwe L. Korn" <[email protected]>
Date: Mon, 14 Jun 2021 14:13:08 +0200
Subject: [PATCH] Remove Werror from compile arguments

---
setup.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/setup.py b/setup.py
index d15cb17..6ca8e1e 100644
--- a/setup.py
+++ b/setup.py
@@ -242,7 +242,7 @@ def awscrt_ext():
libraries += ['rt']

if distutils.ccompiler.get_default_compiler() != 'msvc':
- extra_compile_args += ['-Wextra', '-Werror', '-Wno-strict-aliasing', '-std=gnu99']
+ extra_compile_args += ['-Wextra', '-Wno-strict-aliasing', '-std=gnu99']

return setuptools.Extension(
'_awscrt',
--
2.30.1 (Apple Git-130)

3 changes: 3 additions & 0 deletions recipes/awscrt/bld.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set AWS_C_INSTALL=%LIBRARY_PREFIX%
%PYTHON% -m pip install . -vv

6 changes: 6 additions & 0 deletions recipes/awscrt/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

set -exuo pipefail

export AWS_C_INSTALL=$PREFIX
$PYTHON -m pip install . -vv
55 changes: 55 additions & 0 deletions recipes/awscrt/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{% set name = "awscrt" %}
{% set version = "0.11.11" %}


package:
name: {{ name|lower }}
version: {{ version }}

source:
url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/awscrt-{{ version }}.tar.gz
sha256: 5a91645032bd5d112e97b70c3b7eb7d4d365ba98b94b2579a707e1daf420c104
patches:
- 0001-Use-aws-libs-from-PREFIX.patch
- 0002-Remove-Werror-from-compile-arguments.patch

build:
number: 0

requirements:
build:
- {{ compiler('c') }}
host:
- python
- pip
- s2n # [linux]
- aws-c-common
- aws-c-cal
- aws-c-io
- aws-c-event-stream
- aws-c-http
- aws-c-auth
- aws-c-mqtt
- aws-c-s3
run:
- python

test:
imports:
- awscrt
- awscrt.eventstream
commands:
- pip check
requires:
- pip

about:
home: https://github.com/awslabs/aws-crt-python
summary: A common runtime for AWS Python projects
license: Apache-2.0
license_file: crt/s2n/LICENSE

extra:
recipe-maintainers:
- ocefpaf
- xhochy

0 comments on commit 12450e4

Please sign in to comment.