From 53d6b0e185335b43217cd7132719bc6e80c744c1 Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Thu, 17 Nov 2022 09:36:40 +0100 Subject: add WSGI script and fix licenses in Guix package definition --- guix.scm | 31 ++++++++++++++++++++++++++++++- wsgi.py | 14 ++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 wsgi.py diff --git a/guix.scm b/guix.scm index 9717135..7277e95 100644 --- a/guix.scm +++ b/guix.scm @@ -49,6 +49,32 @@ ;; checkout. We instead build from source tarball generated under ./dist/. (local-file (string-append %source-dir "/dist/" source-tarball-name))) (build-system python-build-system) + (arguments + `(#:phases + (modify-phases %standard-phases + (add-after 'unpack 'replace-wsgi.py + (lambda* (#:key inputs outputs #:allow-other-keys) + ;; In the wsgi.py file, embed the PYTHONPATH containing both the + ;; dependencies and the python modules of this package. This will + ;; make them available at runtime. + (let ((pythonpath + (string-append (getenv "GUIX_PYTHONPATH") + ":" + (site-packages inputs outputs)))) + (substitute* "wsgi.py" + (("^from .* import .*" import-line) + (string-append + "# Make Guix-installed dependencies visible to Python.\n" + "import sys\n" + "sys.path.extend('" pythonpath "'.split(':'))\n" + "\n" + import-line)))))) + (add-after 'install 'install-wsgi-script + (lambda* (#:key inputs outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (share-dir (string-append out "/share/koszko-org-website"))) + (mkdir-p share-dir) + (copy-file "wsgi.py" (string-append share-dir "/wsgi.py")))))))) (propagated-inputs (list python-flask)) (native-inputs @@ -60,7 +86,10 @@ (synopsis "koszko.org website") (description "This is the packaging of the website at https://koszko.org.") (license (list license:cc0 + license:cc-by3.0 (license:non-copyleft "file://LICENSES/LicenseRef-Yahoo-BSD-3.txt") (license:x11-style - "file://LICENSES/LicenseRef-Normalize-CSS-MIT.txt")))) + "file://LICENSES/LicenseRef-Normalize-CSS-MIT.txt") + (license:fsdg-compatible + "file://LICENSES/LicenseRef-no-facebook.txt")))) diff --git a/wsgi.py b/wsgi.py new file mode 100644 index 0000000..daebfc8 --- /dev/null +++ b/wsgi.py @@ -0,0 +1,14 @@ +# SPDX-License-Identifier: CC0-1.0 + +# WSGI script for koszko.org website. +# +# Copyright (C) 2022 Wojtek Kosior + +# Uncomment the lines below if you want to use a virtualenv installation of +# the website package. + +#from pathlib import Path +#path = Path('/path/to/virtualenv/bin/activate_this.py') +#exec(path.read_text(), {'__file__': str(path)}) + +from koszko_org_website.app import website_app as application -- cgit v1.2.3