aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2022-05-26 17:28:04 +0300
committerEfraim Flashner <efraim@flashner.co.il>2022-05-26 17:30:10 +0300
commit2b8d715da510357e9386ceaf15371c99019ce596 (patch)
treece8fcf5671adbb597e94fa0caa889f0014f6e834
parent7fb0207aa22330b80294bb5d49fb6907458ce5a0 (diff)
downloadguix-2b8d715da510357e9386ceaf15371c99019ce596.tar
guix-2b8d715da510357e9386ceaf15371c99019ce596.tar.gz
gnu: qutebrowser: Find and wrap scripts.
* gnu/packages/web-browsers.scm (qutebrowser)[inputs]: Add python-pynacl. [arguments]: Add custom phase to tell qutebrowser where to find installed userscripts. Add custom phase to wrap scripts with python libraries.
-rw-r--r--gnu/packages/web-browsers.scm27
1 files changed, 27 insertions, 0 deletions
diff --git a/gnu/packages/web-browsers.scm b/gnu/packages/web-browsers.scm
index b12582dfed..01d71324ba 100644
--- a/gnu/packages/web-browsers.scm
+++ b/gnu/packages/web-browsers.scm
@@ -88,6 +88,7 @@
#:use-module (gnu packages perl)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages python)
+ #:use-module (gnu packages python-crypto)
#:use-module (gnu packages python-web)
#:use-module (gnu packages python-xyz)
#:use-module (gnu packages qt)
@@ -484,6 +485,7 @@ interface.")
python-jinja2
python-markupsafe
python-pygments
+ python-pynacl
python-pyyaml
;; FIXME: python-pyqtwebengine needs to come before python-pyqt so
;; that it's __init__.py is used first.
@@ -499,6 +501,13 @@ interface.")
#:tests? #f
#:phases
(modify-phases %standard-phases
+ (add-after 'unpack 'find-userscripts
+ (lambda* (#:key outputs #:allow-other-keys)
+ (substitute* "qutebrowser/commands/userscripts.py"
+ (("os.path.join.*system=True)")
+ (string-append "os.path.join(\""
+ (assoc-ref outputs "out")
+ "\", \"share\", \"qutebrowser\"")))))
(add-before 'check 'set-env-offscreen
(lambda _
(setenv "QT_QPA_PLATFORM" "offscreen")))
@@ -510,6 +519,24 @@ interface.")
((".*setup\\.py.*") ""))
(invoke "make" "install" (string-append "PREFIX=" out))
(delete-file-recursively (string-append out "/share/metainfo")))))
+ (add-after 'install-more 'wrap-scripts
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (python (assoc-ref inputs "python"))
+ (path (string-append out "/lib/python"
+ ,(version-major+minor (package-version
+ python))
+ "/site-packages:"
+ (getenv "GUIX_PYTHONPATH"))))
+ (for-each
+ (lambda (file)
+ (wrap-program file
+ `("GUIX_PYTHONPATH" ":" prefix (,path))))
+ (append
+ (find-files
+ (string-append out "/share/qutebrowser/scripts") "\\.py$")
+ (find-files
+ (string-append out "/share/qutebrowser/userscripts")))))))
(add-after 'wrap 'wrap-qt-process-path
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))