From 0b5cbca689b2f91949e191ca256ffc9bb48c1141 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Thu, 7 Mar 2024 23:37:20 +0100 Subject: gnu: python-lambda-4dn: Fix pip install. * gnu/packages/web.scm (python-lambda-4dn)[arguments]: Add phase 'fix-pip-install. [propagated-inputs]: Add python-virtualenv. Change-Id: I3722a9dd2b017d4db5ced7ac9c65603cfa98744d --- gnu/packages/web.scm | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) (limited to 'gnu/packages') diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm index 75edf7b152..e519552a36 100644 --- a/gnu/packages/web.scm +++ b/gnu/packages/web.scm @@ -3,7 +3,7 @@ ;;; Copyright © 2013 Aljosha Papsch ;;; Copyright © 2014-2024 Ludovic Courtès ;;; Copyright © 2014, 2015, 2016 Mark H Weaver -;;; Copyright © 2015-2023 Ricardo Wurmus +;;; Copyright © 2015-2024 Ricardo Wurmus ;;; Copyright © 2018 Raoul Jean Pierre Bonnal ;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer ;;; Copyright © 2015, 2016, 2017, 2018, 2019, 2020 Eric Bavier @@ -4893,9 +4893,40 @@ their web site.") "1p5i8wsi8q5fpq63i7n7ri1w1lnh4gpn17f88vhkbh14aah5wxj1")))) (properties '(("upstream-name" . "python-lambda-4dn"))) (build-system pyproject-build-system) + (arguments + (list + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'fix-pip-install + (lambda _ + (substitute* "aws_lambda/aws_lambda.py" + ;; This package uses pip to install Python packages, wrap them + ;; up, and push them to AWS Lambda. We need to reset + ;; GUIX_PYTHONPATH to avoid introducing package conflicts that + ;; would cause pip to fail. + (("(subprocess.call\\(\\[sys.executable.*'--no-cache-dir'\\])\\)" _ m) + (string-append m ", env={\"GUIX_PYTHONPATH\":\"" + #$(this-package-input "python") + "/lib/python" + #$(version-major+minor + (package-version (this-package-input "python"))) + "/site-packages/\"})")) + ;; Zipfile uses the mtime of the temporary directory to build + ;; a zip file. But the temp directory has a timestamp of 0, + ;; and zipfile refuses to build a zip archive dated before + ;; 1980. So we reset the mtime of all temp files before they + ;; are added to the zip archive. + (("^( +)arcname = os.path.join" line indent) + (string-append indent + "os.utime(os.path.join(root, file), (315619200, 315619200))\n" + line)))))))) + (inputs (list python)) (propagated-inputs - (list python-boto3 python-botocore python-docutils - python-six)) + (list python-boto3 + python-botocore + python-docutils + python-six + python-virtualenv)) (home-page "https://github.com/4dn-dcic/python-lambda") (synopsis "Toolkit for developing and deploying Python code in AWS Lambda") -- cgit v1.2.3