f54b4d5eb4
This reverts commit 167e608bb3
.
Reason for revert: breaking Housekeeper-CheckGeneratedFiles
(fetch-clang-format)
Original change's description:
> [infra] Remove old python scripts and urllib2 references
>
> I was searching for urllib2 while resolving issues with
> https://skia-review.googlesource.com/c/skia/+/538636
> when I found several old, apparently unused scripts.
>
> Rather than fix them, let's get rid of them. If they
> are still in use, the conversion to urllib.request is
> pretty easy.
>
> Change-Id: I27d419601e81c93a3d53e280188a379dfab927c4
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/538936
> Auto-Submit: Kevin Lubick <kjlubick@google.com>
> Commit-Queue: Kevin Lubick <kjlubick@google.com>
> Commit-Queue: Ravi Mistry <rmistry@google.com>
> Reviewed-by: Ravi Mistry <rmistry@google.com>
Change-Id: I139a3cd070da2e6fee2f8865138cf6a63441a8cb
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/539201
Auto-Submit: John Stiles <johnstiles@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
38 lines
996 B
Python
Executable File
38 lines
996 B
Python
Executable File
#!/usr/bin/python
|
|
|
|
# Copyright (c) 2014 The Chromium Authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
|
|
|
|
"""Retrieve the given file from googlesource.com."""
|
|
|
|
|
|
from contextlib import closing
|
|
|
|
import base64
|
|
import sys
|
|
import urllib2
|
|
|
|
|
|
def get(repo_url, filepath):
|
|
"""Retrieve the contents of the given file from the given googlesource repo.
|
|
|
|
Args:
|
|
repo_url: string; URL of the repository from which to retrieve the file.
|
|
filepath: string; path of the file within the repository.
|
|
|
|
Return:
|
|
string; the contents of the given file.
|
|
"""
|
|
base64_url = '/'.join((repo_url, '+', 'main', filepath)) + '?format=TEXT'
|
|
with closing(urllib2.urlopen(base64_url)) as f:
|
|
return base64.b64decode(f.read())
|
|
|
|
|
|
if __name__ == '__main__':
|
|
if len(sys.argv) != 3:
|
|
print >> sys.stderr, 'Usage: %s <repo_url> <filepath>' % sys.argv[0]
|
|
sys.exit(1)
|
|
sys.stdout.write(get(sys.argv[1], sys.argv[2]))
|