#6 Add upstream patch to fix sugar-install bundle
Merged 2 years ago by pbrobinson. Opened 2 years ago by chimosky.
rpms/ chimosky/sugar-toolkit-gtk3 dev  into  master

@@ -0,0 +1,68 @@ 

+ From 2018c930adae85c18b1c51b5f80836fcad6c392c Mon Sep 17 00:00:00 2001

+ From: James Cameron <quozl@laptop.org>

+ Date: Fri, 27 Dec 2019 14:10:28 +1100

+ Subject: [PATCH] Fix sugar-install-bundle

+ 

+ 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.

+ ---

+  src/sugar3/bundle/activitybundle.py | 4 ++--

+  src/sugar3/bundle/bundle.py         | 4 ++--

+  2 files changed, 4 insertions(+), 4 deletions(-)

+ 

+ diff --git a/src/sugar3/bundle/activitybundle.py b/src/sugar3/bundle/activitybundle.py

+ index 879831e53..2b5e2f444 100644

+ --- a/src/sugar3/bundle/activitybundle.py

+ +++ b/src/sugar3/bundle/activitybundle.py

+ @@ -129,7 +129,7 @@ def __init__(self, path, translated=True):

+  

+      def _parse_info(self, info_file):

+          cp = ConfigParser()

+ -        cp.readfp(info_file)

+ +        cp.read_string(info_file.read().decode())

+  

+          section = 'Activity'

+  

+ @@ -251,7 +251,7 @@ def _get_linfo_file(self):

+      def _parse_linfo(self, linfo_file):

+          cp = ConfigParser()

+          try:

+ -            cp.readfp(linfo_file)

+ +            cp.read_string(linfo_file.read().decode())

+  

+              section = 'Activity'

+  

+ diff --git a/src/sugar3/bundle/bundle.py b/src/sugar3/bundle/bundle.py

+ index c5716107b..206409a62 100644

+ --- a/src/sugar3/bundle/bundle.py

+ +++ b/src/sugar3/bundle/bundle.py

+ @@ -115,7 +115,7 @@ def get_file(self, filename):

+          if self._zip_file is None:

+              path = os.path.join(self._path, filename)

+              try:

+ -                f = open(path, 'r')

+ +                f = open(path, 'rb')

+              except IOError:

+                  logging.debug("cannot open path %s" % path)

+                  return None

+ @@ -123,7 +123,7 @@ def get_file(self, filename):

+              path = os.path.join(self._zip_root_dir, filename)

+              try:

+                  data = self._zip_file.read(path)

+ -                f = six.StringIO(data)

+ +                f = six.BytesIO(data)

+              except KeyError:

+                  logging.debug('%s not found in zip %s.' % (filename, path))

+                  return None

file modified
+5 -1
@@ -2,7 +2,7 @@ 

  

  Name:    sugar-toolkit-gtk3

  Version: 0.116

- Release: 7%{?dist}

+ Release: 8%{?dist}

  Summary: Sugar toolkit GTK+ 3

  License: LGPLv2+

  URL:     http://wiki.laptop.org/go/Sugar
@@ -11,6 +11,7 @@ 

  Source1: macros.sugar

  Patch1:  fix-RuntimeError-could-not-create-signal-for-closing.patch

  Patch0:  Build-by-default-for-python-3.patch

+ Patch2:  fix-sugar-install-bundle.patch

  

  BuildRequires: alsa-lib-devel

  BuildRequires: gettext-devel
@@ -81,6 +82,9 @@ 

  %{_datadir}/gir-1.0/*.gir

  

  %changelog

+ * Sat May 2 2020 Ibiam Chihurumnaya <ibiamchihurumnaya@gmail.com> 0.116-8

+ - Add upstream patch to fix sugar-install bundle

+ 

  * Mon Mar 2 2020 Ibiam Chihurumnaya <ibiamchihurumnaya@gmail.com> 0.116-7

  - Add upstream patch to build for python3 by default

  

rebased onto 1887ee8

2 years ago

Pull-Request has been merged by pbrobinson

2 years ago