Skip to content

Commit 1bcff3b

Browse files
committed
[firefox] 132.0.2-3: fix build with python 3.13
Python 3.13.1 introduces behaviour change of module "sysconfig": sysconfig.get_config_vars() doesn't reflect changes of sys.prefix/ sys.exec_prefix after initialization. This breaks initialization of mach, which overwrites sys.prefix to apply a different virtualenv. Since this has been fixed both in upstream Python and Firefox, this patch should be only considered as a temporary workaround. Python 3.11 also removes deprecated module "pipes". Backport upstream change to fix it. References: https://bugzilla.mozilla.org/show_bug.cgi?id=1935621 References: https://docs.python.org/3/whatsnew/3.13.html#whatsnew313-pep594 Link: python/cpython#126789 Link: https://hg.mozilla.org/mozilla-central/rev/7a8dbd4de3c70d6a6ac98469a9b92e4877019e0c
1 parent 957a496 commit 1bcff3b

File tree

3 files changed

+67
-1
lines changed

3 files changed

+67
-1
lines changed

PKGBUILD

+6-1
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,22 @@ source=(
3737
firefox.desktop
3838
distribution.ini
3939
visibility.patch
40+
fix-venv-activation.patch
41+
remove-usage-of-pipes.patch
4042
)
4143
sha256sums=('329e1764f4b4e13f11dcf1fd7b3c6d8f80e512e8b7ed5bf65fbe44749c2610e9'
4244
'7307e32b1b553d43a3f739d5e684d9a32c45f5d7db017860c568984a420f5bb1'
4345
'b26bb318afbfe42325d81e1c7323541c2558bb151a647c015e72a8d50f0e9bba'
4446
'18a0f1df76834ac3d4ddb150aa857785df641b54f9fbf0cfb6ffcec64dad72d4'
4547
'a22ceb0bbf5830d3afbacd656e6893ff0ce455fae5f48c7daa5f836112291ba7'
46-
'98527320399c5efe4dd0103fa0af3732470700abb515871d28e001edc3e49e7e')
48+
'98527320399c5efe4dd0103fa0af3732470700abb515871d28e001edc3e49e7e'
49+
'8f2d112e8e0e975174396f86ad675fd33da541130f5f1115e27a89322d361c63'
50+
'9105f3fca96125c52231fc56aad63bf0826c93189392e9743414b2ee4b8db275')
4751
# FIXME: ADD MORE MEMORY!!!
4852
options=(!lto)
4953

5054
prepare() {
55+
# remove-usage-of-pipes.patch: https://hg.mozilla.org/mozilla-central/rev/7a8dbd4de3c70d6a6ac98469a9b92e4877019e0c
5156
_patch_ firefox-$pkgver
5257

5358
mkdir mozbuild

fix-venv-activation.patch

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
diff --git a/python/mach/mach/site.py b/python/mach/mach/site.py
2+
index 7041437..ca4b8c4 100644
3+
--- a/python/mach/mach/site.py
4+
+++ b/python/mach/mach/site.py
5+
@@ -1379,6 +1379,7 @@ def activate_virtualenv(virtualenv: PythonVirtualenv):
6+
site.addsitedir(os.path.realpath(path))
7+
8+
sys.prefix = virtualenv.prefix
9+
+ sys.exec_prefix = virtualenv.prefix
10+
11+
12+
def _mach_virtualenv_root(checkout_scoped_state_dir):

remove-usage-of-pipes.patch

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
diff --git a/python/mozbuild/mozbuild/action/node.py b/python/mozbuild/mozbuild/action/node.py
2+
--- a/python/mozbuild/mozbuild/action/node.py
3+
+++ b/python/mozbuild/mozbuild/action/node.py
4+
@@ -1,19 +1,20 @@
5+
# This Source Code Form is subject to the terms of the Mozilla Public
6+
# License, v. 2.0. If a copy of the MPL was not distributed with this
7+
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
8+
9+
-import pipes
10+
import subprocess
11+
import sys
12+
13+
import buildconfig
14+
import six
15+
16+
+from mozbuild.shellutil import quote as shell_quote
17+
+
18+
SCRIPT_ALLOWLIST = [buildconfig.topsrcdir + "/devtools/client/shared/build/build.js"]
19+
20+
ALLOWLIST_ERROR = """
21+
%s is not
22+
in SCRIPT_ALLOWLIST in python/mozbuild/mozbuild/action/node.py.
23+
Using NodeJS from moz.build is currently in beta, and node
24+
scripts to be executed need to be added to the allowlist and
25+
reviewed by a build peer so that we can get a better sense of
26+
@@ -42,18 +43,17 @@ def execute_node_cmd(node_cmd_list):
27+
28+
The node script is expected to output lines for all of the dependencies
29+
to stdout, each prefixed by the string "dep:". These lines will make up
30+
the returned set of dependencies. Any line not so-prefixed will simply be
31+
printed to stderr instead.
32+
"""
33+
34+
try:
35+
- printable_cmd = " ".join(pipes.quote(arg) for arg in node_cmd_list)
36+
- print('Executing "{}"'.format(printable_cmd), file=sys.stderr)
37+
+ print('Executing "{}"'.format(shell_quote(*node_cmd_list)), file=sys.stderr)
38+
sys.stderr.flush()
39+
40+
# We need to redirect stderr to a pipe because
41+
# https://github.com/nodejs/node/issues/14752 causes issues with make.
42+
proc = subprocess.Popen(
43+
node_cmd_list, stdout=subprocess.PIPE, stderr=subprocess.PIPE
44+
)
45+
46+
47+
48+
49+

0 commit comments

Comments
 (0)