mirrored from https://chromium.googlesource.com/angle/angle
- Notifications
You must be signed in to change notification settings - Fork 645
/
Copy pathangle_tools.py
49 lines (38 loc) · 1.54 KB
/
angle_tools.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/python3
#
# Copyright 2019 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# angle_tools.py:
# Common functionality to scripts in angle/tools directory.
importos
importplatform
importsubprocess
is_windows=platform.system() =='Windows'
is_linux=platform.system() =='Linux'
is_mac=platform.system() =='Darwin'
deffind_file_in_path(filename):
""" Finds |filename| by searching the environment paths """
path_delimiter=';'ifis_windowselse':'
forenv_pathinos.environ['PATH'].split(path_delimiter):
full_path=os.path.join(env_path, filename)
ifos.path.isfile(full_path):
returnfull_path
raiseException('Cannot find %s in environment'%filename)
defget_exe_name(file_name, windows_extension):
exe_name=file_name
ifis_windows:
exe_name+=windows_extension
returnexe_name
defupload_to_google_storage(bucket, files):
file_dir=os.path.dirname(os.path.realpath(__file__))
upload_script=os.path.join(file_dir, '..', 'third_party', 'depot_tools',
'upload_to_google_storage.py')
upload_args= ['python3', upload_script, '-b', bucket] +files
returnsubprocess.call(upload_args) ==0
defstage_google_storage_sha1(files):
git_exe=get_exe_name('git', '.bat')
git_exe=find_file_in_path(git_exe)
sha1_files= [f+'.sha1'forfinfiles]
returnsubprocess.call([git_exe, 'add'] +sha1_files) ==0