Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(939)

Side by Side Diff: lib/naclports/package.py

Issue 1285953002: Switch devenv to use pkg packages (Closed) Base URL: https://chromium.googlesource.com/external/naclports.git@toolchain_install
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/naclports/bsd_pkg.py ('k') | lib/naclports/source_package.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 6
7 from naclports.util import Log, Warn, LogVerbose 7 from naclports.util import Log, Warn, LogVerbose
8 from naclports.error import Error 8 from naclports.error import Error
9 from naclports import configuration, pkg_info, util 9 from naclports import configuration, pkg_info, util
10 10
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 self.config = configuration.Configuration(self.BUILD_ARCH, 144 self.config = configuration.Configuration(self.BUILD_ARCH,
145 self.BUILD_TOOLCHAIN, 145 self.BUILD_TOOLCHAIN,
146 self.BUILD_CONFIG == 'debug') 146 self.BUILD_CONFIG == 'debug')
147 147
148 def Uninstall(self): 148 def Uninstall(self):
149 self.LogStatus('Uninstalling') 149 self.LogStatus('Uninstalling')
150 self.DoUninstall() 150 self.DoUninstall()
151 151
152 def Files(self): 152 def Files(self):
153 """Yields the list of files currently installed by this package.""" 153 """Yields the list of files currently installed by this package."""
154 file_list = self.GetListFile()
155 if not os.path.exists(file_list):
156 return
154 with open(self.GetListFile()) as f: 157 with open(self.GetListFile()) as f:
155 for line in f: 158 for line in f:
156 yield line.strip() 159 yield line.strip()
157 160
158 def DoUninstall(self): 161 def DoUninstall(self):
159 with util.InstallLock(self.config): 162 with util.InstallLock(self.config):
160 RemoveFile(self.GetInstallStamp()) 163 RemoveFile(self.GetInstallStamp())
161 164
162 root = util.GetInstallRoot(self.config) 165 root = util.GetInstallRoot(self.config)
163 for filename in self.Files(): 166 for filename in self.Files():
164 fullname = os.path.join(root, filename) 167 fullname = os.path.join(root, filename)
165 if not os.path.lexists(fullname): 168 if not os.path.lexists(fullname):
166 Warn('File not found while uninstalling: %s' % fullname) 169 Warn('File not found while uninstalling: %s' % fullname)
167 continue 170 continue
168 LogVerbose('uninstall: %s' % filename) 171 LogVerbose('uninstall: %s' % filename)
169 RemoveFile(fullname) 172 RemoveFile(fullname)
170 173
171 RemoveFile(self.GetListFile()) 174 if os.path.exists(self.GetListFile()):
175 RemoveFile(self.GetListFile())
172 176
173 177
174 def InstalledPackageIterator(config): 178 def InstalledPackageIterator(config):
175 stamp_root = util.GetInstallStampRoot(config) 179 stamp_root = util.GetInstallStampRoot(config)
176 if not os.path.exists(stamp_root): 180 if not os.path.exists(stamp_root):
177 return 181 return
178 182
179 for filename in os.listdir(stamp_root): 183 for filename in os.listdir(stamp_root):
180 if os.path.splitext(filename)[1] != '.info': 184 if os.path.splitext(filename)[1] != '.info':
181 continue 185 continue
182 yield InstalledPackage(os.path.join(stamp_root, filename)) 186 yield InstalledPackage(os.path.join(stamp_root, filename))
183 187
184 188
185 def CreateInstalledPackage(package_name, config=None): 189 def CreateInstalledPackage(package_name, config=None):
186 stamp_root = util.GetInstallStampRoot(config) 190 stamp_root = util.GetInstallStampRoot(config)
187 info_file = os.path.join(stamp_root, package_name + '.info') 191 info_file = os.path.join(stamp_root, package_name + '.info')
188 if not os.path.exists(info_file): 192 if not os.path.exists(info_file):
189 raise Error('package not installed: %s [%s]' % (package_name, config)) 193 raise Error('package not installed: %s [%s]' % (package_name, config))
190 return InstalledPackage(info_file) 194 return InstalledPackage(info_file)
OLDNEW
« no previous file with comments | « lib/naclports/bsd_pkg.py ('k') | lib/naclports/source_package.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698