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.
This commit is contained in:
		
							parent
							
								
									7fb0207aa2
								
							
						
					
					
						commit
						2b8d715da5
					
				
					 1 changed files with 27 additions and 0 deletions
				
			
		|  | @ -88,6 +88,7 @@ | ||||||
|   #:use-module (gnu packages perl) |   #:use-module (gnu packages perl) | ||||||
|   #:use-module (gnu packages pkg-config) |   #:use-module (gnu packages pkg-config) | ||||||
|   #:use-module (gnu packages python) |   #:use-module (gnu packages python) | ||||||
|  |   #:use-module (gnu packages python-crypto) | ||||||
|   #:use-module (gnu packages python-web) |   #:use-module (gnu packages python-web) | ||||||
|   #:use-module (gnu packages python-xyz) |   #:use-module (gnu packages python-xyz) | ||||||
|   #:use-module (gnu packages qt) |   #:use-module (gnu packages qt) | ||||||
|  | @ -484,6 +485,7 @@ interface.") | ||||||
|            python-jinja2 |            python-jinja2 | ||||||
|            python-markupsafe |            python-markupsafe | ||||||
|            python-pygments |            python-pygments | ||||||
|  |            python-pynacl | ||||||
|            python-pyyaml |            python-pyyaml | ||||||
|            ;; FIXME: python-pyqtwebengine needs to come before python-pyqt so |            ;; FIXME: python-pyqtwebengine needs to come before python-pyqt so | ||||||
|            ;; that it's __init__.py is used first. |            ;; that it's __init__.py is used first. | ||||||
|  | @ -499,6 +501,13 @@ interface.") | ||||||
|        #:tests? #f |        #:tests? #f | ||||||
|        #:phases |        #:phases | ||||||
|        (modify-phases %standard-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 |          (add-before 'check 'set-env-offscreen | ||||||
|            (lambda _ |            (lambda _ | ||||||
|              (setenv "QT_QPA_PLATFORM" "offscreen"))) |              (setenv "QT_QPA_PLATFORM" "offscreen"))) | ||||||
|  | @ -510,6 +519,24 @@ interface.") | ||||||
|                  ((".*setup\\.py.*") "")) |                  ((".*setup\\.py.*") "")) | ||||||
|                (invoke "make" "install" (string-append "PREFIX=" out)) |                (invoke "make" "install" (string-append "PREFIX=" out)) | ||||||
|                (delete-file-recursively (string-append out "/share/metainfo"))))) |                (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 |          (add-after 'wrap 'wrap-qt-process-path | ||||||
|            (lambda* (#:key inputs outputs #:allow-other-keys) |            (lambda* (#:key inputs outputs #:allow-other-keys) | ||||||
|              (let* ((out (assoc-ref outputs "out")) |              (let* ((out (assoc-ref outputs "out")) | ||||||
|  |  | ||||||
		Reference in a new issue