[gtk-mac-bundler] More py3 fixes.
- From: John Ralls <jralls src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-mac-bundler] More py3 fixes.
- Date: Sat, 10 Feb 2018 22:35:15 +0000 (UTC)
commit 9ee3e7c905bdafd3f7ae9c2cdf4ab2d773057415
Author: John Ralls <jralls ceridwen us>
Date: Sat Feb 10 14:35:02 2018 -0800
More py3 fixes.
bundler/bundler.py | 14 ++++++++++++--
examples/python-launcher.c | 10 +++++-----
2 files changed, 17 insertions(+), 7 deletions(-)
---
diff --git a/bundler/bundler.py b/bundler/bundler.py
index 9eba33f..1fd8359 100644
--- a/bundler/bundler.py
+++ b/bundler/bundler.py
@@ -170,6 +170,8 @@ class Bundler(object):
prefix = "\"" + self.project.get_bundle_path("Contents/Resources")
for line in f:
+ if sys.version_info[0] > 2:
+ line = line.decode('utf-8')
line = line.strip()
if line.startswith("#"):
continue
@@ -227,6 +229,8 @@ class Bundler(object):
prefix = "\"" + self.project.get_bundle_path("Contents/Resources")
for line in f:
+ if sys.version_info[0] > 2:
+ line = line.decode('utf-8')
line = line.strip()
if line.startswith("#"):
continue
@@ -251,7 +255,7 @@ class Bundler(object):
if (path.compute_destination(self.project) in binaries):
continue
copied_paths = path.copy_target(self.project)
- if isinstance(copied_paths, basestring):
+ if isinstance(copied_paths, str):
print("Warning: copy_target returned string %s" % copied_paths)
copied_paths = [copied_paths]
bad_paths = [p for p in copied_paths if (p.endswith('.la')
@@ -361,7 +365,13 @@ class Bundler(object):
f = Popen(cmds, stdout=PIPE, stderr=PIPE)
results, errors = f.communicate()
if errors:
- print("otool errors:\n%s" % errors)
+ if sys.version_info[0] > 2:
+ print("otool errors:\n%s" % errors.decode("utf-8"))
+ else:
+ print("otool errors:\n%s" % errors)
+
+ if sys.version_info[0] > 2:
+ results = results.decode("utf-8")
prefixes = self.meta.prefixes
lines = list(filter(prefix_filter,
[line.strip() for line in results.splitlines()]))
diff --git a/examples/python-launcher.c b/examples/python-launcher.c
index 9d1e305..76b594a 100644
--- a/examples/python-launcher.c
+++ b/examples/python-launcher.c
@@ -87,18 +87,18 @@ set_python_path(void)
CFStringRef str = make_filesystem_string(bundle_url);
CFRelease(bundle_url);
mstr = CFStringCreateMutableCopy(NULL, 5 * PATH_MAX, str);
- CFStringAppendCString(mstr, "/lib/python36.zip:", kCFStringEncodingUTF8);
+ CFStringAppendCString(mstr, "/lib/python34.zip:", kCFStringEncodingUTF8);
CFStringAppend(mstr, str);
- CFStringAppendCString(mstr, "/lib/python3.6:",
+ CFStringAppendCString(mstr, "/lib/python3.4:",
kCFStringEncodingUTF8);
CFStringAppend(mstr, str);
- CFStringAppendCString(mstr, "/lib/python3.6/plat-darwin:",
+ CFStringAppendCString(mstr, "/lib/python3.4/plat-darwin:",
kCFStringEncodingUTF8);
CFStringAppend(mstr, str);
- CFStringAppendCString(mstr, "/lib/python3.6/lib-dynload:",
+ CFStringAppendCString(mstr, "/lib/python3.4/lib-dynload:",
kCFStringEncodingUTF8);
CFStringAppend(mstr, str);
- CFStringAppendCString(mstr, "/lib/python3.6/site-packages",
+ CFStringAppendCString(mstr, "/lib/python3.4/site-packages",
kCFStringEncodingUTF8);
CFRelease(str);
path = widen_cfstring(mstr);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]