[tbb-commits] [tor-browser/tor-browser-78.8.0esr-10.0-1] Bug 1686168: Immediately unset __PYVENV_LAUNCHER__ when `mach` starts. r=sheehan, glandium a=RyanVM

sysrqb at torproject.org sysrqb at torproject.org
Wed Feb 17 03:51:18 UTC 2021


commit bace0d2a46cabd36f5bdc738c000f15ae4a4225c
Author: Mitchell Hentges <mhentges at mozilla.com>
Date:   Wed Jan 20 16:27:09 2021 +0000

    Bug 1686168: Immediately unset __PYVENV_LAUNCHER__ when `mach` starts. r=sheehan,glandium a=RyanVM
    
    Catch additional cases where both __PYVENV_LAUNCHER__ is set and we invoke a
    virtualenv python by unsetting the variable in a prominent location.
    This will specifically catch the `./mach bootstrap` => `./mach artifact` case.
    
    Differential Revision: https://phabricator.services.mozilla.com/D101809
---
 mach | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/mach b/mach
index 8bdd2756889a..0cc566d4dff7 100755
--- a/mach
+++ b/mach
@@ -216,6 +216,14 @@ def get_mach():
     return check_and_get_mach(os.path.dirname(os.path.realpath(__file__)))
 
 def main(args):
+    # XCode python sets __PYVENV_LAUNCHER__, which overrides the executable
+    # used when a python subprocess is created. This is an issue when we want
+    # to run using our virtualenv python executables.
+    # In future Python relases, __PYVENV_LAUNCHER__ will be cleared before
+    # application code (mach) is started.
+    # https://github.com/python/cpython/pull/9516
+    os.environ.pop("__PYVENV_LAUNCHER__", None)
+
     mach = get_mach()
     if not mach:
         print('Could not run mach: No mach source directory found.')



More information about the tbb-commits mailing list