gnu: syncthing-gtk: Switch source to use Debian's Python 3 port.

* gnu/packages/syncthing.scm (syncthing-gtk)[source]: Adjust to use the Debian
Python 3 port.
[phases]{remove-windows.py}: New phase.
This commit is contained in:
Maxim Cournoyer 2021-01-29 10:49:29 -05:00
parent aa0d1e3306
commit de8dc9039b
No known key found for this signature in database
GPG key ID: 1260E46482E63562

View file

@ -4,6 +4,7 @@
;;; Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr> ;;; Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il> ;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2020 Giacomo Leidi <goodoldpaul@autistici.org> ;;; Copyright © 2020 Giacomo Leidi <goodoldpaul@autistici.org>
;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -189,58 +190,66 @@ (define-public syncthing
(license mpl2.0))) (license mpl2.0)))
(define-public syncthing-gtk (define-public syncthing-gtk
(package ;; The commit used below corresponds to the latest commit of the
(name "syncthing-gtk") ;; python3-port branch maintained by Debian. Upstream hasn't bothered
(version "0.9.4.4") ;; porting to Python 3 (see:
(source (origin ;; https://github.com/kozec/syncthing-gtk/issues/487).
(method git-fetch) (let ((revision "1")
(uri (git-reference (commit "c46fbd8ad1d12d409da8942702a2f119cf45514a"))
(url "https://github.com/syncthing/syncthing-gtk") (package
(commit (string-append "v" version)))) (name "syncthing-gtk")
(file-name (git-file-name name version)) (version (git-version "0.9.4.4" revision commit))
(sha256 (source (origin
(base32 (method git-fetch)
"0nc0wd7qvyri7841c3dd9in5d7367hys0isyw8znv5fj4c0a6v1f")))) (uri (git-reference
(build-system python-build-system) (url "https://salsa.debian.org/debian/syncthing-gtk.git")
(arguments (commit commit)))
`(#:python ,python-2 (file-name (git-file-name name version))
#:phases (sha256
(modify-phases %standard-phases (base32
(add-after 'unpack 'hardcode-dependencies "1x1c8snf0jpgjmyyidjw0015ksk5ishqn817wx8vs9i0lfgnnbbg"))))
(lambda* (#:key inputs #:allow-other-keys) (build-system python-build-system)
(let ((psmisc (assoc-ref inputs "psmisc")) (arguments
(syncthing (assoc-ref inputs "syncthing"))) `(#:phases
;; Hardcode dependencies paths to avoid propagation. (modify-phases %standard-phases
(substitute* "syncthing_gtk/tools.py" (add-after 'unpack 'hardcode-dependencies
(("killall") (string-append psmisc "/bin/killall"))) (lambda* (#:key inputs #:allow-other-keys)
(substitute* "syncthing_gtk/configuration.py" (let ((psmisc (assoc-ref inputs "psmisc"))
(("/usr/bin/syncthing") (string-append syncthing (syncthing (assoc-ref inputs "syncthing")))
"/bin/syncthing")))) ;; Hardcode dependencies paths to avoid propagation.
#t)) (substitute* "syncthing_gtk/tools.py"
(add-after 'wrap 'wrap-libs (("killall") (string-append psmisc "/bin/killall")))
(lambda* (#:key outputs #:allow-other-keys) (substitute* "syncthing_gtk/configuration.py"
(let ((out (assoc-ref outputs "out"))) (("/usr/bin/syncthing") (string-append syncthing
(wrap-program (string-append out "/bin/syncthing-gtk") "/bin/syncthing"))))))
`("GI_TYPELIB_PATH" ":" prefix (add-after 'unpack 'remove-windows.py
(,(getenv "GI_TYPELIB_PATH")))) (lambda _
#t)))))) ;; A Windows-specific module that fails to load with
(inputs ;; "ModuleNotFoundError: No module named 'msvcrt'.
`(("gtk+" ,gtk+) (delete-file "syncthing_gtk/windows.py")))
("libappindicator" ,libappindicator) (add-after 'wrap 'wrap-libs
("libnotify" ,libnotify) (lambda* (#:key outputs #:allow-other-keys)
("librsvg" ,librsvg) (let ((out (assoc-ref outputs "out")))
("python2-bcrypt" ,python2-bcrypt) (wrap-program (string-append out "/bin/syncthing-gtk")
("python2-dateutil" ,python2-dateutil) `("GI_TYPELIB_PATH" ":" prefix
("python2-pycairo" ,python2-pycairo) (,(getenv "GI_TYPELIB_PATH"))))))))))
("python2-pygobject" ,python2-pygobject) (inputs
("python-nautilus" ,python-nautilus) `(("gtk+" ,gtk+)
("psmisc" ,psmisc) ("libappindicator" ,libappindicator)
("syncthing" ,syncthing))) ("libnotify" ,libnotify)
(native-inputs ("librsvg" ,librsvg)
`(("python2-setuptools" ,python2-setuptools))) ("python-bcrypt" ,python-bcrypt)
(home-page "https://github.com/syncthing/syncthing-gtk") ("python-dateutil" ,python-dateutil)
(synopsis "GTK3 based GUI and notification area icon for Syncthing") ("python-pycairo" ,python-pycairo)
(description "@code{syncthing-gtk} is a GTK3 Python based GUI and ("python-pygobject" ,python-pygobject)
("python-nautilus" ,python-nautilus)
("psmisc" ,psmisc)
("syncthing" ,syncthing)))
;; (native-inputs
;; `(("python2-setuptools" ,python2-setuptools)))
(home-page "https://github.com/syncthing/syncthing-gtk")
(synopsis "GTK3 based GUI and notification area icon for Syncthing")
(description "@code{syncthing-gtk} is a GTK3 Python based GUI and
notification area icon for Syncthing. Supported Syncthing features: notification area icon for Syncthing. Supported Syncthing features:
@itemize @itemize
@ -250,7 +259,7 @@ (define-public syncthing-gtk
@item Restart, shutdown server @item Restart, shutdown server
@item Editing daemon settings @item Editing daemon settings
@end itemize\n") @end itemize\n")
(license gpl2))) (license gpl2))))
(define-public go-github-com-jackpal-go-nat-pmp (define-public go-github-com-jackpal-go-nat-pmp
(package (package