aboutsummaryrefslogtreecommitdiffhomepage
path: root/infra/bots/recipe_modules/flavor/default_flavor.py
diff options
context:
space:
mode:
authorGravatar Eric Boren <borenet@google.com>2017-01-13 13:37:53 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-17 12:58:30 +0000
commit6441a4645be53e124ec88b8f6c59b8ca2ca4b427 (patch)
tree91892859ad02d4267d6f494dee5284254bb9b12b /infra/bots/recipe_modules/flavor/default_flavor.py
parent2103cf0ff09763aeaa35508734f765aec9b75665 (diff)
Move recipe modules to shared repo
BUG=skia:6070 Change-Id: I6c487e77ddfddb6164b983981dff5ee8ae870376 Reviewed-on: https://skia-review.googlesource.com/6946 Commit-Queue: Eric Boren <borenet@google.com> Reviewed-by: Ravi Mistry <rmistry@google.com> Reviewed-by: Stephan Altmueller <stephana@google.com>
Diffstat (limited to 'infra/bots/recipe_modules/flavor/default_flavor.py')
-rw-r--r--infra/bots/recipe_modules/flavor/default_flavor.py152
1 files changed, 0 insertions, 152 deletions
diff --git a/infra/bots/recipe_modules/flavor/default_flavor.py b/infra/bots/recipe_modules/flavor/default_flavor.py
deleted file mode 100644
index dacb0fd056..0000000000
--- a/infra/bots/recipe_modules/flavor/default_flavor.py
+++ /dev/null
@@ -1,152 +0,0 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-
-# pylint: disable=W0201
-
-
-"""Default flavor utils class, used for desktop builders."""
-
-
-import json
-
-
-WIN_TOOLCHAIN_DIR = 't'
-
-
-class DeviceDirs(object):
- def __init__(self,
- dm_dir,
- perf_data_dir,
- resource_dir,
- images_dir,
- skp_dir,
- svg_dir,
- tmp_dir):
- self._dm_dir = dm_dir
- self._perf_data_dir = perf_data_dir
- self._resource_dir = resource_dir
- self._images_dir = images_dir
- self._skp_dir = skp_dir
- self._svg_dir = svg_dir
- self._tmp_dir = tmp_dir
-
- @property
- def dm_dir(self):
- """Where DM writes."""
- return self._dm_dir
-
- @property
- def perf_data_dir(self):
- return self._perf_data_dir
-
- @property
- def resource_dir(self):
- return self._resource_dir
-
- @property
- def images_dir(self):
- return self._images_dir
-
- @property
- def skp_dir(self):
- """Holds SKP files that are consumed by RenderSKPs and BenchPictures."""
- return self._skp_dir
-
- @property
- def svg_dir(self):
- return self._svg_dir
-
- @property
- def tmp_dir(self):
- return self._tmp_dir
-
-
-class DefaultFlavorUtils(object):
- """Utilities to be used by build steps.
-
- The methods in this class define how certain high-level functions should
- work. Each build step flavor should correspond to a subclass of
- DefaultFlavorUtils which may override any of these functions as appropriate
- for that flavor.
-
- For example, the AndroidFlavorUtils will override the functions for
- copying files between the host and Android device, as well as the
- 'step' function, so that commands may be run through ADB.
- """
- def __init__(self, m):
- self.m = m
- self._chrome_path = None
- self._win_toolchain_dir = self.m.vars.slave_dir.join(WIN_TOOLCHAIN_DIR)
- win_toolchain_asset_path = self.m.vars.infrabots_dir.join(
- 'assets', 'win_toolchain', 'VERSION')
- if not self.m.path.exists(win_toolchain_asset_path):
- self._win_toolchain_dir = self.m.vars.slave_dir
-
- def copy_extra_build_products(self, swarming_out_dir):
- pass
-
- @property
- def out_dir(self):
- """Flavor-specific out directory."""
- return self.m.vars.skia_out.join(self.m.vars.configuration)
-
- def device_path_join(self, *args):
- """Like os.path.join(), but for paths on a connected device."""
- return self.m.path.join(*args)
-
- def copy_directory_contents_to_device(self, host_dir, device_dir):
- """Like shutil.copytree(), but for copying to a connected device."""
- # For "normal" builders who don't have an attached device, we expect
- # host_dir and device_dir to be the same.
- if str(host_dir) != str(device_dir):
- raise ValueError('For builders who do not have attached devices, copying '
- 'from host to device is undefined and only allowed if '
- 'host_path and device_path are the same (%s vs %s).' % (
- str(host_dir), str(device_dir))) # pragma: no cover
-
- def copy_directory_contents_to_host(self, device_dir, host_dir):
- """Like shutil.copytree(), but for copying from a connected device."""
- # For "normal" builders who don't have an attached device, we expect
- # host_dir and device_dir to be the same.
- if str(host_dir) != str(device_dir):
- raise ValueError('For builders who do not have attached devices, copying '
- 'from device to host is undefined and only allowed if '
- 'host_path and device_path are the same (%s vs %s).' % (
- str(host_dir), str(device_dir))) # pragma: no cover
-
- def copy_file_to_device(self, host_path, device_path):
- """Like shutil.copyfile, but for copying to a connected device."""
- # For "normal" builders who don't have an attached device, we expect
- # host_dir and device_dir to be the same.
- if str(host_path) != str(device_path): # pragma: no cover
- raise ValueError('For builders who do not have attached devices, copying '
- 'from host to device is undefined and only allowed if '
- 'host_path and device_path are the same (%s vs %s).' % (
- str(host_path), str(device_path)))
-
- def create_clean_device_dir(self, path):
- """Like shutil.rmtree() + os.makedirs(), but on a connected device."""
- self.create_clean_host_dir(path)
-
- def create_clean_host_dir(self, path):
- """Convenience function for creating a clean directory."""
- self.m.run.rmtree(path)
- self.m.file.makedirs(
- self.m.path.basename(path), path, infra_step=True)
-
- def install(self):
- """Run device-specific installation steps."""
- self.device_dirs = DeviceDirs(
- dm_dir=self.m.vars.dm_dir,
- perf_data_dir=self.m.vars.perf_data_dir,
- resource_dir=self.m.vars.resource_dir,
- images_dir=self.m.vars.images_dir,
- skp_dir=self.m.vars.local_skp_dir,
- svg_dir=self.m.vars.local_svg_dir,
- tmp_dir=self.m.vars.tmp_dir)
-
- def cleanup_steps(self):
- """Run any device-specific cleanup steps."""
- pass