1#!/usr/bin/python 2 3# Copyright (c) 2014 The Chromium OS Authors. All rights reserved. 4# Use of this source code is governed by a BSD-style license that can be 5# found in the LICENSE file. 6 7import os, shutil 8from autotest_lib.client.bin import utils 9 10version = 1 11 12 13def setup(topdir): 14 """Unpack tarball to src/ and apply patch. 15 @param topdir: The directory of this deps. 16 """ 17 tarball = 'webgl-performance-0.0.2.tar.bz2' 18 srcdir = os.path.join(topdir, 'src') 19 filesdir = os.path.join(topdir, 'files') 20 shutil.rmtree(srcdir, ignore_errors=True) 21 tarball_path = os.path.join(filesdir, tarball) 22 if not os.path.exists(srcdir): 23 os.mkdir(srcdir) 24 utils.extract_tarball_to_dir(tarball_path, srcdir) 25 os.chdir(srcdir) 26 utils.system('patch -p1 < ../files/0001-Patch-index.html.patch') 27 utils.system('patch -p1 < ../files/0002-Report-tests-url-name.patch') 28 shutil.copy('../files/favicon.ico', srcdir) 29 30 31pwd = os.getcwd() 32utils.update_version(pwd + '/src', True, version, setup, pwd) 33