Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: games-strategy/0ad/files/, games-strategy/0ad/
Date: Mon, 07 Feb 2022 04:31:31
Message-Id: 1644208257.c5948582c8e35c33b8d6793d6e2c83949b152586.sam@gentoo
1 commit: c5948582c8e35c33b8d6793d6e2c83949b152586
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Mon Feb 7 04:30:43 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Mon Feb 7 04:30:57 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c5948582
7
8 games-strategy/0ad: fix build with newer setuptools
9
10 Closes: https://bugs.gentoo.org/826762
11 Thanks-to: Stephen Cavilia <sac <AT> atomicradi.us>
12 Signed-off-by: Sam James <sam <AT> gentoo.org>
13
14 games-strategy/0ad/0ad-0.0.25b_alpha.ebuild | 3 +-
15 .../files/0ad-0.0.25b_alpha-fix-setuptools.patch | 188 +++++++++++++++++++++
16 2 files changed, 190 insertions(+), 1 deletion(-)
17
18 diff --git a/games-strategy/0ad/0ad-0.0.25b_alpha.ebuild b/games-strategy/0ad/0ad-0.0.25b_alpha.ebuild
19 index e01f6242d2cd..d7b282a68f35 100644
20 --- a/games-strategy/0ad/0ad-0.0.25b_alpha.ebuild
21 +++ b/games-strategy/0ad/0ad-0.0.25b_alpha.ebuild
22 @@ -1,4 +1,4 @@
23 -# Copyright 2014-2021 Gentoo Authors
24 +# Copyright 2014-2022 Gentoo Authors
25 # Distributed under the terms of the GNU General Public License v2
26
27 EAPI=8
28 @@ -90,6 +90,7 @@ RDEPEND="
29
30 PATCHES=(
31 "${FILESDIR}"/${PN}-0.0.24b_alpha-respect-tc.patch
32 + "${FILESDIR}"/${PN}-0.0.25b_alpha-fix-setuptools.patch
33 )
34
35 pkg_setup() {
36
37 diff --git a/games-strategy/0ad/files/0ad-0.0.25b_alpha-fix-setuptools.patch b/games-strategy/0ad/files/0ad-0.0.25b_alpha-fix-setuptools.patch
38 new file mode 100644
39 index 000000000000..ea0626fadadd
40 --- /dev/null
41 +++ b/games-strategy/0ad/files/0ad-0.0.25b_alpha-fix-setuptools.patch
42 @@ -0,0 +1,188 @@
43 +https://bugs.gentoo.org/826762
44 +https://bugzilla.mozilla.org/show_bug.cgi?id=1665675
45 +https://phabricator.services.mozilla.com/D90627
46 +--- a/libraries/source/spidermonkey/patch.sh
47 ++++ b/libraries/source/spidermonkey/patch.sh
48 +@@ -51,5 +51,7 @@ then
49 + # https://svnweb.freebsd.org/ports/head/lang/spidermonkey78/files/patch-third__party_rust_cc_.cargo-checksum.json?view=log
50 + patch -p1 < ../FixFreeBSDCargoChecksum.diff
51 + # https://svnweb.freebsd.org/ports/head/lang/spidermonkey78/files/patch-third__party_rust_cc_src_lib.rs?view=log
52 + patch -p1 < ../FixFreeBSDRustThirdPartyOSDetection.diff
53 + fi
54 ++
55 ++patch -p1 < ../FixSysconfigImport.diff
56 +--- a/libraries/source/spidermonkey/FixSysconfigImport.diff
57 ++++ b/libraries/source/spidermonkey/FixSysconfigImport.diff
58 +@@ -0,0 +1,171 @@
59 ++diff --git a/python/mozbuild/mozbuild/configure/__init__.py b/python/mozbuild/mozbuild/configure/__init__.py
60 ++--- a/python/mozbuild/mozbuild/configure/__init__.py
61 +++++ b/python/mozbuild/mozbuild/configure/__init__.py
62 ++@@ -877,17 +877,56 @@
63 ++
64 ++ def _apply_imports(self, func, glob):
65 ++ for _from, _import, _as in self._imports.pop(func, ()):
66 ++- _from = '%s.' % _from if _from else ''
67 ++- if _as:
68 ++- glob[_as] = self._get_one_import('%s%s' % (_from, _import))
69 +++ self._get_one_import(_from, _import, _as, glob)
70 +++
71 +++ def _handle_wrapped_import(self, _from, _import, _as, glob):
72 +++ """Given the name of a module, "import" a mocked package into the glob
73 +++ iff the module is one that we wrap (either for the sandbox or for the
74 +++ purpose of testing). Applies if the wrapped module is exposed by an
75 +++ attribute of `self`.
76 +++
77 +++ For example, if the import statement is `from os import environ`, then
78 +++ this function will set
79 +++ glob['environ'] = self._wrapped_os.environ.
80 +++
81 +++ Iff this function handles the given import, return True.
82 +++ """
83 +++ module = (_from or _import).split('.')[0]
84 +++ attr = '_wrapped_' + module
85 +++ wrapped = getattr(self, attr, None)
86 +++ if wrapped:
87 +++ if _as or _from:
88 +++ obj = self._recursively_get_property(
89 +++ module, (_from + '.' if _from else '') + _import, wrapped)
90 +++ glob[_as or _import] = obj
91 ++ else:
92 ++- what = _import.split('.')[0]
93 ++- glob[what] = self._get_one_import('%s%s' % (_from, what))
94 +++ glob[module] = wrapped
95 +++ return True
96 +++ else:
97 +++ return False
98 +++
99 +++ def _recursively_get_property(self, module, what, wrapped):
100 +++ """Traverse the wrapper object `wrapped` (which represents the module
101 +++ `module`) and return the property represented by `what`, which may be a
102 +++ series of nested attributes.
103 +++
104 +++ For example, if `module` is 'os' and `what` is 'os.path.join',
105 +++ return `wrapped.path.join`.
106 +++ """
107 +++ if what == module:
108 +++ return wrapped
109 +++ assert what.startswith(module + '.')
110 +++ attrs = what[len(module + '.'):].split('.')
111 +++ for attr in attrs:
112 +++ wrapped = getattr(wrapped, attr)
113 +++ return wrapped
114 ++
115 ++ @memoized_property
116 ++ def _wrapped_os(self):
117 ++ wrapped_os = {}
118 ++ exec_('from os import *', {}, wrapped_os)
119 +++ # Special case os and os.environ so that os.environ is our copy of
120 +++ # the environment.
121 ++ wrapped_os['environ'] = self._environ
122 ++ return ReadOnlyNamespace(**wrapped_os)
123 ++
124 ++@@ -913,57 +952,62 @@
125 ++
126 ++ return ReadOnlyNamespace(**wrapped_subprocess)
127 ++
128 ++- def _get_one_import(self, what):
129 ++- # The special `__sandbox__` module gives access to the sandbox
130 ++- # instance.
131 ++- if what == '__sandbox__':
132 ++- return self
133 +++ @memoized_property
134 +++ def _wrapped_six(self):
135 +++ if six.PY3:
136 +++ return six
137 +++ wrapped_six = {}
138 +++ exec_('from six import *', {}, wrapped_six)
139 +++ wrapped_six_moves = {}
140 +++ exec_('from six.moves import *', {}, wrapped_six_moves)
141 +++ wrapped_six_moves_builtins = {}
142 +++ exec_('from six.moves.builtins import *', {},
143 +++ wrapped_six_moves_builtins)
144 +++
145 ++ # Special case for the open() builtin, because otherwise, using it
146 ++ # fails with "IOError: file() constructor not accessible in
147 ++ # restricted mode". We also make open() look more like python 3's,
148 ++ # decoding to unicode strings unless the mode says otherwise.
149 ++- if what == '__builtin__.open' or what == 'builtins.open':
150 ++- if six.PY3:
151 ++- return open
152 +++ def wrapped_open(name, mode=None, buffering=None):
153 +++ args = (name,)
154 +++ kwargs = {}
155 +++ if buffering is not None:
156 +++ kwargs['buffering'] = buffering
157 +++ if mode is not None:
158 +++ args += (mode,)
159 +++ if 'b' in mode:
160 +++ return open(*args, **kwargs)
161 +++ kwargs['encoding'] = system_encoding
162 +++ return codecs.open(*args, **kwargs)
163 +++
164 +++ wrapped_six_moves_builtins['open'] = wrapped_open
165 +++ wrapped_six_moves['builtins'] = ReadOnlyNamespace(
166 +++ **wrapped_six_moves_builtins)
167 +++ wrapped_six['moves'] = ReadOnlyNamespace(**wrapped_six_moves)
168 ++
169 ++- def wrapped_open(name, mode=None, buffering=None):
170 ++- args = (name,)
171 ++- kwargs = {}
172 ++- if buffering is not None:
173 ++- kwargs['buffering'] = buffering
174 ++- if mode is not None:
175 ++- args += (mode,)
176 ++- if 'b' in mode:
177 ++- return open(*args, **kwargs)
178 ++- kwargs['encoding'] = system_encoding
179 ++- return codecs.open(*args, **kwargs)
180 ++- return wrapped_open
181 ++- # Special case os and os.environ so that os.environ is our copy of
182 ++- # the environment.
183 ++- if what == 'os.environ':
184 ++- return self._environ
185 ++- if what == 'os':
186 ++- return self._wrapped_os
187 ++- # And subprocess, so that its functions use our os.environ
188 ++- if what == 'subprocess':
189 ++- return self._wrapped_subprocess
190 ++- if what in ('subprocess.call', 'subprocess.check_call',
191 ++- 'subprocess.check_output', 'subprocess.Popen'):
192 ++- return getattr(self._wrapped_subprocess, what[len('subprocess.'):])
193 +++ return ReadOnlyNamespace(**wrapped_six)
194 +++
195 +++ def _get_one_import(self, _from, _import, _as, glob):
196 +++ """Perform the given import, placing the result into the dict glob."""
197 +++ if not _from and _import == '__builtin__':
198 +++ glob[_as or '__builtin__'] = __builtin__
199 +++ return
200 +++ if _from == '__builtin__':
201 +++ _from = 'six.moves.builtins'
202 +++ # The special `__sandbox__` module gives access to the sandbox
203 +++ # instance.
204 +++ if not _from and _import == '__sandbox__':
205 +++ glob[_as or _import] = self
206 +++ return
207 +++ if self._handle_wrapped_import(_from, _import, _as, glob):
208 +++ return
209 +++ # If we've gotten this far, we should just do a normal import.
210 ++ # Until this proves to be a performance problem, just construct an
211 ++ # import statement and execute it.
212 ++- import_line = ''
213 ++- if '.' in what:
214 ++- _from, what = what.rsplit('.', 1)
215 ++- if _from == '__builtin__' or _from.startswith('__builtin__.'):
216 ++- _from = _from.replace('__builtin__', 'six.moves.builtins')
217 ++- import_line += 'from %s ' % _from
218 ++- if what == '__builtin__':
219 ++- what = 'six.moves.builtins'
220 ++- import_line += 'import %s as imported' % what
221 ++- glob = {}
222 +++ import_line = '%simport %s%s' % (
223 +++ ('from %s ' % _from) if _from else '', _import,
224 +++ (' as %s' % _as) if _as else '')
225 ++ exec_(import_line, {}, glob)
226 ++- return glob['imported']
227 ++
228 ++ def _resolve_and_set(self, data, name, value, when=None):
229 ++ # Don't set anything when --help was on the command line
230 +