Any activity fails to build with Python 3.9;
Traceback (most recent call last):
File "setup.py", line 19, in <module>
from sugar3.activity import bundlebuilder
File "sugar3/activity/bundlebuilder.py", line 44, in <module>
import xml.etree.cElementTree as ET
ModuleNotFoundError: No module named 'xml.etree.cElementTree'
See https://docs.python.org/3.9/whatsnew/3.9.html#removed
"The xml.etree.cElementTree module has been removed."
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1817644
Signed-off-by: Ibiam Chihurumnaya <ibiamchihurumnaya@gmail.com>
Signed-off-by: James Cameron <quozl@laptop.org>
5fa33b2 introduced build for either python 2 or python 3, with the
default of python 2.
`configure` and `autogen.sh` now accept `--with-python3` or
`--with-python2` options, with the default of python 3.
Signed-off-by: James Cameron <quozl@laptop.org>
ColorButton did not show button icon, and swatches were too small
making it almost unusable. Color chooser toolbar had been using
Gtk.IconSize.LARGE_TOOLBAR which return 0 as size.
style.GRID_CELL_SIZE was used as size reference
The schema is provided by the sugar shell package and
in scenarios where that package is not present trying
to reference ends up in segfaults, e.g. flatpak apps.
On Ubuntu 20.04 with GTK 3.24.13, importing sugar3.activity.activity
fails with RuntimeError: could not create signal for _closing, preceeded
by an assertion is_valid_signal_name failed.
Cause is upstream 89f955d ("gsignal: Canonicalise signal names at
installation time ") which requires application signal names to not
start with a hyphen or underscore.
Remove the prefix from our signal name. The signal remains reserved and
private to the Activity class.
Traceback (most recent call last):
File "/usr/bin/sugar-install-bundle", line 21, in <module>
bundle = ActivityBundle(name)
File "/usr/lib/python3.7/dist-packages/sugar3/bundle/activitybundle.py", line 118, in __init__
info_file = self.get_file('activity/activity.info')
File "/usr/lib/python3.7/dist-packages/sugar3/bundle/bundle.py", line 126, in get_file
f = six.StringIO(data)
TypeError: initial_value must be str or None, not bytes
Fix by always reading bundle and metadata as Bytes, and converting to
String before passing to ConfigParser.
Did not fix ContentBundle, as it has been unused for some time, and was
only kept for use with OLPC XO and Python 2.
Preview metadata in 0.114 and earlier was returned by datastore client
as a dbus.ByteArray.
Regression introduced by aa8a5e7 ("Port from Python 2 to six").
Traceback (most recent call last):
File "/usr/lib/python3.7/dist-packages/jarabe/journal/expandedentry.py", line 378, in _create_preview
pixbuf = get_preview_pixbuf(metadata.get('preview', ''))
File "/usr/lib/python3.7/dist-packages/sugar3/graphics/objectchooser.py", line 85, in get_preview_pixbuf
preview_data = base64.b64decode(preview_data)
File "/usr/lib/python3.7/base64.py", line 87, in b64decode
return binascii.a2b_base64(s)
binascii.Error: Invalid base64-encoded string: number of data characters (237) cannot be 1 more than a multiple of 4
Related to
https://github.com/sugarlabs/sugar-datastore/issues/16
Activity install target used by downstream activity packaging did fail
with;
Traceback (most recent call last):
File "setup.py", line 21, in <module>
bundlebuilder.start()
File "/usr/lib/python3.7/dist-packages/sugar3/activity/bundlebuilder.py", line 633, in start
globals()['cmd_' + options.command](config, options)
File "/usr/lib/python3.7/dist-packages/sugar3/activity/bundlebuilder.py", line 513, in cmd_install
options.install_desktop_file)
File "/usr/lib/python3.7/dist-packages/sugar3/activity/bundlebuilder.py", line 290, in install
for f in self.get_files_in_git():
File "/usr/lib/python3.7/dist-packages/sugar3/activity/bundlebuilder.py", line 209, in get_files_in_git
stdout.strip('\n').split('\n')]
TypeError: a bytes-like object is required, not 'str'
Workaround was to hide .git directory.
Cause was subprocess pipe returning a bytes-like object in Python 3.
Regression introduced by incomplete ed46c21 ("Port to six").
Fixes https://github.com/sugarlabs/sugar-toolkit-gtk3/issues/426
Status zero is normal, so don't report it.
Also don't print the log_file object.
Changes log messages such as this;
Exited with status 0, pid 3765 data (<_io.TextIOWrapper name=13 mode='w'
encoding='UTF-8'>, '5312a7726254b3b0b9a15267c54600aec9db187e')
To this;
Normal successful completion, pid 3765 activity_id 5312a7726254b3b0b9a15267c54600aec9db187e
GLib accepts signal names with dash or underscore and
documents the signals with a dash.
Use of signal names in Sugar was mixed, change to using
dash only.
No functional change.
Expose the GstSpeechPlayer pipeline so that the activities may add their
own handlers.
A quick way to get the rest of the gst-plugins-espeak signals available.
Defer iconify call to after the activity has been shown. Remember the
iconify call was requested, and make the call just prior to entering the
main loop.
On Ubuntu 18.04 with Metacity 3.32.0 the Journal does appear over the
Home View on Sugar start on a VM with two virtual CPUs, yet the previous
fix in Metacity (074af8f) is present. This is suggestive of a race
condition.
Tests with a minimal GTK reproducer shows order of three specific calls
is critical to success of iconify. The ordering and results are;
* iconify, maximize, show; not iconified,
* maximize, iconify, show; not iconified,
* iconify, show, maximize; not iconified,
* maximize, show, iconify; app with focus will flicker, iconified,
* show, maximize, iconify; app with focus may flicker, iconified,
* show, iconify, maximize; app with focus may flicker, iconified,
Sugar Toolkit combined with Journal uses the "maximize, iconify, show"
ordering. Using a Hello World activity with a call to iconify, the new
activity is not iconified.
When changed to "mazimise, show, iconify" ordering, there is no flicker
of the app in focus, and the new activity is iconified.
`configure` and `autogen.sh` now accept `--with-python2` or
`--with-python3` options, with the default of python 2.
aa8a5e7 introduced building for python 3, but broke build for python 2,
requiring patching `configure.ac` prior to build.
Code was derived from rpmfusion-packager, found using a GitHub search of
`configure.ac` files for both `python2` and `python3`, and is GPLv3.
Tested on Ubuntu 18.04.
Signed-off-by: James Cameron <quozl@laptop.org>
Ensure environment variables needed by Python activities are available
in each of the three supported scenarios;
- started from Sugar,
- started from Terminal inside Sugar,
- started by other desktop environments.
Variables always available are;
SUGAR_ACTIVITY_ROOT
SUGAR_BUNDLE_ID
SUGAR_BUNDLE_NAME
SUGAR_BUNDLE_PATH
SUGAR_BUNDLE_VERSION
Variables also available when started from Sugar are;
SUGAR_ACTIVITIES_HIDDEN
SUGAR_APISOCKET_KEY
SUGAR_APISOCKET_PORT
SUGAR_GROUP_LABELS
SUGAR_HOME
SUGAR_MIME_DEFAULTS
SUGAR_PROFILE
SUGAR_SCALING
SUGAR_VERSION
Variables also available when started from Terminal are;
SUGAR_TERMINAL_VERSION
Other changes;
- use os.makedirs in place of distutils.dir_util.mkpath,
- avoid redundant setting of SUGAR_BUNDLE_PATH,
- do not set SUGAR_BUNDLE_ID unnecessarily,
- add explanatory comment,
Tested on Ubuntu 18.04.
Signed-off-by: James Cameron <quozl@laptop.org>