aboutsummaryrefslogtreecommitdiff
path: root/www/firefox/files/patch-bug1288587
blob: 0925ac98733cb986f3f9aa03b1935f85297a7813 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
diff --git a/build/moz.configure/init.configure b/build/moz.configure/init.configure
index 855214a..1e91d51 100644
--- build/moz.configure/init.configure
+++ build/moz.configure/init.configure
@@ -238,6 +238,7 @@ option(
 @imports(_from="mozbuild.pythonutil", _import="find_python3_executable")
 @imports(_from="mozbuild.pythonutil", _import="python_executable_version")
 @imports(_from="six", _import="ensure_text")
+@imports(_from="__builtin__", _import="KeyError")
 def virtualenv_python3(env_python, build_env, mozconfig, help):
     # Avoid re-executing python when running configure --help.
     if help:
@@ -271,6 +272,12 @@ def virtualenv_python3(env_python, virtualenv_name, bu
             python = mozconfig["vars"]["added"]["PYTHON3"]
         elif "PYTHON3" in mozconfig["vars"]["modified"]:
             python = mozconfig["vars"]["modified"]["PYTHON3"][1]
+        for i in ("env", "vars"):
+            for j in ("added", "modified"):
+                try:
+                    del mozconfig[i][j]["PYTHON3"]
+                except KeyError:
+                    pass
 
     log.debug("python3: executable from configuration: %r" % python)
 
@@ -364,7 +371,10 @@ def virtualenv_python3(env_python, virtualenv_name, bu
         )
         log.info("Re-executing in the virtualenv")
         if env_python:
-            del os.environ["PYTHON3"]
+                try:
+                    del os.environ["PYTHON3"]
+                except KeyError:
+                    pass
         # Another quirk on macOS, with the system python, the virtualenv is
         # not fully operational (missing entries in sys.path) if
         # __PYVENV_LAUNCHER__ is set.