@ -1035,14 +1035,20 @@ def DoPresubmitChecks(change,
A PresubmitOutput object . Use output . should_continue ( ) to figure out
A PresubmitOutput object . Use output . should_continue ( ) to figure out
if there were errors or warnings and the caller should abort .
if there were errors or warnings and the caller should abort .
"""
"""
old_environ = os . environ
try :
# Make sure python subprocesses won't generate .pyc files.
os . environ = os . environ . copy ( )
os . environ [ ' PYTHONDONTWRITEBYTECODE ' ] = ' 1 '
output = PresubmitOutput ( input_stream , output_stream )
output = PresubmitOutput ( input_stream , output_stream )
if committing :
if committing :
output . write ( " Running presubmit commit checks ... \n " )
output . write ( " Running presubmit commit checks ... \n " )
else :
else :
output . write ( " Running presubmit upload checks ... \n " )
output . write ( " Running presubmit upload checks ... \n " )
start_time = time . time ( )
start_time = time . time ( )
presubmit_files = ListRelevantPresubmitFiles ( change . AbsoluteLocalPaths ( True ) ,
presubmit_files = ListRelevantPresubmitFiles (
change . RepositoryRoot ( ) )
change . AbsoluteLocalPaths ( True ) , change . RepositoryRoot ( ) )
if not presubmit_files and verbose :
if not presubmit_files and verbose :
output . write ( " Warning, no presubmit.py found. \n " )
output . write ( " Warning, no presubmit.py found. \n " )
results = [ ]
results = [ ]
@ -1101,6 +1107,8 @@ def DoPresubmitChecks(change,
" & hate mail to maruel@chromium.org! \n " )
" & hate mail to maruel@chromium.org! \n " )
_ASKED_FOR_FEEDBACK = True
_ASKED_FOR_FEEDBACK = True
return output
return output
finally :
os . environ = old_environ
def ScanSubDirs ( mask , recursive ) :
def ScanSubDirs ( mask , recursive ) :