21BASE_URL =
'https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/%s'
22GCLOUD_BASE_NAME=
'google-cloud-sdk'
23GCLOUD_ARCHIVE =
'%s-343.0.0-linux-x86_64.tar.gz' % GCLOUD_BASE_NAME
24GCLOUD_URL = BASE_URL % GCLOUD_ARCHIVE
28 """Create the asset."""
29 target_dir = os.path.abspath(target_dir)
30 subprocess.check_call([
'curl', GCLOUD_URL,
'-o', GCLOUD_ARCHIVE])
33 subprocess.check_call([
'tar',
'-xzf', GCLOUD_ARCHIVE,
34 '--strip-components=1',
39 env = os.environ.copy()
40 env[
"HOME"] = target_dir
41 gcloud_exe = os.path.join(target_dir,
'bin',
'gcloud')
42 subprocess.check_call([gcloud_exe,
'components',
43 'install',
'beta',
'cloud-datastore-emulator',
45 subprocess.check_call([gcloud_exe,
'components',
46 'install',
'beta',
'bigtable',
48 subprocess.check_call([gcloud_exe,
'components',
49 'install',
'pubsub-emulator',
51 subprocess.check_call([gcloud_exe,
'components',
52 'install',
'beta',
'cloud-firestore-emulator',
56 fs_jar =
'platform/cloud-firestore-emulator/cloud-firestore-emulator.jar'
57 subprocess.check_call([
'chmod',
'+x', os.path.join(target_dir, fs_jar)])
58 subprocess.check_call([gcloud_exe,
'components',
'update',
'--quiet'], env=env)
61 os.remove(GCLOUD_ARCHIVE)
65 parser = argparse.ArgumentParser()
66 parser.add_argument(
'--target_dir',
'-t', required=
True)
67 args = parser.parse_args()
71if __name__ ==
'__main__':
def create_asset(target_dir)