[yum-commits] Branch 'yum-3_2_X' - yum/__init__.py yum/yumRepo.py
James Antill
james at osuosl.org
Mon Feb 2 18:47:33 UTC 2009
yum/__init__.py | 1 -
yum/yumRepo.py | 25 ++++++++++++++++---------
2 files changed, 16 insertions(+), 10 deletions(-)
New commits:
commit cea34c86cc5142effa3b33fce1a62dff1d8d2bc0
Author: James Antill <james at and.org>
Date: Mon Feb 2 13:47:28 2009 -0500
Make all the directory attrs properties that auto. do the setup
diff --git a/yum/__init__.py b/yum/__init__.py
index d17ae7b..5de0ba2 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -1504,7 +1504,6 @@ class YumBase(depsolve.Depsolve):
removed = 0
for ext in exts:
for repo in self.repos.listEnabled():
- repo.dirSetup()
path = getattr(repo, pathattr)
if os.path.exists(path) and os.path.isdir(path):
filelist = misc.getFileList(path, ext, filelist)
diff --git a/yum/yumRepo.py b/yum/yumRepo.py
index 1050639..a1f4550 100644
--- a/yum/yumRepo.py
+++ b/yum/yumRepo.py
@@ -252,9 +252,6 @@ class YumRepository(Repository, config.RepoConf):
# config is very, very old
# throw in some stubs for things that will be set by the config class
self.basecachedir = ""
- self.cachedir = ""
- self.pkgdir = ""
- self.hdrdir = ""
self.cost = 1000
self.copy_local = 0
# holder for stuff we've grabbed
@@ -499,13 +496,13 @@ class YumRepository(Repository, config.RepoConf):
cachedir = os.path.join(self.basecachedir, self.id)
pkgdir = os.path.join(cachedir, 'packages')
hdrdir = os.path.join(cachedir, 'headers')
- self.setAttribute('cachedir', cachedir)
- self.setAttribute('pkgdir', pkgdir)
- self.setAttribute('hdrdir', hdrdir)
- self.setAttribute('gpgdir', self.cachedir + '/gpgdir')
+ self.setAttribute('_dir_setup_cachedir', cachedir)
+ self.setAttribute('_dir_setup_pkgdir', pkgdir)
+ self.setAttribute('_dir_setup_hdrdir', hdrdir)
+ self.setAttribute('_dir_setup_gpgdir', self.cachedir + '/gpgdir')
cookie = self.cachedir + '/' + self.metadata_cookie_fn
- self.setAttribute('metadata_cookie', cookie)
+ self.setAttribute('_dir_setup_metadata_cookie', cookie)
for dir in [self.cachedir, self.pkgdir]:
if self.cache == 0:
@@ -528,6 +525,17 @@ class YumRepository(Repository, config.RepoConf):
self._preload_md_from_system_cache('mirrorlist.txt')
self._preload_md_from_system_cache('metalink.xml')
+ def _dirAttr(self, attr):
+ """ Make the directory attributes call .dirSetup() if needed. """
+ attr = '_dir_setup_' + attr
+ if not hasattr(self, attr):
+ self.dirSetup()
+ return getattr(self, attr)
+ cachedir = property(lambda self: self._dirAttr('cachedir'))
+ pkgdir = property(lambda self: self._dirAttr('pkgdir'))
+ hdrdir = property(lambda self: self._dirAttr('hdrdir'))
+ gpgdir = property(lambda self: self._dirAttr('gpgdir'))
+ metadata_cookie = property(lambda self: self._dirAttr('metadata_cookie'))
def baseurlSetup(self):
warnings.warn('baseurlSetup() will go away in a future version of Yum.\n',
@@ -860,7 +868,6 @@ class YumRepository(Repository, config.RepoConf):
self.mediafunc = mediafunc
self.gpg_import_func = gpg_import_func
self.confirm_func = confirm_func
- self.dirSetup()
except Errors.RepoError, e:
raise
if not self.mediafunc and self.mediaid and not self.mirrorlist and not self.baseurl:
More information about the Yum-commits
mailing list