dart-sdk/tools/bots/upload_debian_packages.py
Nate Bosch 55f81f2210 Mass format python with yapf
- Add `.style.yapf` with configuration to use Google style.
- Run `yapf` on all `.py` files in this repo.
- Manually fix one trailing space in a doc string.
- Run `git cl format runtime` to satisfy presubmit.

Change-Id: I7e6bd11e91f07926b9188362599af398551eed79
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111600
Commit-Queue: Nate Bosch <nbosch@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2019-08-05 20:34:31 +00:00

48 lines
1.7 KiB
Python
Executable file

#!/usr/bin/python
# Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
import os
import bot
import bot_utils
utils = bot_utils.GetUtils()
HOST_OS = utils.GuessOS()
def ArchiveArtifacts(tarfile, builddir, channel):
namer = bot_utils.GCSNamer(channel=channel)
gsutil = bot_utils.GSUtil()
revision = utils.GetArchiveVersion()
# Archive the src tar to the src dir
remote_tarfile = '/'.join(
[namer.src_directory(revision),
os.path.basename(tarfile)])
gsutil.upload(tarfile, remote_tarfile, public=True)
# Archive all files except the tar file to the linux packages dir
for entry in os.listdir(builddir):
full_path = os.path.join(builddir, entry)
# We expect a flat structure, not subdirectories
assert (os.path.isfile(full_path))
if full_path != tarfile:
package_dir = namer.linux_packages_directory(revision)
remote_file = '/'.join([package_dir, os.path.basename(entry)])
gsutil.upload(full_path, remote_file, public=True)
if __name__ == '__main__':
bot_name, _ = bot.GetBotName()
channel = bot_utils.GetChannelFromName(bot_name)
if channel != bot_utils.Channel.BLEEDING_EDGE:
builddir = os.path.join(bot_utils.DART_DIR, utils.GetBuildDir(HOST_OS),
'src_and_installation')
version = utils.GetVersion()
tarfilename = 'dart-%s.tar.gz' % version
tarfile = os.path.join(builddir, tarfilename)
ArchiveArtifacts(tarfile, builddir, channel)
else:
print 'Not uploading artifacts on bleeding edge'