Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright (c) 2014 The Native Client Authors. All rights reserved. | 1 # Copyright (c) 2014 The Native Client 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 import os | 5 import os |
| 6 import posixpath | 6 import posixpath |
| 7 import shutil | 7 import shutil |
| 8 import tarfile | 8 import tarfile |
| 9 | 9 |
| 10 from naclports import configuration, package, util, error | 10 from naclports import configuration, package, util, error |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 131 | 131 |
| 132 def _Install(self): | 132 def _Install(self): |
| 133 dest = util.GetInstallRoot(self.config) | 133 dest = util.GetInstallRoot(self.config) |
| 134 dest_tmp = os.path.join(dest, 'install_tmp') | 134 dest_tmp = os.path.join(dest, 'install_tmp') |
| 135 if os.path.exists(dest_tmp): | 135 if os.path.exists(dest_tmp): |
| 136 shutil.rmtree(dest_tmp) | 136 shutil.rmtree(dest_tmp) |
| 137 | 137 |
| 138 if self.IsAnyVersionInstalled(): | 138 if self.IsAnyVersionInstalled(): |
| 139 raise error.Error('package already installed: %s' % self.InfoString()) | 139 raise error.Error('package already installed: %s' % self.InfoString()) |
| 140 | 140 |
| 141 util.Log("Installing %s" % self.InfoString()) | 141 self.LogStatus('Installing') |
|
binji
2015/01/09 18:24:59
this is going to do a lot more banners in non-colo
Sam Clegg
2015/01/09 22:14:54
Done.
| |
| 142 util.Makedirs(dest_tmp) | 142 util.Makedirs(dest_tmp) |
| 143 | 143 |
| 144 names = [] | 144 names = [] |
| 145 try: | 145 try: |
| 146 with tarfile.open(self.filename) as tar: | 146 with tarfile.open(self.filename) as tar: |
| 147 for info in tar: | 147 for info in tar: |
| 148 if info.isdir(): | 148 if info.isdir(): |
| 149 continue | 149 continue |
| 150 name = posixpath.normpath(info.name) | 150 name = posixpath.normpath(info.name) |
| 151 if name == 'pkg_info': | 151 if name == 'pkg_info': |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 183 | 183 |
| 184 def WriteFileList(self, file_names): | 184 def WriteFileList(self, file_names): |
| 185 """Write the file list for this package.""" | 185 """Write the file list for this package.""" |
| 186 filename = self.GetListFile() | 186 filename = self.GetListFile() |
| 187 dirname = os.path.dirname(filename) | 187 dirname = os.path.dirname(filename) |
| 188 if not os.path.isdir(dirname): | 188 if not os.path.isdir(dirname): |
| 189 util.Makedirs(dirname) | 189 util.Makedirs(dirname) |
| 190 with open(filename, 'w') as f: | 190 with open(filename, 'w') as f: |
| 191 for name in file_names: | 191 for name in file_names: |
| 192 f.write(name + '\n') | 192 f.write(name + '\n') |
| OLD | NEW |