[gtk-osx] Run jhbuild in the venv's python3.
- From: John Ralls <jralls src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-osx] Run jhbuild in the venv's python3.
- Date: Mon, 17 Aug 2020 19:46:53 +0000 (UTC)
commit 8e38f9ea44f9d76f68c917818d1dd814ebd3934d
Author: John Ralls <jralls ceridwen us>
Date: Mon Aug 17 12:36:08 2020 -0700
Run jhbuild in the venv's python3.
Updates to jhbuildrc-gtk-osx for py3.
gtk-osx-setup.sh | 10 +++++-----
jhbuildrc-gtk-osx | 40 ++++++++++++++++++++--------------------
2 files changed, 25 insertions(+), 25 deletions(-)
---
diff --git a/gtk-osx-setup.sh b/gtk-osx-setup.sh
index 9322a87..bcea0c8 100755
--- a/gtk-osx-setup.sh
+++ b/gtk-osx-setup.sh
@@ -177,20 +177,20 @@ if test ! -d "$DEVPREFIX/libexec" ; then
fi
if test ! -f "$DEVPREFIX/libexec/run_jhbuild.py" ; then
cat <<EOF > "$DEVPREFIX/libexec/run_jhbuild.py"
-#!/usr/bin/python
+#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import os
-import __builtin__
+import builtins
sys.path.insert(0, '$DEV_SRC_ROOT/jhbuild')
pkgdatadir = None
datadir = None
import jhbuild
srcdir = os.path.abspath(os.path.join(os.path.dirname(jhbuild.__file__), '..'))
-__builtin__.__dict__['PKGDATADIR'] = pkgdatadir
-__builtin__.__dict__['DATADIR'] = datadir
-__builtin__.__dict__['SRCDIR'] = srcdir
+builtins.__dict__['PKGDATADIR'] = pkgdatadir
+builtins.__dict__['DATADIR'] = datadir
+builtins.__dict__['SRCDIR'] = srcdir
import jhbuild.main
jhbuild.main.main(sys.argv[1:])
diff --git a/jhbuildrc-gtk-osx b/jhbuildrc-gtk-osx
index c4e7e51..7892e64 100644
--- a/jhbuildrc-gtk-osx
+++ b/jhbuildrc-gtk-osx
@@ -38,8 +38,8 @@ def _popen(cmd_arg):
cmd.stdout.close()
devnull.close()
if err:
- raise RuntimeError, "Failed to close %s stream" % cmd_arg
- return retval
+ raise RuntimeError("Failed to close %s stream" % cmd_arg)
+ return retval.decode('utf-8')
# Register an extra command to get the checkout dir for a module.
#
@@ -61,7 +61,7 @@ class _cmd_get_srcdir(jhbuild.commands.Command):
module = module_set.get_module(modname, ignore_case = True)
except KeyError:
raise RuntimeError(_('unknown module %s') % modname)
- print module.get_srcdir(None)
+ print(module.get_srcdir(None))
else:
raise FatalError('no module specified')
@@ -112,9 +112,9 @@ class _getenv(jhbuild.commands.Command):
raise FatalError("No environment variable")
var = args[0]
- if not os.environ.has_key(var):
+ if var not in os.environ:
raise FatalError("variable " + var + " not defined in jhbuild environment")
- print os.environ[var]
+ print(os.environ[var])
jhbuild.commands.register_command(_getenv)
@@ -150,11 +150,11 @@ def xcode_ver():
raise EnvironmentError("No suitable Xcode found. Xcode 5.0 or later is required.")
else: #Command-Line Tools instead of Xcode
ver_str = _popen("pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | grep version*")
- print "Found Command Line Tools '%s'" % ver_str
+ print("Found Command Line Tools '%s'" % ver_str)
exp = re.compile(r'version: (\d+\.\d+)')
vernum = exp.match(ver_str)
if vernum:
- print "Command Line Tools version %f" % float(vernum.group(1))
+ print("Command Line Tools version %f" % float(vernum.group(1)))
return float(vernum.group(1))
else:
return 8.0
@@ -287,10 +287,10 @@ def setup_sdk(target=_target, sdk_version=None, architectures=[_default_arch]):
conditions.add('64-bit')
append_autogenargs("glib", "ac_cv_c_bigendian=no")
append_autogenargs("openssl", "darwin64-arm64-cc #") # Not a legal value
- elif len(set(architectures) - set(["i386", "x86_64", 'arm64'])) > 0:
+ elif len(set(architectures) - {"i386", "x86_64", 'arm64'}) > 0:
raise EnvironmentError("Only architectures i386, x86_64, and arm64 are supported.")
if len(set(architectures)) > 1:
- print "WARNING: Universal builds are neither prohibited nor supported. It might work, but if it
doesn't you're on your own."
+ print("WARNING: Universal builds are neither prohibited nor supported. It might work, but if it
doesn't you're on your own.")
# For unknown reasons, iconv is not picked up correctly without this
#
gcc = _popen("xcrun -f gcc")
@@ -436,7 +436,7 @@ _gtk_osx_default_build = ""
#print "Default Architecture %s\n" % _default_arch
if _osx_version < 9.0:
- print "Error: Mac OS X 10.9 or newer is required, exiting."
+ print("Error: Mac OS X 10.9 or newer is required, exiting.")
raise SystemExit
###### Import Customizations ######
@@ -468,7 +468,7 @@ if not os.path.exists(_user_rc):
_user_rc = os.path.join(_home, '.jhbuildrc-custom')
if os.path.exists(_user_rc):
- execfile(_user_rc)
+ exec(compile(open(_user_rc, "rb").read(), _user_rc, 'exec'))
# Allow including different variants depending on the environment
# variable JHB. This can be used to have different setups for SDK
@@ -491,16 +491,16 @@ _old_build = os.environ.get('JHBUILD_CONFIG', "")
_ran_recursively = _old_prefix != ""
if _ran_recursively:
if _old_build != _build:
- print "Error: jhbuild is already running with a different build setup, exiting."
+ print("Error: jhbuild is already running with a different build setup, exiting.")
raise SystemExit
- print "Warning: jhbuild is started from within a jhbuild session."
+ print("Warning: jhbuild is started from within a jhbuild session.")
if _build != "":
try:
- execfile(os.path.join(os.environ['HOME'], '.jhbuildrc-' + _build))
- except EnvironmentError, e:
- print "Couldn't find the file '.jhbuildrc-" + _build + "', exiting."
+ exec(compile(open(os.path.join(os.environ['HOME'], '.jhbuildrc-' + _build), "rb").read(),
os.path.join(os.environ['HOME'], '.jhbuildrc-' + _build), 'exec'))
+ except EnvironmentError as e:
+ print("Couldn't find the file '.jhbuildrc-" + _build + "', exiting.")
raise SystemExit
# The following parameters were set to None at the top of the file;
@@ -530,7 +530,7 @@ os.environ['JHBUILD_SOURCE'] = checkoutroot
#os.environ['LIBTOOLIZE'] = _exec_prefix + '/bin/libtoolize'
#Some autogens detect that it's a Mac and use glibtoolize if it's
#available. Override this behavior.
-if not (os.environ.has_key ("LIBTOOLIZE") and os.environ["LIBTOOLIZE"]):
+if not ("LIBTOOLIZE" in os.environ and os.environ["LIBTOOLIZE"]):
environ_append('LIBTOOLIZE', os.path.join(prefix, "bin", "libtoolize"))
@@ -577,11 +577,11 @@ append_autogenargs("gconf", "--enable-static")
if _build:
if "shell" in sys.argv:
- print "Build setup: %s, prefix: %s" % (_build, prefix)
+ print("Build setup: %s, prefix: %s" % (_build, prefix))
os.environ["JHBUILD_CONFIG"] = _build
else:
if "shell" in sys.argv:
- print "Prefix: %s" % (prefix)
+ print("Prefix: %s" % (prefix))
if not _ran_recursively and _gtk_osx_prompt_prefix:
os.environ["JHBUILD_PROMPT"] = "[" + _gtk_osx_prompt_prefix + "] "
@@ -610,4 +610,4 @@ os.environ['PYTHON'] = '/usr/bin/env python3'
os.unsetenv("JHB")
if "shell" in sys.argv:
- print "Entered jhbuild shell, type 'exit' to return."
+ print("Entered jhbuild shell, type 'exit' to return.")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]