58 строки
1.6 KiB
Python
Executable File
58 строки
1.6 KiB
Python
Executable File
#!/usr/bin/env python
|
|
|
|
import os
|
|
import platform
|
|
import subprocess
|
|
import sys
|
|
|
|
|
|
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
|
# We're in JENKINS_ROOT/workspace/libchromiumcontent. Walk up to JENKINS_ROOT.
|
|
JENKINS_ROOT = os.path.dirname(os.path.dirname(SOURCE_ROOT))
|
|
S3_CREDENTIALS_FILE = os.path.join(JENKINS_ROOT, 'config', 's3credentials')
|
|
|
|
|
|
def main():
|
|
if not os.path.isfile(S3_CREDENTIALS_FILE):
|
|
return 'Error: Can\'t find {0}'.format(S3_CREDENTIALS_FILE)
|
|
copy_to_environment(S3_CREDENTIALS_FILE)
|
|
|
|
print 'Python version:', platform.python_version()
|
|
print 'OS version:', os_version()
|
|
|
|
return (run_script('bootstrap') or
|
|
run_script('update') or
|
|
run_script('build') or
|
|
run_script('create-dist') or
|
|
run_script('upload'))
|
|
|
|
|
|
def copy_to_environment(credentials_file):
|
|
with open(credentials_file, 'r') as f:
|
|
for line in f:
|
|
key, value = line.strip().split('=')
|
|
key = key.replace('JANKY_ARTIFACTS_', 'LIBCHROMIUMCONTENT_')
|
|
value = value.strip("'")
|
|
os.environ[key] = value
|
|
|
|
|
|
def os_version():
|
|
if sys.platform in ['win32', 'cygwin']:
|
|
return platform.system() + ' ' + platform.release() + ' ' + platform.version()
|
|
elif sys.platform == 'darwin':
|
|
mac_ver = platform.mac_ver()
|
|
return 'Mac OS X ' + mac_ver[0] + ' ' + mac_ver[2]
|
|
else:
|
|
return platform.platform()
|
|
|
|
|
|
def run_script(script):
|
|
script = os.path.join('script', script)
|
|
sys.stderr.write('+ {0}\n'.format(script))
|
|
sys.stderr.flush()
|
|
return subprocess.call([sys.executable, script])
|
|
|
|
|
|
if __name__ == '__main__':
|
|
sys.exit(main())
|