12from __future__
import print_function
21from urllib.request
import urlopen
23FILE_DIR = os.path.dirname(os.path.abspath(__file__))
24INFRA_BOTS_DIR = os.path.realpath(os.path.join(FILE_DIR, os.pardir, os.pardir))
25sys.path.insert(0, INFRA_BOTS_DIR)
29VALGRIND =
'valgrind-3.15.0'
30TARBALL =
'%s.tar.bz2' % VALGRIND
31DOWNLOAD_URL =
'ftp://sourceware.org/pub/valgrind/%s' % TARBALL
32TEMP_DIR = os.path.join(tempfile.gettempdir(),
'skia-%s' % VALGRIND)
33INSTALL_DIR = os.path.join(TEMP_DIR,
'valgrind_install')
38 if os.path.isfile(TARBALL):
40 with open(TARBALL,
'wb')
as f:
41 f.write(urlopen(DOWNLOAD_URL).
read())
46 if os.path.isdir(VALGRIND):
48 subprocess.check_call([
'tar',
'xvjf', TARBALL])
52 if os.path.isdir(INSTALL_DIR):
54 os.makedirs(INSTALL_DIR)
58 if os.path.isfile(os.path.join(INSTALL_DIR,
'bin',
'valgrind')):
61 subprocess.check_call([
'./configure',
'--prefix=%s' % INSTALL_DIR])
62 subprocess.check_call([
'make'])
63 subprocess.check_call([
'make',
'install'])
68 os.mkdir(os.path.join(target_dir,
'bin'))
69 shutil.copy(os.path.join(INSTALL_DIR,
'bin',
'valgrind'),
70 os.path.join(target_dir,
'bin',
'valgrind'))
71 os.mkdir(os.path.join(target_dir,
'lib'))
72 os.mkdir(os.path.join(target_dir,
'lib',
'valgrind'))
73 for lib
in [
'memcheck-amd64-linux']:
74 shutil.copy(os.path.join(INSTALL_DIR,
'lib',
'valgrind', lib),
75 os.path.join(target_dir,
'lib',
'valgrind', lib))
76 for lib
in [
'core',
'memcheck']:
77 libname =
'vgpreload_%s-amd64-linux.so' % lib
78 shutil.copy(os.path.join(INSTALL_DIR,
'lib',
'valgrind', libname),
79 os.path.join(target_dir,
'lib',
'valgrind', libname))
81 shutil.copy(
'default.supp',
82 os.path.join(target_dir,
'lib',
'valgrind',
'default.supp'))
86 """Create the asset."""
88 print(
'This script does not run on Windows.')
92 if not os.path.isdir(TEMP_DIR):
101 parser = argparse.ArgumentParser()
102 parser.add_argument(
'--target_dir',
'-t', required=
True)
103 args = parser.parse_args()
107if __name__ ==
'__main__':
static bool read(SkStream *stream, void *buffer, size_t amount)
def create_asset(target_dir)
def copy_files(target_dir)
def print(*args, **kwargs)