Commit 23bd7353 authored by Robert Iannucci's avatar Robert Iannucci Committed by Commit Bot

Clear $VPYTHON_CLEAR_PYTHONPATH when setting $PYTHONPATH.

On buildbot (only), we don't trust PYTHONPATH, so we have set
VPYTHON_CLEAR_PYTHONPATH to make the first invocation of vpython in a
given chain of python invocations clear PYTHONPATH.

This has the unfortunate side-effect that python scripts that set
PYTHONPATH and then call into vpython (like presubmit) end up
having their PYTHONPATH modifications removed.

As a workaround (until I clean up PYTHONPATH in buildbot for real), fix
presubmit_canned_checks so that it clears VPYTHON_CLEAR_PYTHONPATH when it
adjusts PYTHONPATH.

R=charlie@chromium.org, nodir@chromium.org, vadimsh@chromium.org

Bug: 825290,825174
Change-Id: Ib5f73add1726fdf3c335d26fc0af76cfe3b747b2
Reviewed-on: https://chromium-review.googlesource.com/978632Reviewed-by: 's avatarCharlie Andrews <charliea@chromium.org>
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
parent 728244f7
......@@ -607,6 +607,7 @@ def GetPythonUnitTests(input_api, output_api, unit_tests):
if env.get('PYTHONPATH'):
backpath.append(env.get('PYTHONPATH'))
env['PYTHONPATH'] = input_api.os_path.pathsep.join((backpath))
env.pop('VPYTHON_CLEAR_PYTHONPATH', None)
cmd = [input_api.python_executable, '-m', '%s' % unit_test]
results.append(input_api.Command(
name=unit_test_name,
......@@ -732,6 +733,7 @@ def GetPylint(input_api, output_api, white_list=None, black_list=None,
import sys
env['PYTHONPATH'] = input_api.os_path.pathsep.join(
extra_paths_list + sys.path).encode('utf8')
env.pop('VPYTHON_CLEAR_PYTHONPATH', None)
def GetPylintCmd(flist, extra, parallel):
# Windows needs help running python files so we explicitly specify
......
No-op file. Edit this to kick recipes. Yep.
No-op file. Edit this to kick recipes.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment