Hi Reza & Hugo,
thanks for helping out! Replying a bit late since I was on vacation...
Indeed, adding a basic pyproject.toml and switching to
pyproject-build-system was the biggest part of the solution. I also
had to move my custom wrapping phase so it takes place after
pyproject's own wrap phase instead of after install.
From: Hugo Buddelmeijer <[email protected]>
Perhaps include python-wrapper too, since
otherwise patch-shebang might only recognize 'python3', not 'python'
I saw this python-wrapper, but it's not clear to me what it's for,
and I couldn't find information in the Guix info manual. Is the
purpose of python-wrapper explained somewhere? (I got everything to
work without it)
From: Reza Housseini <[email protected]>
Then pyproject-build-system takes care of
everything and you don't have to use custom wrappers.
Hi, I think I do need a wrapper because I need to set the
GI_TYPELIB_PATH environment variable to make pygobject work. At
least it doesn't seem like that's set automatically by the
pyproject-build-system (I tried building my package without the extra
wrap phase, and didn't see any env var setting for this in the
automatically generated wrapper. Also my script calls 'rsnapshot',
so that should be on the PATH as well (perhaps a cleaner solution is
be to replace 'rsnapshot' by the full path to the
/gnu/store/.../bin/rsnapshot store item in the script as part of the
build, but I was lazy ;-) ).
Thomas
For completeness' sake, here's the updated package description:
(define-public backup-daemon
(package
(name "backup-daemon")
(version "1.1")
(source (local-file "./backup-daemon" #:recursive? #t))
(build-system pyproject-build-system)
(native-inputs
(list python-setuptools))
(inputs
`(("rsnapshot" ,rsnapshot)
("python-dbus" ,python-dbus)
("python-pygobject" ,python-pygobject)
("glib" ,glib)))
(arguments
`(#:tests? #f
#:phases
(modify-phases %standard-phases
(add-after 'wrap 'wrap-more
(lambda* (#:key inputs outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out"))
(rsnapshot (assoc-ref inputs "rsnapshot"))
(glib (assoc-ref inputs "glib")))
(wrap-program (string-append out "/bin/listen_dbus")
`("PATH" ":" prefix
(,(string-append rsnapshot "/bin")))
`("GI_TYPELIB_PATH" ":" prefix
(,(string-append glib
"/lib/girepository-1.0"))))))))))
(synopsis "Script to make weekly/monthly/yearly rsnapshot
backups")
(description "The backup daemon takes a config file for rsnapshot,
a partition UUID, and a backup directory as command line arguments.
When started, it listens for DBus signals from UDisks to detect if a
partition with the correct UUID is mounted. When the desired
partition is mounted, it runs rsnapshot with the given
configuration.")
(home-page "file:///home/thomas")
(license license:gpl3+)))