gsutil: Parallel-safe, specify target, add clean.

- Update "gsutil.py" to be cooperatively safe when invoked
  multiple times simultaneously.
- Allow the cache directory to be overridden by the
  DEPOT_TOOLS_GSUTIL_BIN_DIR environment variable.
- Add a "--clean" flag to force "gsutil.py" to do a clean download.

BUG=chromium:452497
TEST=local
  - for i in `seq 1 50`; do ./gsutil.py --clean -- version&; done

Review URL: https://codereview.chromium.org/1346213003

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@296772 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/tests/gsutil_test.py b/tests/gsutil_test.py
index 76570dd..d34eebf 100755
--- a/tests/gsutil_test.py
+++ b/tests/gsutil_test.py
@@ -144,8 +144,8 @@
 
     # This should delete the old bin and rewrite it with 'Fake gsutil'
     self.assertRaises(
-        gsutil.InvalidGsutilError, gsutil.ensure_gsutil, version, self.tempdir)
-    self.assertTrue(os.path.isdir(os.path.join(self.tempdir, '.cache_dir')))
+        gsutil.InvalidGsutilError, gsutil.ensure_gsutil, version, self.tempdir,
+        False)
     self.assertTrue(os.path.exists(gsutil_bin))
     with open(gsutil_bin, 'r') as f:
       self.assertEquals(f.read(), fake_gsutil)
@@ -165,7 +165,7 @@
     with open(gsutil_bin, 'w') as f:
       f.write('Foobar')
     self.assertEquals(
-        gsutil.ensure_gsutil(version, self.tempdir), gsutil_bin)
+        gsutil.ensure_gsutil(version, self.tempdir, False), gsutil_bin)
 
 if __name__ == '__main__':
   unittest.main()