Changeset View
Changeset View
Standalone View
Standalone View
head/www/firefox/files/patch-bug1288587
Show All 17 Lines | |||||
+ for j in ('added', 'modified'): | + for j in ('added', 'modified'): | ||||
+ try: | + try: | ||||
+ del mozconfig[i][j]['PYTHON'] | + del mozconfig[i][j]['PYTHON'] | ||||
+ except KeyError: | + except KeyError: | ||||
+ pass | + pass | ||||
log.debug("python2: executable from configuration: %r" % python) | log.debug("python2: executable from configuration: %r" % python) | ||||
@@ -358,7 +365,10 @@ def virtualenv_python2(env_python, build_env, mozillab | @@ -365,7 +372,10 @@ def virtualenv_python2(env_python, build_env, mozillab | ||||
sys.executable, manager.python_path)) | sys.executable, manager.python_path)) | ||||
log.info('Reexecuting in the virtualenv') | log.info('Reexecuting in the virtualenv') | ||||
if env_python: | if env_python: | ||||
- del os.environ['PYTHON'] | - del os.environ['PYTHON'] | ||||
+ try: | + try: | ||||
+ del os.environ['PYTHON'] | + del os.environ['PYTHON'] | ||||
+ except KeyError: | + except KeyError: | ||||
+ pass | + pass | ||||
# One would prefer to use os.execl, but that's completely borked on | # One would prefer to use os.execl, but that's completely borked on | ||||
# Windows. | # Windows. | ||||
sys.exit(subprocess.call([python] + sys.argv)) | sys.exit(subprocess.call([python] + sys.argv)) | ||||
@@ -460,6 +470,7 @@ option(env='PYTHON3', nargs=1, help='Python 3 interpre | @@ -468,6 +478,7 @@ option(env='PYTHON3', nargs=1, help='Python 3 interpre | ||||
@imports(_from='mozbuild.pythonutil', _import='find_python3_executable') | @imports(_from='mozbuild.pythonutil', _import='find_python3_executable') | ||||
@imports(_from='mozbuild.pythonutil', _import='python_executable_version') | @imports(_from='mozbuild.pythonutil', _import='python_executable_version') | ||||
@imports(_from='six', _import='ensure_text') | @imports(_from='six', _import='ensure_text') | ||||
+@imports(_from='__builtin__', _import='KeyError') | +@imports(_from='__builtin__', _import='KeyError') | ||||
def virtualenv_python3(env_python, build_env, mozillabuild, mozconfig, help): | def virtualenv_python3(env_python, build_env, mozillabuild, mozconfig, help): | ||||
if help: | if help: | ||||
return | return | ||||
@@ -495,6 +506,12 @@ def virtualenv_python3(env_python, build_env, mozillab | @@ -503,6 +514,12 @@ def virtualenv_python3(env_python, build_env, mozillab | ||||
python = mozconfig['vars']['added']['PYTHON3'] | python = mozconfig['vars']['added']['PYTHON3'] | ||||
elif 'PYTHON3' in mozconfig['vars']['modified']: | elif 'PYTHON3' in mozconfig['vars']['modified']: | ||||
python = mozconfig['vars']['modified']['PYTHON3'][1] | python = mozconfig['vars']['modified']['PYTHON3'][1] | ||||
+ for i in ('env', 'vars'): | + for i in ('env', 'vars'): | ||||
+ for j in ('added', 'modified'): | + for j in ('added', 'modified'): | ||||
+ try: | + try: | ||||
+ del mozconfig[i][j]['PYTHON3'] | + del mozconfig[i][j]['PYTHON3'] | ||||
+ except KeyError: | + except KeyError: | ||||
+ pass | + pass | ||||
log.debug("python3: executable from configuration: %r" % python) | log.debug("python3: executable from configuration: %r" % python) | ||||
@@ -575,7 +592,10 @@ def virtualenv_python3(env_python, build_env, mozillab | @@ -583,7 +600,10 @@ def virtualenv_python3(env_python, build_env, mozillab | ||||
sys.executable, manager.python_path)) | sys.executable, manager.python_path)) | ||||
log.info('Re-executing in the virtualenv') | log.info('Re-executing in the virtualenv') | ||||
if env_python: | if env_python: | ||||
- del os.environ['PYTHON3'] | - del os.environ['PYTHON3'] | ||||
+ try: | + try: | ||||
+ del os.environ['PYTHON3'] | + del os.environ['PYTHON3'] | ||||
+ except KeyError: | + except KeyError: | ||||
+ pass | + pass | ||||
# One would prefer to use os.execl, but that's completely borked on | # Homebrew on macOS will change Python's sys.executable to a custom | ||||
# Windows. | # value which messes with mach's virtualenv handling code. Override | ||||
sys.exit(subprocess.call([python] + sys.argv)) | # Homebrew's changes with the correct sys.executable value. |