| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """A module for architecture output directory fixups.""" | 5 """A module for architecture output directory fixups.""" |
| 6 | 6 |
| 7 import cr | 7 import cr |
| 8 | 8 |
| 9 | 9 |
| 10 class _ArchInitHookHelper(cr.InitHook): | 10 class _ArchInitHookHelper(cr.InitHook): |
| 11 """Base class helper for CR_ARCH value fixups.""" | 11 """Base class helper for CR_ARCH value fixups.""" |
| 12 | 12 |
| 13 def _VersionTest(self, old_version): | 13 def _VersionTest(self, old_version): |
| 14 _ = old_version | 14 _ = old_version |
| 15 return True | 15 return True |
| 16 | 16 |
| 17 def _ArchConvert(self, old_arch): | 17 def _ArchConvert(self, old_arch): |
| 18 return old_arch | 18 return old_arch |
| 19 | 19 |
| 20 def Run(self, context, old_version, config): | 20 def Run(self, old_version, config): |
| 21 if old_version is None or not self._VersionTest(old_version): | 21 if old_version is None or not self._VersionTest(old_version): |
| 22 return | 22 return |
| 23 old_arch = config.OVERRIDES.Find(cr.Arch.SELECTOR) | 23 old_arch = config.OVERRIDES.Find(cr.Arch.SELECTOR) |
| 24 new_arch = self._ArchConvert(old_arch) | 24 new_arch = self._ArchConvert(old_arch) |
| 25 if new_arch != old_arch: | 25 if new_arch != old_arch: |
| 26 print '** Fixing architecture from {0} to {1}'.format(old_arch, new_arch) | 26 print '** Fixing architecture from {0} to {1}'.format(old_arch, new_arch) |
| 27 config.OVERRIDES[cr.Arch.SELECTOR] = new_arch | 27 config.OVERRIDES[cr.Arch.SELECTOR] = new_arch |
| 28 | 28 |
| 29 | 29 |
| 30 class WrongArchDefaultInitHook(_ArchInitHookHelper): | 30 class WrongArchDefaultInitHook(_ArchInitHookHelper): |
| (...skipping 14 matching lines...) Expand all Loading... |
| 45 class MipsAndArmRenameInitHook(_ArchInitHookHelper): | 45 class MipsAndArmRenameInitHook(_ArchInitHookHelper): |
| 46 """Fixes rename of Mips and Arm to Mips32 and Arm32.""" | 46 """Fixes rename of Mips and Arm to Mips32 and Arm32.""" |
| 47 | 47 |
| 48 def _ArchConvert(self, old_arch): | 48 def _ArchConvert(self, old_arch): |
| 49 if old_arch == 'mips': | 49 if old_arch == 'mips': |
| 50 return cr.Mips32Arch.GetInstance().name | 50 return cr.Mips32Arch.GetInstance().name |
| 51 if old_arch == 'arm': | 51 if old_arch == 'arm': |
| 52 return cr.Arm32Arch.GetInstance().name | 52 return cr.Arm32Arch.GetInstance().name |
| 53 return old_arch | 53 return old_arch |
| 54 | 54 |
| OLD | NEW |