diff mbox series

[bug#56169] gnu: Add cambalache.

Message ID e7bfb699eab82f417cb1572feb984c0581878ebe.camel@gmail.com
State Accepted
Headers show
Series [bug#56169] gnu: Add cambalache. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Liliana Marie Prikler June 23, 2022, 2:17 p.m. UTC
* gnu/packages/gnome.scm (cambalache): New variable.
---
 gnu/packages/gnome.scm | 75 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 75 insertions(+)

Comments

Daniel Meißner June 29, 2022, 7:21 a.m. UTC | #1
Hi Liliana,

Thanks for packaging Cambalache :-) I have applied your patch to my
local Guix checkout and it builds fine.  However, running

    ./pre-inst-env guix shell cambalache -- cambalace

Cambalache starts up but I am unable to add any widgets.  There are some
error messages written to stderr that complain about a missing
typelib: CambalachePrivate.  I see that you wrap the programme but you
did not include the path to the CambalachePrivate typelib.  So maybe
this is causing the problem?

Additionally, the icons in the headerbar are missing.  This seems to be
related to:

Missing dependency for Xournal++
https://issues.guix.gnu.org/51968

Best
Liliana Marie Prikler June 29, 2022, 4:59 p.m. UTC | #2
Am Mittwoch, dem 29.06.2022 um 09:21 +0200 schrieb Daniel Meißner:
> Hi Liliana,
> 
> Thanks for packaging Cambalache :-) I have applied your patch to my
> local Guix checkout and it builds fine.  However, running
> 
>     ./pre-inst-env guix shell cambalache -- cambalace
> 
> Cambalache starts up but I am unable to add any widgets.  There are
> some error messages written to stderr that complain about a missing
> typelib: CambalachePrivate.  I see that you wrap the programme but
> you did not include the path to the CambalachePrivate typelib.  So
> maybe this is causing the problem?
Thanks, I'll update the patch accordingly soon™.

> Additionally, the icons in the headerbar are missing.  This seems to
> be related to:
> 
> Missing dependency for Xournal++
> https://issues.guix.gnu.org/51968
For this class of bugs, I'd always try to include glib in the guix
shell and check if the issue persists.  We don't build icon caches per
package, so the only way to fix that is to get XDG_DATA_DIRS into your
profile.

Cheers
Daniel Meißner June 30, 2022, 9:16 a.m. UTC | #3
Liliana Marie Prikler writes:

> Am Mittwoch, dem 29.06.2022 um 09:21 +0200 schrieb Daniel Meißner:
>> Hi Liliana,
>> 
>> Thanks for packaging Cambalache :-) I have applied your patch to my
>> local Guix checkout and it builds fine.  However, running
>> 
>>     ./pre-inst-env guix shell cambalache -- cambalace
>> 
>> Cambalache starts up but I am unable to add any widgets.  There are
>> some error messages written to stderr that complain about a missing
>> typelib: CambalachePrivate.  I see that you wrap the programme but
>> you did not include the path to the CambalachePrivate typelib.  So
>> maybe this is causing the problem?
> Thanks, I'll update the patch accordingly soon™.

I did a first try by wrapping the programme as follows:

--8<---------------cut here---------------start------------->8---
(wrap-program prog
              `("GI_TYPELIB_PATH"
                suffix
                (,(getenv "GI_TYPELIB_PATH")
                 ,(string-append #$output "/lib/girepository-1.0"))))
--8<---------------cut here---------------end--------------->8---

Now, with this, cambalache finds the typelib but complains on two other
things:

1. There's another typelib called Adw which is not found
2. gi.repository.GLib.GError: gdk-pixbuf-error-quark: Format der Bilddatei unbekannt (3)

Now 2. is more severe since it occurs when I add for example a
GtkApplicationWindow to the project.  This widget does not show up and I
cannot add other widgets to the application window.


>> Additionally, the icons in the headerbar are missing.  This seems to
>> be related to:
>> 
>> Missing dependency for Xournal++
>> https://issues.guix.gnu.org/51968
> For this class of bugs, I'd always try to include glib in the guix
> shell and check if the issue persists.  We don't build icon caches per
> package, so the only way to fix that is to get XDG_DATA_DIRS into your
> profile.

Thanks for the hint.  IIUC, the inclusion of glib into the profile
triggers a hook for generating the appropiate XDG_DATA_DIRS env variable
into the profile, right?  Is the reason why icon caches are not
per-package so that different icon-themes can work?  Sorry, this is
taking an orthogonal direction.

Best
Liliana Marie Prikler June 30, 2022, 3:25 p.m. UTC | #4
Am Donnerstag, dem 30.06.2022 um 11:16 +0200 schrieb Daniel Meißner:
> Liliana Marie Prikler writes:
> 
> > Am Mittwoch, dem 29.06.2022 um 09:21 +0200 schrieb Daniel Meißner:
> > > Hi Liliana,
> > > 
> > > Thanks for packaging Cambalache :-) I have applied your patch to
> > > my
> > > local Guix checkout and it builds fine.  However, running
> > > 
> > >     ./pre-inst-env guix shell cambalache -- cambalace
> > > 
> > > Cambalache starts up but I am unable to add any widgets.  There
> > > are
> > > some error messages written to stderr that complain about a
> > > missing
> > > typelib: CambalachePrivate.  I see that you wrap the programme
> > > but
> > > you did not include the path to the CambalachePrivate typelib. 
> > > So
> > > maybe this is causing the problem?
> > Thanks, I'll update the patch accordingly soon™.
> 
> I did a first try by wrapping the programme as follows:
> 
> --8<---------------cut here---------------start------------->8---
> (wrap-program prog
>               `("GI_TYPELIB_PATH"
>                 suffix
>                 (,(getenv "GI_TYPELIB_PATH")
>                  ,(string-append #$output "/lib/girepository-1.0"))))
> --8<---------------cut here---------------end--------------->8---
> 
> Now, with this, cambalache finds the typelib but complains on two
> other things:
> 
> 1. There's another typelib called Adw which is not found
Should be resolved by adding libadwaita to the inputs.
> 2. gi.repository.GLib.GError: gdk-pixbuf-error-quark: Format der
> Bilddatei unbekannt (3)
A broken image?  Any supporting hints like file paths?

> Now 2. is more severe since it occurs when I add for example a
> GtkApplicationWindow to the project.  This widget does not show up
> and I cannot add other widgets to the application window.
> 
> > > Additionally, the icons in the headerbar are missing.  This seems
> > > to
> > > be related to:
> > > 
> > > Missing dependency for Xournal++
> > > https://issues.guix.gnu.org/51968
> > For this class of bugs, I'd always try to include glib in the guix
> > shell and check if the issue persists.  We don't build icon caches
> > per package, so the only way to fix that is to get XDG_DATA_DIRS
> > into your profile.
> 
> Thanks for the hint.  IIUC, the inclusion of glib into the profile
> triggers a hook for generating the appropiate XDG_DATA_DIRS env
> variable into the profile, right?  Is the reason why icon caches are
> not per-package so that different icon-themes can work?  Sorry, this
> is taking an orthogonal direction.
It's a practical limitation.  There is a single file, that would leat
to a very large number of conflicts, most of them harmless but still
time-consuming to resolve.  Thus we leave it to a profile hook to
actually generate the icon themes.   This hook runs regardless, but
XDG_DATA_DIRS won't be set by it.

Cheers
Daniel Meißner July 1, 2022, 11:37 a.m. UTC | #5
Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

> Am Donnerstag, dem 30.06.2022 um 11:16 +0200 schrieb Daniel Meißner:
> [...]
>> 1. There's another typelib called Adw which is not found
> Should be resolved by adding libadwaita to the inputs.

Yep, it did resolve it.

>> 2. gi.repository.GLib.GError: gdk-pixbuf-error-quark: Format der
>> Bilddatei unbekannt (3)
> A broken image?  Any supporting hints like file paths?

There's a backtrace of a Python file.  Maybe that helps.

--8<---------------cut here---------------start------------->8---
(.cambalache-real:13827): Gtk-WARNING **: 13:32:30.577: Could not load a pixbuf from icon theme.
This may indicate that pixbuf loaders or the mime database could not be found.
Traceback (most recent call last):
  File "/gnu/store/ax5i4mwlwjhk3jwr3kfb41n48fczp9hv-cambalache-0.10.2/lib/python3.9/site-packages/cambalache/cmb_property_controls.py", line 562, in __load_icon_finish
    self.__model[data][6] = info.load_icon_finish(res)
gi.repository.GLib.GError: gdk-pixbuf-error-quark: Format der Bilddatei unbekannt (3)
--8<---------------cut here---------------end--------------->8---

Best
diff mbox series

Patch

diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 0cde3caebd..71667086f4 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -3208,6 +3208,81 @@  (define-public glade3
                                 (variable "GLADE_MODULE_SEARCH_PATH")
                                 (files '("lib/glade/modules")))))))
 
+(define-public cambalache
+  (package
+   (name "cambalache")
+   (version "0.10.2")
+   (source (origin
+            (method git-fetch)
+            (uri (git-reference
+                  (url "https://gitlab.gnome.org/jpu/cambalache")
+                  (commit version)))
+            (file-name (git-file-name name version))
+            (sha256
+             (base32 "1mw5gk98zx03yal3p8slaqwhwkc9p2vnh0cssnmg6ivxsjscqhgz"))))
+   (build-system meson-build-system)
+   (arguments
+    (list
+     #:glib-or-gtk? #t
+     #:imported-modules `((guix build python-build-system)
+                          ,@%meson-build-system-modules)
+     #:modules '((guix build meson-build-system)
+                 ((guix build python-build-system) #:prefix python:)
+                 (guix build utils))
+     #:phases
+     #~(modify-phases %standard-phases
+         (add-after 'unpack 'patch-source
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* "cambalache/cmb_view.py"
+               (("GLib\\.find_program_in_path\\('(.*)'\\)" all cmd)
+                (string-append "'"
+                               (search-input-file inputs
+                                                  (string-append "/bin/" cmd))
+                               "'")))))
+         (add-after 'unpack 'patch-build
+           (lambda _
+             (substitute* "postinstall.py"
+               (("update-desktop-database") "true"))))
+         (add-after 'wrap 'python-wrap (assoc-ref python:%standard-phases 'wrap))
+         (delete 'check)
+         (add-after 'install 'add-install-to-pythonpath
+           (assoc-ref python:%standard-phases 'add-install-to-pythonpath))
+         (add-after 'add-install-to-pythonpath 'pre-check
+           (lambda _
+             (system "Xvfb :1 &")
+             (setenv "DISPLAY" ":1")))
+         (add-after 'pre-check 'check
+           (lambda* (#:key tests? #:allow-other-keys)
+             (when tests?
+               (with-directory-excursion ".."
+                 (invoke "python3" "-m" "pytest")))))
+         (add-after 'glib-or-gtk-wrap 'wrap-typelib
+           (lambda* (#:key outputs #:allow-other-keys)
+             (for-each
+              (lambda (prog)
+                (unless (wrapped-program? prog)
+                  (wrap-program
+                   prog
+                   `("GI_TYPELIB_PATH" suffix (,(getenv "GI_TYPELIB_PATH"))))))
+              (find-files (string-append (assoc-ref outputs "out")
+                                         "/bin"))))))))
+   (inputs (list bash-minimal
+                 python python-pygobject python-lxml
+                 gtk
+                 `(,gtk+ "bin") ; broadwayd
+                 `(,gtk "bin")
+                 webkitgtk-with-libsoup2))
+   (native-inputs (list `(,glib "bin") gobject-introspection
+                        gettext-minimal pkg-config
+                        python-pytest xorg-server-for-tests))
+   (home-page "https://gitlab.gnome.org/jpu/cambalache")
+   (synopsis "Rapid application development tool")
+   (description "Cambalache is a rapid application development (RAD) tool for
+Gtk 4 and 3 with a clear model-view-controller (MVC) design and
+data model first philosophy.")
+   (license (list license:lgpl2.1
+                  license:gpl2)))) ; tools
+
 (define-public libcroco
   (package
     (name "libcroco")