Workaround Python Issue 26083 in upload.py

This issue is fixed in Python 2.7.12, but we don't guarantee
that we use that version everywhere. The root issue is that,
on certain platforms (e.g. Mac), the exception indicating that
the underlying command (e.g. 'hg') was not found is too large,
and loading the pickle representing the exception fails.

This CL catches this specific exception and treats it identically
to the OS properly raising a 'command not found' code.

BUG=699173

Change-Id: I0483ab0d1d0b6a3dfcfd26f2d9644817b5b5284f
Reviewed-on: https://chromium-review.googlesource.com/455537
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
changes/37/455537/2
Aaron Gable 8 years ago committed by Commit Bot
parent 34924cd4f0
commit edfd7cd8da

@ -2157,6 +2157,10 @@ def GuessVCSName(options):
except OSError as e:
if e.errno != errno.ENOENT: # command not found code
raise
except ValueError as e:
# Workaround for https://bugs.python.org/issue26083
if e.message != "insecure string pickle":
raise
# Mercurial has a command to get the base directory of a repository
# Try running it, but don't die if we don't have hg installed.

Loading…
Cancel
Save