mirror of
https://codeberg.org/guix/guix.git
synced 2026-01-25 03:55:08 -06:00
gnu: hplip: Switch to pyproject.
* gnu/packages/cups.scm (hplip): [arguments]<#:imported-modules, #:modules, #:phases>: Switch to pyproject-build-system. Change-Id: I0150ce69467c4409ce6dfa45d094304d42c98f01 Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
This commit is contained in:
parent
b3b4c43661
commit
2277a2b6b3
1 changed files with 95 additions and 95 deletions
|
|
@ -623,11 +623,10 @@ should only be used as part of the Guix cups-pk-helper service.")
|
|||
(build-system gnu-build-system)
|
||||
(arguments
|
||||
(list
|
||||
#:imported-modules `((guix build python-build-system)
|
||||
,@%default-gnu-imported-modules)
|
||||
#:imported-modules %pyproject-build-system-modules
|
||||
#:modules '((guix build gnu-build-system)
|
||||
(guix build utils)
|
||||
((guix build python-build-system) #:prefix python:))
|
||||
((guix build pyproject-build-system) #:prefix py:))
|
||||
#:configure-flags
|
||||
#~(list "--disable-imageProcessor-build"
|
||||
(string-append "--prefix=" #$output)
|
||||
|
|
@ -648,102 +647,103 @@ should only be used as part of the Guix cups-pk-helper service.")
|
|||
"--enable-qt5"
|
||||
"--disable-qt4")
|
||||
#:phases
|
||||
#~(modify-phases %standard-phases
|
||||
(add-after 'unpack 'set-gcc-14-cflags
|
||||
;; We set CFLAGS here because adding setting it in
|
||||
;; #:configure-flags or #:make-flags does not work.
|
||||
(lambda _
|
||||
(substitute* "Makefile.in"
|
||||
(("CFLAGS = @CFLAGS@" all)
|
||||
(string-append all
|
||||
" -Wno-error=attributes"
|
||||
" -Wno-error=implicit-function-declaration"
|
||||
" -Wno-error=implicit-int"
|
||||
" -Wno-error=incompatible-pointer-types"
|
||||
" -Wno-error=int-conversion"
|
||||
" -Wno-error=return-mismatch")))))
|
||||
(add-after 'unpack 'fix-hard-coded-file-names
|
||||
(lambda* (#:key inputs outputs #:allow-other-keys)
|
||||
(let ((out #$output)
|
||||
;; FIXME: use merged ppds (I think actually only
|
||||
;; drvs need to be merged).
|
||||
(cupsdir #$(this-package-input "cups-minimal")))
|
||||
(substitute* (find-files "." "\\.py$")
|
||||
;; Refer to the correct default configuration file name.
|
||||
(("/etc/hp/hplip.conf")
|
||||
(string-append out "/etc/hp/hplip.conf")))
|
||||
(substitute* "base/g.py"
|
||||
(("'/usr/share;[^']*'")
|
||||
(string-append "'" cupsdir "/share'"))
|
||||
(("'/etc/hp/hplip.conf'")
|
||||
(string-append "'" out "/etc/hp/hplip.conf" "'")))
|
||||
|
||||
(with-extensions (list (pyproject-guile-json))
|
||||
#~(modify-phases %standard-phases
|
||||
(add-after 'unpack 'set-gcc-14-cflags
|
||||
;; We set CFLAGS here because adding setting it in
|
||||
;; #:configure-flags or #:make-flags does not work.
|
||||
(lambda _
|
||||
(substitute* "Makefile.in"
|
||||
(("[[:blank:]]check-plugin\\.py[[:blank:]]") " ")
|
||||
;; FIXME Use beginning-of-word in regexp.
|
||||
(("[[:blank:]]plugin\\.py[[:blank:]]") " ")
|
||||
(("/usr/include/libusb-1.0")
|
||||
(search-input-directory inputs "/include/libusb-1.0"))
|
||||
(("hplip_statedir =.*$")
|
||||
;; Don't bail out while trying to create
|
||||
;; /var/lib/hplip. We can safely change its value
|
||||
;; here because it's hard-coded in the code anyway.
|
||||
"hplip_statedir = $(prefix)\n")
|
||||
(("hplip_confdir = /etc/hp")
|
||||
;; This is only used for installing the default config.
|
||||
(string-append "hplip_confdir = " out "/etc/hp"))
|
||||
(("halpredir = /usr/share/hal/fdi/preprobe/10osvendor")
|
||||
;; We don't use hal.
|
||||
(string-append "halpredir = " out
|
||||
"/share/hal/fdi/preprobe/10osvendor"))
|
||||
(("rulesdir = /etc/udev/rules.d")
|
||||
;; udev rules will be merged by base service.
|
||||
(string-append "rulesdir = " out "/lib/udev/rules.d"))
|
||||
(("rulessystemdir = /usr/lib/systemd/system")
|
||||
;; We don't use systemd.
|
||||
(string-append "rulessystemdir = " out "/lib/systemd/system"))
|
||||
(("/etc/sane.d")
|
||||
(string-append out "/etc/sane.d"))))))
|
||||
(add-after 'install 'move-sane-config-to-dll.d
|
||||
(lambda _
|
||||
;; move dll.conf to dll.d - the directory intended for 3rd-party
|
||||
;; backend configurations.
|
||||
(let ((dll.d (string-append #$output "/etc/sane.d/dll.d"))
|
||||
(dll.conf (string-append #$output "/etc/sane.d/dll.conf")))
|
||||
(mkdir-p dll.d)
|
||||
(rename-file dll.conf (string-append dll.d "/hpaio")))))
|
||||
(add-after 'install 'install-models-dat
|
||||
(lambda* (#:key outputs #:allow-other-keys)
|
||||
(install-file "data/models/models.dat"
|
||||
(string-append #$output "/share/hplip/data/models"))))
|
||||
(("CFLAGS = @CFLAGS@" all)
|
||||
(string-append all
|
||||
" -Wno-error=attributes"
|
||||
" -Wno-error=implicit-function-declaration"
|
||||
" -Wno-error=implicit-int"
|
||||
" -Wno-error=incompatible-pointer-types"
|
||||
" -Wno-error=int-conversion"
|
||||
" -Wno-error=return-mismatch")))))
|
||||
(add-after 'unpack 'fix-hard-coded-file-names
|
||||
(lambda* (#:key inputs outputs #:allow-other-keys)
|
||||
(let ((out #$output)
|
||||
;; FIXME: use merged ppds (I think actually only
|
||||
;; drvs need to be merged).
|
||||
(cupsdir #$(this-package-input "cups-minimal")))
|
||||
(substitute* (find-files "." "\\.py$")
|
||||
;; Refer to the correct default configuration file name.
|
||||
(("/etc/hp/hplip.conf")
|
||||
(string-append out "/etc/hp/hplip.conf")))
|
||||
(substitute* "base/g.py"
|
||||
(("'/usr/share;[^']*'")
|
||||
(string-append "'" cupsdir "/share'"))
|
||||
(("'/etc/hp/hplip.conf'")
|
||||
(string-append "'" out "/etc/hp/hplip.conf" "'")))
|
||||
|
||||
(substitute* "Makefile.in"
|
||||
(("[[:blank:]]check-plugin\\.py[[:blank:]]") " ")
|
||||
;; FIXME Use beginning-of-word in regexp.
|
||||
(("[[:blank:]]plugin\\.py[[:blank:]]") " ")
|
||||
(("/usr/include/libusb-1.0")
|
||||
(search-input-directory inputs "/include/libusb-1.0"))
|
||||
(("hplip_statedir =.*$")
|
||||
;; Don't bail out while trying to create
|
||||
;; /var/lib/hplip. We can safely change its value
|
||||
;; here because it's hard-coded in the code anyway.
|
||||
"hplip_statedir = $(prefix)\n")
|
||||
(("hplip_confdir = /etc/hp")
|
||||
;; This is only used for installing the default config.
|
||||
(string-append "hplip_confdir = " out "/etc/hp"))
|
||||
(("halpredir = /usr/share/hal/fdi/preprobe/10osvendor")
|
||||
;; We don't use hal.
|
||||
(string-append "halpredir = " out
|
||||
"/share/hal/fdi/preprobe/10osvendor"))
|
||||
(("rulesdir = /etc/udev/rules.d")
|
||||
;; udev rules will be merged by base service.
|
||||
(string-append "rulesdir = " out "/lib/udev/rules.d"))
|
||||
(("rulessystemdir = /usr/lib/systemd/system")
|
||||
;; We don't use systemd.
|
||||
(string-append "rulessystemdir = " out "/lib/systemd/system"))
|
||||
(("/etc/sane.d")
|
||||
(string-append out "/etc/sane.d"))))))
|
||||
(add-after 'install 'move-sane-config-to-dll.d
|
||||
(lambda _
|
||||
;; move dll.conf to dll.d - the directory intended for 3rd-party
|
||||
;; backend configurations.
|
||||
(let ((dll.d (string-append #$output "/etc/sane.d/dll.d"))
|
||||
(dll.conf (string-append #$output "/etc/sane.d/dll.conf")))
|
||||
(mkdir-p dll.d)
|
||||
(rename-file dll.conf (string-append dll.d "/hpaio")))))
|
||||
(add-after 'install 'install-models-dat
|
||||
(lambda* (#:key outputs #:allow-other-keys)
|
||||
(install-file "data/models/models.dat"
|
||||
(string-append #$output "/share/hplip/data/models"))))
|
||||
(add-after 'install 'wrap-binaries
|
||||
;; Scripts in /bin are all symlinks to .py files in /share/hplip.
|
||||
;; Symlinks are immune to the Python build system's 'WRAP phase,
|
||||
;; and the .py files can't be wrapped because they are reused as
|
||||
;; modules. Replacing the symlinks in /bin with copies and
|
||||
;; wrapping them also doesn't work (“ModuleNotFoundError:
|
||||
;; No module named 'base'”). Behold: a custom WRAP-PROGRAM.
|
||||
(lambda* (#:key inputs outputs #:allow-other-keys)
|
||||
(let* ((out (assoc-ref outputs "out"))
|
||||
(bin (string-append out "/bin"))
|
||||
(site (python:site-packages inputs outputs)))
|
||||
(with-directory-excursion bin
|
||||
(for-each (lambda (file)
|
||||
(let ((target (readlink file)))
|
||||
(delete-file file)
|
||||
(with-output-to-file file
|
||||
(lambda _
|
||||
(format #t
|
||||
"#!~a~@
|
||||
;; Scripts in /bin are all symlinks to .py files in /share/hplip.
|
||||
;; Symlinks are immune to the Python build system's 'WRAP phase,
|
||||
;; and the .py files can't be wrapped because they are reused as
|
||||
;; modules. Replacing the symlinks in /bin with copies and
|
||||
;; wrapping them also doesn't work (“ModuleNotFoundError:
|
||||
;; No module named 'base'”). Behold: a custom WRAP-PROGRAM.
|
||||
(lambda* (#:key inputs outputs #:allow-other-keys)
|
||||
(let* ((bin (string-append #$output "/bin"))
|
||||
(site (py:site-packages inputs outputs)))
|
||||
(with-directory-excursion bin
|
||||
(for-each
|
||||
(lambda (file)
|
||||
(let ((target (readlink file)))
|
||||
(delete-file file)
|
||||
(with-output-to-file file
|
||||
(lambda _
|
||||
(format #t
|
||||
"#!~a~@
|
||||
export GUIX_PYTHONPATH=\"~a:~a\"~@
|
||||
exec -a \"$0\" \"~a/~a\" \"$@\"~%"
|
||||
(which "bash")
|
||||
site
|
||||
(getenv "GUIX_PYTHONPATH")
|
||||
bin target)))
|
||||
(chmod file #o755)))
|
||||
(find-files "." (lambda (file stat)
|
||||
(eq? 'symlink (stat:type stat))))))))))))
|
||||
(which "bash")
|
||||
site
|
||||
(getenv "GUIX_PYTHONPATH")
|
||||
bin target)))
|
||||
(chmod file #o755)))
|
||||
(find-files "." (lambda (file stat)
|
||||
(eq? 'symlink (stat:type stat)))))))))))))
|
||||
;; Note that the error messages printed by the tools in the case of
|
||||
;; missing dependencies are often downright misleading.
|
||||
;; TODO: hp-toolbox still fails to start with:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue