sugarlabs / sugar-artwork

Sugar icons and themes
Apache License 2.0
11 stars 33 forks source link

Issue with empy3 with 0.115 #111

Closed nullr0ute closed 5 years ago

nullr0ute commented 5 years ago

Prior to 0.115 there was a bundled empy. With the move py3 it seems that was dropped, and on Fedora it has issues finding the packaged em.py. If we specify it as part of configure with "./configure EMPY3=%{python3_sitelib}/em.py" the build continues but then fails because the commands is hard coded later in the build process:

empy3 -p $ -D scaling=\'72\' ./gtkrc.em > \
    ../../gtk/theme/sugar-72.gtkrc
/bin/sh: empy3: command not found
quozl commented 5 years ago

Yes, the bundled empy was dropped in favour of the latest empy from the distribution. This simplified the port to Python 3 for the artwork module, and dropped maintenance of a separate empy source.

If we use %{python3_sitelib}/em.py as you suggest, Fedora will barf with Permission denied because the file lacks execute mode, despite empy documented in the README to be run that way. Both issues are with the Fedora packaging of empy; add it to /usr/bin, and make it executable.

Let's assume those issues won't be fixed. We can use the configured empy instead of trusting PATH to contain it. We can avoid the missing executable bit, if we can be sure that empy will always be written in Python, but it adds dependency on Python again.

From dbcb6b5e66f967e75fd8ef11c5d4ff60eb4f4435 Mon Sep 17 00:00:00 2001
From: James Cameron <quozl@laptop.org>
Date: Tue, 3 Sep 2019 08:02:34 +1000
Subject: [PATCH] Fix empy discovery for Fedora and pip

We relied on the Debian and Ubuntu to provide
/usr/bin/empy{,3}, but in Fedora and pip, this fails
with

    /bin/sh: empy3: command not found

Also, on Fedora and pip, empy lacks execute bits.

Use the discovered empy.

Use Python to bypass missing execute bits.

Change the error message to "empy is required".

Fixes https://github.com/sugarlabs/sugar-artwork/issues/111
---
 configure.ac                |  7 ++++---
 gtk/theme/Makefile.am       |  8 ++++----
 gtk3/theme/3.20/Makefile.am |  8 ++++----
 gtk3/theme/Makefile.am      | 16 ++++++++--------
 4 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/configure.ac b/configure.ac
index 3c3993d..6c2d4c3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,9 +20,10 @@ if test -z "$XCURSORGEN"; then
     AC_MSG_ERROR([xcursorgen is required])
 fi

-AC_PATH_PROG([EMPY3], [empy3])
-if test -z "$EMPY3"; then
-    AC_MSG_ERROR([python3-empy is required])
+AM_PATH_PYTHON
+AC_PATH_PROGS([EMPY], [empy empy3])
+if test -z "$EMPY"; then
+    AC_MSG_ERROR([empy is required])
 fi

 PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= 2.16.0,,
diff --git a/gtk/theme/Makefile.am b/gtk/theme/Makefile.am
index 2dbb77a..2686f41 100644
--- a/gtk/theme/Makefile.am
+++ b/gtk/theme/Makefile.am
@@ -1,10 +1,10 @@
 sugar-72.gtkrc: gtkrc.em
-   empy3 -p $$ -D scaling=\'72\' $(srcdir)/gtkrc.em > \
-       $(top_builddir)/gtk/theme/sugar-72.gtkrc
+   $(PYTHON) - -p $$ -D scaling=\'72\' $(srcdir)/gtkrc.em > \
+       $(top_builddir)/gtk/theme/sugar-72.gtkrc < $(EMPY)

 sugar-100.gtkrc: gtkrc.em
-   empy3 -p $$ -D scaling=\'100\' $(srcdir)/gtkrc.em > \
-       $(top_builddir)/gtk/theme/sugar-100.gtkrc
+   $(PYTHON) - -p $$ -D scaling=\'100\' $(srcdir)/gtkrc.em > \
+       $(top_builddir)/gtk/theme/sugar-100.gtkrc < $(EMPY)

 clean:
    $(RM) sugar-72.gtkrc
diff --git a/gtk3/theme/3.20/Makefile.am b/gtk3/theme/3.20/Makefile.am
index 2ca20cc..2315903 100644
--- a/gtk3/theme/3.20/Makefile.am
+++ b/gtk3/theme/3.20/Makefile.am
@@ -1,12 +1,12 @@
 gtk-widgets-72.css: gtk-widgets.css.em
-   empy3 -p $$ -D scaling=\'72\' -D gtk=\'$(GTK3_VERSION)\' \
+   $(PYTHON) - -p $$ -D scaling=\'72\' -D gtk=\'$(GTK3_VERSION)\' \
        $(srcdir)/gtk-widgets.css.em > \
-       $(top_builddir)/gtk3/theme/3.20/gtk-widgets-72.css
+       $(top_builddir)/gtk3/theme/3.20/gtk-widgets-72.css < $(EMPY)

 gtk-widgets-100.css: gtk-widgets.css.em
-   empy3 -p $$ -D scaling=\'100\' -D gtk=\'$(GTK3_VERSION)\' \
+   $(PYTHON) - -p $$ -D scaling=\'100\' -D gtk=\'$(GTK3_VERSION)\' \
        $(srcdir)/gtk-widgets.css.em > \
-       $(top_builddir)/gtk3/theme/3.20/gtk-widgets-100.css
+       $(top_builddir)/gtk3/theme/3.20/gtk-widgets-100.css < $(EMPY)

 clean:
    $(RM) gtk-widgets-100.css
diff --git a/gtk3/theme/Makefile.am b/gtk3/theme/Makefile.am
index 16e88c2..669e976 100644
--- a/gtk3/theme/Makefile.am
+++ b/gtk3/theme/Makefile.am
@@ -1,22 +1,22 @@
 SUBDIRS = assets 3.20

 gtk-widgets-72.css: gtk-widgets.css.em
-   empy3 -p $$ -D scaling=\'72\' -D gtk=\'$(GTK3_VERSION)\' \
+   $(PYTHON) - -p $$ -D scaling=\'72\' -D gtk=\'$(GTK3_VERSION)\' \
        $(srcdir)/gtk-widgets.css.em > \
-       $(top_builddir)/gtk3/theme/gtk-widgets-72.css
+       $(top_builddir)/gtk3/theme/gtk-widgets-72.css < $(EMPY)

 gtk-widgets-100.css: gtk-widgets.css.em
-   empy3 -p $$ -D scaling=\'100\' -D gtk=\'$(GTK3_VERSION)\' \
+   $(PYTHON) - -p $$ -D scaling=\'100\' -D gtk=\'$(GTK3_VERSION)\' \
        $(srcdir)/gtk-widgets.css.em > \
-       $(top_builddir)/gtk3/theme/gtk-widgets-100.css
+       $(top_builddir)/gtk3/theme/gtk-widgets-100.css < $(EMPY)

 settings-72.ini: settings.ini.em
-   empy3 -p $$ -D scaling=\'72\' $(srcdir)/settings.ini.em > \
-       $(top_builddir)/gtk3/theme/settings-72.ini
+   $(PYTHON) - -p $$ -D scaling=\'72\' $(srcdir)/settings.ini.em > \
+       $(top_builddir)/gtk3/theme/settings-72.ini < $(EMPY)

 settings-100.ini: settings.ini.em
-   empy3 -p $$ -D scaling=\'100\' $(srcdir)/settings.ini.em > \
-       $(top_builddir)/gtk3/theme/settings-100.ini
+   $(PYTHON) - -p $$ -D scaling=\'100\' $(srcdir)/settings.ini.em > \
+       $(top_builddir)/gtk3/theme/settings-100.ini < $(EMPY)

 clean:
    $(RM) gtk-widgets-100.css
-- 
2.17.1

Seems very messy. What do you think?

quozl commented 5 years ago

G'day Peter,

I think you once asked to be reminded if there's no response by Fedora developers to a new release of Sugar.

Sugar 0.116 was released last Wednesday. http://lists.sugarlabs.org/archive/sugar-devel/2019-September/057175.html

I've checked, and you are not subscribed to the sugar-devel@ mailing list. Please subscribe to get release announcements.