1 |
commit: 71fdf613a9ffa9be6b2189bb0b91f2288b7f8bf6 |
2 |
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Sep 8 19:29:00 2019 +0000 |
4 |
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Sep 12 03:46:34 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=71fdf613 |
7 |
|
8 |
sci-geosciences/gpsd: fix building with Python 3 as default |
9 |
|
10 |
Pull in upstream fixes for running scons when Python 3 is default. |
11 |
|
12 |
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org> |
13 |
|
14 |
.../gpsd/files/gpsd-3.17-scons-print.patch | 73 +++++++++++ |
15 |
.../gpsd/files/gpsd-3.17-scons-py3.patch | 143 +++++++++++++++++++++ |
16 |
sci-geosciences/gpsd/gpsd-3.17-r4.ebuild | 2 + |
17 |
3 files changed, 218 insertions(+) |
18 |
|
19 |
diff --git a/sci-geosciences/gpsd/files/gpsd-3.17-scons-print.patch b/sci-geosciences/gpsd/files/gpsd-3.17-scons-print.patch |
20 |
new file mode 100644 |
21 |
index 00000000000..4d94d05f428 |
22 |
--- /dev/null |
23 |
+++ b/sci-geosciences/gpsd/files/gpsd-3.17-scons-print.patch |
24 |
@@ -0,0 +1,73 @@ |
25 |
+From ed205512dd05a7dd4b0dab8af760d13e9efbbb25 Mon Sep 17 00:00:00 2001 |
26 |
+From: Fred Wright <fw@×××××××.net> |
27 |
+Date: Sat, 7 Oct 2017 19:54:55 -0700 |
28 |
+Subject: [PATCH] Fixes SConstruct for SCons 3.0.0. |
29 |
+ |
30 |
+SCons 3.0.0 introduced a bug where the print_funtion future import is |
31 |
+inflicted on the SConstruct script, making 'print' as a statement |
32 |
+illegal. This is expected to be fixed in SCons 3.0.1, but in the |
33 |
+meantime it's necessary to switch to the print_function mode for |
34 |
+compatibility. Fortunately, there were only three print statements in |
35 |
+the whole file. |
36 |
+ |
37 |
+This is not a complete Python 3 fix; it simply restores correct |
38 |
+operation when running SCons under Python 2. |
39 |
+ |
40 |
+TESTED: |
41 |
+Arraged to test all three print() instances under OSX. |
42 |
+Tested "scons build-all check" under OSX, Ubuntu, CentOS, Fedora, |
43 |
+FreeBSD, OpenBSD, and NetBSD. |
44 |
+--- |
45 |
+ SConstruct | 15 +++++++++++---- |
46 |
+ 1 file changed, 11 insertions(+), 4 deletions(-) |
47 |
+ |
48 |
+diff --git a/SConstruct b/SConstruct |
49 |
+index 4923ad8cdae3..040103cff387 100644 |
50 |
+--- a/SConstruct |
51 |
++++ b/SConstruct |
52 |
+@@ -23,6 +23,13 @@ |
53 |
+ # * Out-of-directory builds: see http://www.scons.org/wiki/UsingBuildDir |
54 |
+ # * Coveraging mode: gcc "-coverage" flag requires a hack |
55 |
+ # for building the python bindings |
56 |
++# * Python 3 compatibility in this recipe |
57 |
++ |
58 |
++# Since SCons 3.0.0 forces print_function on us, it needs to be unconditional. |
59 |
++# This is recognized to be a bug in SCons, but we need to live with it for now, |
60 |
++# and we'll need this for eventual Python 3 compatibility, anyway. |
61 |
++# Python requires this to precede any non-comment code. |
62 |
++from __future__ import print_function |
63 |
+ |
64 |
+ # Release identification begins here |
65 |
+ gpsd_version = "3.18~dev" |
66 |
+@@ -375,7 +382,7 @@ if env.GetOption("silent"): |
67 |
+ |
68 |
+ def announce(msg): |
69 |
+ if not env.GetOption("silent"): |
70 |
+- print msg |
71 |
++ print(msg) |
72 |
+ |
73 |
+ # DESTDIR environment variable means user prefix the installation root. |
74 |
+ DESTDIR = os.environ.get('DESTDIR', '') |
75 |
+@@ -1546,8 +1553,8 @@ def substituter(target, source, env): |
76 |
+ content = content.replace(s, t) |
77 |
+ m = re.search("@[A-Z]+@", content) |
78 |
+ if m and m.group(0) not in map(lambda x: x[0], substmap): |
79 |
+- print >>sys.stderr, "Unknown subst token %s in %s." \ |
80 |
+- % (m.group(0), sfp.name) |
81 |
++ print("Unknown subst token %s in %s." % (m.group(0), sfp.name), |
82 |
++ file=sys.stderr) |
83 |
+ tfp = open(str(target[0]), "w") |
84 |
+ tfp.write(content) |
85 |
+ tfp.close() |
86 |
+@@ -2191,7 +2198,7 @@ def validation_list(target, source, env): |
87 |
+ if '-head' not in page: |
88 |
+ fp = open(page) |
89 |
+ if "Valid HTML" in fp.read(): |
90 |
+- print os.path.join(website, os.path.basename(page)) |
91 |
++ print(os.path.join(website, os.path.basename(page))) |
92 |
+ fp.close() |
93 |
+ Utility("validation-list", [www], validation_list) |
94 |
+ |
95 |
+-- |
96 |
+2.19.1 |
97 |
+ |
98 |
|
99 |
diff --git a/sci-geosciences/gpsd/files/gpsd-3.17-scons-py3.patch b/sci-geosciences/gpsd/files/gpsd-3.17-scons-py3.patch |
100 |
new file mode 100644 |
101 |
index 00000000000..d6154c47687 |
102 |
--- /dev/null |
103 |
+++ b/sci-geosciences/gpsd/files/gpsd-3.17-scons-py3.patch |
104 |
@@ -0,0 +1,143 @@ |
105 |
+From b2ba8d5ade0f9d55c2b51ca41d9c9604662452ad Mon Sep 17 00:00:00 2001 |
106 |
+From: Robert Norris <rw_norris@×××××××.com> |
107 |
+Date: Mon, 12 Feb 2018 14:16:17 -0800 |
108 |
+Subject: [PATCH] SConstruct: Allow building for Python 3 |
109 |
+ |
110 |
+Still usable with Python 2 |
111 |
+ |
112 |
+Tested: |
113 |
+scons build-all check |
114 |
+ |
115 |
+Debian Unstable with python 2.7.14 |
116 |
+OpenSUSE Tumbleweed with python 3.6.4 |
117 |
+--- |
118 |
+ SConstruct | 30 ++++++++++++++++-------------- |
119 |
+ 1 file changed, 16 insertions(+), 14 deletions(-) |
120 |
+ |
121 |
+diff --git a/SConstruct b/SConstruct |
122 |
+index c6a309ec3c30..17b47e21342f 100644 |
123 |
+--- a/SConstruct |
124 |
++++ b/SConstruct |
125 |
+@@ -370,7 +370,7 @@ for flag in ["LDFLAGS", "SHLINKFLAGS", "CPPFLAGS"]: |
126 |
+ |
127 |
+ |
128 |
+ # Keep scan-build options in the environment |
129 |
+-for key, value in os.environ.iteritems(): |
130 |
++for key, value in os.environ.items(): |
131 |
+ if key.startswith('CCC_'): |
132 |
+ env.Append(ENV={key: value}) |
133 |
+ |
134 |
+@@ -476,6 +476,8 @@ if env['sysroot']: |
135 |
+ env.MergeFlags({"LINKFLAGS": ["--sysroot=%s" % env['sysroot']]}) |
136 |
+ |
137 |
+ # Build help |
138 |
++def cmp(a, b): |
139 |
++ return (a > b) - (a < b) |
140 |
+ |
141 |
+ Help("""Arguments may be a mixture of switches and targets in any order. |
142 |
+ Switches apply to the entire build regardless of where they are in the order. |
143 |
+@@ -859,9 +861,9 @@ else: |
144 |
+ "dbus_export": ["libdbus-1"], |
145 |
+ } |
146 |
+ |
147 |
+- keys = map(lambda x: (x[0], x[2]), boolopts) \ |
148 |
+- + map(lambda x: (x[0], x[2]), nonboolopts) \ |
149 |
+- + map(lambda x: (x[0], x[2]), pathopts) |
150 |
++ keys = list(map(lambda x: (x[0], x[2]), boolopts)) \ |
151 |
++ + list(map(lambda x: (x[0], x[2]), nonboolopts)) \ |
152 |
++ + list(map(lambda x: (x[0], x[2]), pathopts)) |
153 |
+ keys.sort() |
154 |
+ for (key, help) in keys: |
155 |
+ value = env[key] |
156 |
+@@ -998,7 +1000,7 @@ else: |
157 |
+ if env['python']: # May have been turned off by error |
158 |
+ env['PYTHON'] = target_python_path |
159 |
+ env['ENV']['PYTHON'] = target_python_path # For regress-driver |
160 |
+- py_config_vars = ast.literal_eval(py_config_text) |
161 |
++ py_config_vars = ast.literal_eval(py_config_text.decode()) |
162 |
+ py_config_vars = [[] if x is None else x for x in py_config_vars] |
163 |
+ python_config = dict(zip(PYTHON_CONFIG_NAMES, py_config_vars)) |
164 |
+ |
165 |
+@@ -1387,7 +1389,7 @@ else: |
166 |
+ |
167 |
+ python_objects = {} |
168 |
+ python_compiled_libs = {} |
169 |
+- for ext, sources in python_extensions.iteritems(): |
170 |
++ for ext, sources in python_extensions.items(): |
171 |
+ python_objects[ext] = [] |
172 |
+ for src in sources: |
173 |
+ python_objects[ext].append( |
174 |
+@@ -1417,7 +1419,7 @@ Platform: UNKNOWN |
175 |
+ python_egg_info = python_env.Textfile(target="gps-%s.egg-info" |
176 |
+ % (gpsd_version, ), |
177 |
+ source=python_egg_info_source) |
178 |
+- python_built_extensions = python_compiled_libs.values() |
179 |
++ python_built_extensions = list(python_compiled_libs.values()) |
180 |
+ python_targets = python_built_extensions + [python_egg_info] |
181 |
+ |
182 |
+ env.Command(target="packet_names.h", source="packet_states.h", action=""" |
183 |
+@@ -1624,14 +1626,14 @@ if env['xgps']: |
184 |
+ "xgpsspeed.1": "gps.xml", |
185 |
+ "xgps.1": "gps.xml", |
186 |
+ }) |
187 |
+-all_manpages = base_manpages.keys() + python_manpages.keys() |
188 |
++all_manpages = list(base_manpages.keys()) + list(python_manpages.keys()) |
189 |
+ |
190 |
+ man_env = env.Clone() |
191 |
+ if man_env.GetOption('silent'): |
192 |
+ man_env['SPAWN'] = filtered_spawn # Suppress stderr chatter |
193 |
+ manpage_targets = [] |
194 |
+ if manbuilder: |
195 |
+- for (man, xml) in base_manpages.items() + python_manpages.items(): |
196 |
++ for (man, xml) in list(base_manpages.items()) + list(python_manpages.items()): |
197 |
+ manpage_targets.append(man_env.Man(source=xml, target=man)) |
198 |
+ |
199 |
+ # Where it all comes together |
200 |
+@@ -1682,7 +1684,7 @@ if ((not env['debug'] and not env['profiling'] and not env['nostrip'] |
201 |
+ if not env['python']: |
202 |
+ python_install = [] |
203 |
+ else: |
204 |
+- python_module_dir = python_libdir + os.sep + 'gps' |
205 |
++ python_module_dir = str(python_libdir) + os.sep + 'gps' |
206 |
+ python_extensions_install = python_env.Install(DESTDIR + python_module_dir, |
207 |
+ python_built_extensions) |
208 |
+ if ((not env['debug'] and not env['profiling'] |
209 |
+@@ -1695,7 +1697,7 @@ else: |
210 |
+ python_progs_install = python_env.Install(installdir('bindir'), |
211 |
+ python_progs) |
212 |
+ |
213 |
+- python_egg_info_install = python_env.Install(DESTDIR + python_libdir, |
214 |
++ python_egg_info_install = python_env.Install(DESTDIR + str(python_libdir), |
215 |
+ python_egg_info) |
216 |
+ python_install = [python_extensions_install, |
217 |
+ python_modules_install, |
218 |
+@@ -1712,7 +1714,7 @@ if qt_env: |
219 |
+ |
220 |
+ |
221 |
+ maninstall = [] |
222 |
+-for manpage in base_manpages.keys() + python_manpages.keys(): |
223 |
++for manpage in list(base_manpages.keys()) + list(python_manpages.keys()): |
224 |
+ if not manbuilder and not os.path.exists(manpage): |
225 |
+ continue |
226 |
+ section = manpage.split(".")[1] |
227 |
+@@ -2198,7 +2200,7 @@ htmlpages = Split(''' |
228 |
+ www/writing-a-driver.html |
229 |
+ ''') |
230 |
+ |
231 |
+-webpages = htmlpages + asciidocs + map(lambda f: f[:-3], glob.glob("www/*.in")) |
232 |
++webpages = htmlpages + asciidocs + list(map(lambda f: f[:-3], glob.glob("www/*.in"))) |
233 |
+ |
234 |
+ www = env.Alias('www', webpages) |
235 |
+ |
236 |
+@@ -2376,7 +2378,7 @@ if os.path.exists("gpsd.c") and os.path.exists(".gitignore"): |
237 |
+ if ".gitignore" in distfiles: |
238 |
+ distfiles.remove(".gitignore") |
239 |
+ distfiles += generated_sources |
240 |
+- distfiles += base_manpages.keys() + python_manpages.keys() |
241 |
++ distfiles += list(base_manpages.keys()) + list(python_manpages.keys()) |
242 |
+ if "packaging/rpm/gpsd.spec" not in distfiles: |
243 |
+ distfiles.append("packaging/rpm/gpsd.spec") |
244 |
+ |
245 |
+-- |
246 |
+2.19.1 |
247 |
+ |
248 |
|
249 |
diff --git a/sci-geosciences/gpsd/gpsd-3.17-r4.ebuild b/sci-geosciences/gpsd/gpsd-3.17-r4.ebuild |
250 |
index dc6247feaeb..5ffc9c07ef3 100644 |
251 |
--- a/sci-geosciences/gpsd/gpsd-3.17-r4.ebuild |
252 |
+++ b/sci-geosciences/gpsd/gpsd-3.17-r4.ebuild |
253 |
@@ -79,6 +79,8 @@ src_prepare() { |
254 |
fi |
255 |
|
256 |
epatch "${FILESDIR}"/${P}-do_not_rm_library.patch |
257 |
+ epatch "${FILESDIR}"/${P}-scons-print.patch |
258 |
+ epatch "${FILESDIR}"/${P}-scons-py3.patch |
259 |
|
260 |
# Avoid useless -L paths to the install dir |
261 |
sed -i \ |