aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2024-11-13 18:16:20 +0100
committerSharlatan Hellseher <sharlatanus@gmail.com>2024-11-18 20:19:42 +0000
commitad876569dc35a0711e2f3931f4be3db83731d473 (patch)
treed762db9dd3477316c47c0c80e8a9294daf49d959
parent25d340a0e33ef007a7bdb4e9d8c5bfde26683465 (diff)
downloadguix-ad876569dc35a0711e2f3931f4be3db83731d473.tar
guix-ad876569dc35a0711e2f3931f4be3db83731d473.tar.gz
gnu: Add python-awscrt.
* gnu/packages/python-web.scm (python-awscrt): New variable. Change-Id: I1c08a06fdb1ea9811c183d3711f092edd12cdca7
-rw-r--r--gnu/packages/python-web.scm74
1 files changed, 74 insertions, 0 deletions
diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
index 32662503a1..eab9a7efc5 100644
--- a/gnu/packages/python-web.scm
+++ b/gnu/packages/python-web.scm
@@ -100,6 +100,7 @@
#:use-module (gnu packages bash)
#:use-module (gnu packages certs)
#:use-module (gnu packages check)
+ #:use-module (gnu packages cmake)
#:use-module (gnu packages compression)
#:use-module (gnu packages crates-io)
#:use-module (gnu packages crates-web)
@@ -4132,6 +4133,79 @@ can reuse the same socket connection for multiple requests, it can POST files,
supports url redirection and retries, and also gzip and deflate decoding.")
(license license:expat)))
+(define-public python-awscrt
+ (package
+ (name "python-awscrt")
+ (version "0.23.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (pypi-uri "awscrt" version))
+ (sha256
+ (base32 "0a669xxfmgw3g6xpcnm64pbmlrbxw5wf3jcrivixscl2glapdxgx"))))
+ (build-system pyproject-build-system)
+ (arguments
+ (list
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'disable-broken-tests
+ (lambda _
+ ;; Disable broken tests. These tests fail because the
+ ;; certificate bundle at the default location does not exist.
+ (substitute* "test/test_auth.py"
+ (("def test_default_provider")
+ "def _test_default_provider"))
+ (substitute* "test/test_http_client.py"
+ (("def test_h2_client")
+ "def _test_h2_client"))
+ (substitute* "test/test_s3.py"
+ (("def test_sanity")
+ "def _test_sanity")
+ (("def test_sanity_secure")
+ "def _test_sanity_secure")
+ (("def test_wait_shutdown")
+ "def _test_wait_shutdown"))))
+ (add-after 'unpack 'override-cert-bundle-location
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((bundle (search-input-file inputs
+ "/etc/ssl/certs/ca-certificates.crt")))
+ (setenv "SSL_CERT_FILE" bundle)
+ (substitute* "awscrt/io.py"
+ (("( +)opt = TlsContextOptions\\(\\)" m indent)
+ (string-append m "\n"
+ indent "import os\n"
+ indent "\
+opt.override_default_trust_store_from_path(None, os.getenv('SSL_CERT_FILE')) if os.getenv('SSL_CERT_FILE') else None\n")))
+ (substitute* "test/appexit_http.py"
+ (("( +)tls_ctx_opt = awscrt.io.TlsContextOptions.*" m indent)
+ (string-append m indent
+ "tls_ctx_opt.override_default_trust_store_from_path(None, '"
+ bundle "')\n")))
+ (substitute* "test/test_io.py"
+ (("( +)opt = TlsContextOptions\\(\\).*" m indent)
+ (string-append m indent
+ "opt.override_default_trust_store_from_path(None, '"
+ bundle "')\n"))))))
+ (add-after 'unpack 'use-system-libraries
+ (lambda _
+ (setenv "AWS_CRT_BUILD_USE_SYSTEM_LIBCRYPTO" "1")))
+ (replace 'check
+ (lambda* (#:key tests? #:allow-other-keys)
+ (when tests?
+ (invoke "python3" "-m" "unittest"
+ "discover" "--verbose")))))))
+ (inputs (list openssl))
+ (native-inputs (list cmake-minimal
+ ;; For tests only
+ nss-certs-for-test
+ python-boto3
+ python-websockets))
+ (home-page "https://github.com/awslabs/aws-crt-python")
+ (synopsis "Common runtime for AWS Python projects")
+ (description
+ "This package provides a common runtime for AWS Python projects.")
+ (license license:asl2.0)))
+
(define-public awscli
(package
;; Note: updating awscli typically requires updating botocore as well.