• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2009 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15import edify_generator
16import amend_generator
17
18class BothGenerator(object):
19  def __init__(self, version):
20    self.version = version
21    self.edify = edify_generator.EdifyGenerator(version)
22    self.amend = amend_generator.AmendGenerator()
23
24  def MakeTemporary(self):
25    x = BothGenerator(self.version)
26    x.edify = self.edify.MakeTemporary()
27    x.amend = self.amend.MakeTemporary()
28    return x
29
30  def AppendScript(self, other):
31    self.edify.AppendScript(other.edify)
32    self.amend.AppendScript(other.amend)
33
34  def _DoBoth(self, name, *args):
35    getattr(self.edify, name)(*args)
36    getattr(self.amend, name)(*args)
37
38  def AssertSomeFingerprint(self, *a): self._DoBoth("AssertSomeFingerprint", *a)
39  def AssertOlderBuild(self, *a): self._DoBoth("AssertOlderBuild", *a)
40  def AssertDevice(self, *a): self._DoBoth("AssertDevice", *a)
41  def AssertSomeBootloader(self, *a): self._DoBoth("AssertSomeBootloader", *a)
42  def ShowProgress(self, *a): self._DoBoth("ShowProgress", *a)
43  def PatchCheck(self, *a): self._DoBoth("PatchCheck", *a)
44  def CacheFreeSpaceCheck(self, *a): self._DoBoth("CacheFreeSpaceCheck", *a)
45  def Mount(self, *a): self._DoBoth("Mount", *a)
46  def UnpackPackageDir(self, *a): self._DoBoth("UnpackPackageDir", *a)
47  def Comment(self, *a): self._DoBoth("Comment", *a)
48  def Print(self, *a): self._DoBoth("Print", *a)
49  def FormatPartition(self, *a): self._DoBoth("FormatPartition", *a)
50  def DeleteFiles(self, *a): self._DoBoth("DeleteFiles", *a)
51  def ApplyPatch(self, *a): self._DoBoth("ApplyPatch", *a)
52  def WriteFirmwareImage(self, *a): self._DoBoth("WriteFirmwareImage", *a)
53  def WriteRawImage(self, *a): self._DoBoth("WriteRawImage", *a)
54  def SetPermissions(self, *a): self._DoBoth("SetPermissions", *a)
55  def SetPermissionsRecursive(self, *a): self._DoBoth("SetPermissionsRecursive", *a)
56  def MakeSymlinks(self, *a): self._DoBoth("MakeSymlinks", *a)
57  def AppendExtra(self, *a): self._DoBoth("AppendExtra", *a)
58
59  def AddToZip(self, input_zip, output_zip, input_path=None):
60    self._DoBoth("AddToZip", input_zip, output_zip, input_path)
61