public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Mike Frysinger" <vapier@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: sci-geosciences/gpsd/files/, sci-geosciences/gpsd/
Date: Thu, 12 Sep 2019 03:57:56 +0000 (UTC)	[thread overview]
Message-ID: <1568259994.71fdf613a9ffa9be6b2189bb0b91f2288b7f8bf6.vapier@gentoo> (raw)

commit:     71fdf613a9ffa9be6b2189bb0b91f2288b7f8bf6
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sun Sep  8 19:29:00 2019 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Thu Sep 12 03:46:34 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=71fdf613

sci-geosciences/gpsd: fix building with Python 3 as default

Pull in upstream fixes for running scons when Python 3 is default.

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

 .../gpsd/files/gpsd-3.17-scons-print.patch         |  73 +++++++++++
 .../gpsd/files/gpsd-3.17-scons-py3.patch           | 143 +++++++++++++++++++++
 sci-geosciences/gpsd/gpsd-3.17-r4.ebuild           |   2 +
 3 files changed, 218 insertions(+)

diff --git a/sci-geosciences/gpsd/files/gpsd-3.17-scons-print.patch b/sci-geosciences/gpsd/files/gpsd-3.17-scons-print.patch
new file mode 100644
index 00000000000..4d94d05f428
--- /dev/null
+++ b/sci-geosciences/gpsd/files/gpsd-3.17-scons-print.patch
@@ -0,0 +1,73 @@
+From ed205512dd05a7dd4b0dab8af760d13e9efbbb25 Mon Sep 17 00:00:00 2001
+From: Fred Wright <fw@fwright.net>
+Date: Sat, 7 Oct 2017 19:54:55 -0700
+Subject: [PATCH] Fixes SConstruct for SCons 3.0.0.
+
+SCons 3.0.0 introduced a bug where the print_funtion future import is
+inflicted on the SConstruct script, making 'print' as a statement
+illegal.  This is expected to be fixed in SCons 3.0.1, but in the
+meantime it's necessary to switch to the print_function mode for
+compatibility.  Fortunately, there were only three print statements in
+the whole file.
+
+This is not a complete Python 3 fix; it simply restores correct
+operation when running SCons under Python 2.
+
+TESTED:
+Arraged to test all three print() instances under OSX.
+Tested "scons build-all check" under OSX, Ubuntu, CentOS, Fedora,
+FreeBSD, OpenBSD, and NetBSD.
+---
+ SConstruct | 15 +++++++++++----
+ 1 file changed, 11 insertions(+), 4 deletions(-)
+
+diff --git a/SConstruct b/SConstruct
+index 4923ad8cdae3..040103cff387 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -23,6 +23,13 @@
+ # * Out-of-directory builds: see http://www.scons.org/wiki/UsingBuildDir
+ # * Coveraging mode: gcc "-coverage" flag requires a hack
+ #   for building the python bindings
++# * Python 3 compatibility in this recipe
++
++# Since SCons 3.0.0 forces print_function on us, it needs to be unconditional.
++# This is recognized to be a bug in SCons, but we need to live with it for now,
++# and we'll need this for eventual Python 3 compatibility, anyway.
++# Python requires this to precede any non-comment code.
++from __future__ import print_function
+ 
+ # Release identification begins here
+ gpsd_version = "3.18~dev"
+@@ -375,7 +382,7 @@ if env.GetOption("silent"):
+ 
+ def announce(msg):
+     if not env.GetOption("silent"):
+-        print msg
++        print(msg)
+ 
+ # DESTDIR environment variable means user prefix the installation root.
+ DESTDIR = os.environ.get('DESTDIR', '')
+@@ -1546,8 +1553,8 @@ def substituter(target, source, env):
+         content = content.replace(s, t)
+     m = re.search("@[A-Z]+@", content)
+     if m and m.group(0) not in map(lambda x: x[0], substmap):
+-        print >>sys.stderr, "Unknown subst token %s in %s." \
+-            % (m.group(0), sfp.name)
++        print("Unknown subst token %s in %s." % (m.group(0), sfp.name),
++              file=sys.stderr)
+     tfp = open(str(target[0]), "w")
+     tfp.write(content)
+     tfp.close()
+@@ -2191,7 +2198,7 @@ def validation_list(target, source, env):
+         if '-head' not in page:
+             fp = open(page)
+             if "Valid HTML" in fp.read():
+-                print os.path.join(website, os.path.basename(page))
++                print(os.path.join(website, os.path.basename(page)))
+             fp.close()
+ Utility("validation-list", [www], validation_list)
+ 
+-- 
+2.19.1
+

diff --git a/sci-geosciences/gpsd/files/gpsd-3.17-scons-py3.patch b/sci-geosciences/gpsd/files/gpsd-3.17-scons-py3.patch
new file mode 100644
index 00000000000..d6154c47687
--- /dev/null
+++ b/sci-geosciences/gpsd/files/gpsd-3.17-scons-py3.patch
@@ -0,0 +1,143 @@
+From b2ba8d5ade0f9d55c2b51ca41d9c9604662452ad Mon Sep 17 00:00:00 2001
+From: Robert Norris <rw_norris@hotmail.com>
+Date: Mon, 12 Feb 2018 14:16:17 -0800
+Subject: [PATCH] SConstruct: Allow building for Python 3
+
+Still usable with Python 2
+
+Tested:
+scons build-all check
+
+Debian Unstable with python 2.7.14
+OpenSUSE Tumbleweed with python 3.6.4
+---
+ SConstruct | 30 ++++++++++++++++--------------
+ 1 file changed, 16 insertions(+), 14 deletions(-)
+
+diff --git a/SConstruct b/SConstruct
+index c6a309ec3c30..17b47e21342f 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -370,7 +370,7 @@ for flag in ["LDFLAGS", "SHLINKFLAGS", "CPPFLAGS"]:
+ 
+ 
+ # Keep scan-build options in the environment
+-for key, value in os.environ.iteritems():
++for key, value in os.environ.items():
+     if key.startswith('CCC_'):
+         env.Append(ENV={key: value})
+ 
+@@ -476,6 +476,8 @@ if env['sysroot']:
+     env.MergeFlags({"LINKFLAGS": ["--sysroot=%s" % env['sysroot']]})
+ 
+ # Build help
++def cmp(a, b):
++    return (a > b) - (a < b)
+ 
+ Help("""Arguments may be a mixture of switches and targets in any order.
+ Switches apply to the entire build regardless of where they are in the order.
+@@ -859,9 +861,9 @@ else:
+         "dbus_export": ["libdbus-1"],
+     }
+ 
+-    keys = map(lambda x: (x[0], x[2]), boolopts)  \
+-        + map(lambda x: (x[0], x[2]), nonboolopts) \
+-        + map(lambda x: (x[0], x[2]), pathopts)
++    keys = list(map(lambda x: (x[0], x[2]), boolopts))  \
++        + list(map(lambda x: (x[0], x[2]), nonboolopts)) \
++        + list(map(lambda x: (x[0], x[2]), pathopts))
+     keys.sort()
+     for (key, help) in keys:
+         value = env[key]
+@@ -998,7 +1000,7 @@ else:
+ if env['python']:  # May have been turned off by error
+     env['PYTHON'] = target_python_path
+     env['ENV']['PYTHON'] = target_python_path  # For regress-driver
+-    py_config_vars = ast.literal_eval(py_config_text)
++    py_config_vars = ast.literal_eval(py_config_text.decode())
+     py_config_vars = [[] if x is None else x for x in py_config_vars]
+     python_config = dict(zip(PYTHON_CONFIG_NAMES, py_config_vars))
+ 
+@@ -1387,7 +1389,7 @@ else:
+ 
+     python_objects = {}
+     python_compiled_libs = {}
+-    for ext, sources in python_extensions.iteritems():
++    for ext, sources in python_extensions.items():
+         python_objects[ext] = []
+         for src in sources:
+             python_objects[ext].append(
+@@ -1417,7 +1419,7 @@ Platform: UNKNOWN
+     python_egg_info = python_env.Textfile(target="gps-%s.egg-info"
+                                           % (gpsd_version, ),
+                                           source=python_egg_info_source)
+-    python_built_extensions = python_compiled_libs.values()
++    python_built_extensions = list(python_compiled_libs.values())
+     python_targets = python_built_extensions + [python_egg_info]
+ 
+ env.Command(target="packet_names.h", source="packet_states.h", action="""
+@@ -1624,14 +1626,14 @@ if env['xgps']:
+         "xgpsspeed.1": "gps.xml",
+         "xgps.1": "gps.xml",
+     })
+-all_manpages = base_manpages.keys() + python_manpages.keys()
++all_manpages = list(base_manpages.keys()) + list(python_manpages.keys())
+ 
+ man_env = env.Clone()
+ if man_env.GetOption('silent'):
+     man_env['SPAWN'] = filtered_spawn  # Suppress stderr chatter
+ manpage_targets = []
+ if manbuilder:
+-    for (man, xml) in base_manpages.items() + python_manpages.items():
++    for (man, xml) in list(base_manpages.items()) + list(python_manpages.items()):
+         manpage_targets.append(man_env.Man(source=xml, target=man))
+ 
+ # Where it all comes together
+@@ -1682,7 +1684,7 @@ if ((not env['debug'] and not env['profiling'] and not env['nostrip']
+ if not env['python']:
+     python_install = []
+ else:
+-    python_module_dir = python_libdir + os.sep + 'gps'
++    python_module_dir = str(python_libdir) + os.sep + 'gps'
+     python_extensions_install = python_env.Install(DESTDIR + python_module_dir,
+                                                    python_built_extensions)
+     if ((not env['debug'] and not env['profiling']
+@@ -1695,7 +1697,7 @@ else:
+     python_progs_install = python_env.Install(installdir('bindir'),
+                                               python_progs)
+ 
+-    python_egg_info_install = python_env.Install(DESTDIR + python_libdir,
++    python_egg_info_install = python_env.Install(DESTDIR + str(python_libdir),
+                                                  python_egg_info)
+     python_install = [python_extensions_install,
+                       python_modules_install,
+@@ -1712,7 +1714,7 @@ if qt_env:
+ 
+ 
+ maninstall = []
+-for manpage in base_manpages.keys() + python_manpages.keys():
++for manpage in list(base_manpages.keys()) + list(python_manpages.keys()):
+     if not manbuilder and not os.path.exists(manpage):
+         continue
+     section = manpage.split(".")[1]
+@@ -2198,7 +2200,7 @@ htmlpages = Split('''
+     www/writing-a-driver.html
+     ''')
+ 
+-webpages = htmlpages + asciidocs + map(lambda f: f[:-3], glob.glob("www/*.in"))
++webpages = htmlpages + asciidocs + list(map(lambda f: f[:-3], glob.glob("www/*.in")))
+ 
+ www = env.Alias('www', webpages)
+ 
+@@ -2376,7 +2378,7 @@ if os.path.exists("gpsd.c") and os.path.exists(".gitignore"):
+     if ".gitignore" in distfiles:
+         distfiles.remove(".gitignore")
+     distfiles += generated_sources
+-    distfiles += base_manpages.keys() + python_manpages.keys()
++    distfiles += list(base_manpages.keys()) + list(python_manpages.keys())
+     if "packaging/rpm/gpsd.spec" not in distfiles:
+         distfiles.append("packaging/rpm/gpsd.spec")
+ 
+-- 
+2.19.1
+

diff --git a/sci-geosciences/gpsd/gpsd-3.17-r4.ebuild b/sci-geosciences/gpsd/gpsd-3.17-r4.ebuild
index dc6247feaeb..5ffc9c07ef3 100644
--- a/sci-geosciences/gpsd/gpsd-3.17-r4.ebuild
+++ b/sci-geosciences/gpsd/gpsd-3.17-r4.ebuild
@@ -79,6 +79,8 @@ src_prepare() {
 	fi
 
 	epatch "${FILESDIR}"/${P}-do_not_rm_library.patch
+	epatch "${FILESDIR}"/${P}-scons-print.patch
+	epatch "${FILESDIR}"/${P}-scons-py3.patch
 
 	# Avoid useless -L paths to the install dir
 	sed -i \


             reply	other threads:[~2019-09-12  3:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-12  3:57 Mike Frysinger [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-09-25 17:56 [gentoo-commits] repo/gentoo:master commit in: sci-geosciences/gpsd/files/, sci-geosciences/gpsd/ Sam James
2020-09-10 15:27 Marek Szuba
2019-10-04 19:23 Robin H. Johnson
2017-09-21 11:58 Andreas Hüttel
2017-02-17 22:33 Michał Górny
2017-01-24  5:29 Matthias Maier
2016-05-09 19:45 Mike Frysinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1568259994.71fdf613a9ffa9be6b2189bb0b91f2288b7f8bf6.vapier@gentoo \
    --to=vapier@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox