Skip to content

Commit

Permalink
Don't write bytecode when generating pydeps files.
Browse files Browse the repository at this point in the history
Bug: 767620
Change-Id: I33072a124e7b487aeb97dba2b0c57d1daf3ea980
Reviewed-on: https://chromium-review.googlesource.com/705095
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: John Budorick <jbudorick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#507103}
  • Loading branch information
jbudorick authored and Commit Bot committed Oct 6, 2017
1 parent 5a7fd99 commit ab2fa10
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion PRESUBMIT.py
Original file line number Diff line number Diff line change
Expand Up @@ -1984,8 +1984,11 @@ def DetermineIfStale(self, pydeps_path):
import difflib
old_pydeps_data = self._LoadFile(pydeps_path).splitlines()
cmd = old_pydeps_data[1][1:].strip()
env = {
'PYTHONDONTWRITEBYTECODE': '1'
}
new_pydeps_data = self._input_api.subprocess.check_output(
cmd + ' --output ""', shell=True)
cmd + ' --output ""', shell=True, env=env)
old_contents = old_pydeps_data[2:]
new_contents = new_pydeps_data.splitlines()[2:]
if old_pydeps_data[2:] != new_pydeps_data.splitlines()[2:]:
Expand Down
6 changes: 3 additions & 3 deletions PRESUBMIT_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ def testRelevantPyNoChange(self):
MockAffectedFile('A.py', []),
]

def mock_check_output(cmd, shell=False):
def mock_check_output(cmd, shell=False, env=None):
self.assertEqual('CMD A --output ""', cmd)
return self.checker._file_cache['A.pydeps']

Expand All @@ -713,7 +713,7 @@ def testRelevantPyOneChange(self):
MockAffectedFile('A.py', []),
]

def mock_check_output(cmd, shell=False):
def mock_check_output(cmd, shell=False, env=None):
self.assertEqual('CMD A --output ""', cmd)
return 'changed data'

Expand All @@ -732,7 +732,7 @@ def testRelevantPyTwoChanges(self):
MockAffectedFile('C.py', []),
]

def mock_check_output(cmd, shell=False):
def mock_check_output(cmd, shell=False, env=None):
return 'changed data'

self.mock_input_api.subprocess.check_output = mock_check_output
Expand Down

0 comments on commit ab2fa10

Please sign in to comment.