From: Zac Medico Date: Tue, 2 Mar 2010 19:51:44 +0000 (-0000) Subject: Deprecate pordbapi.mysettings since the portdbapi.settings alias is now X-Git-Tag: v2.1.8~181 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c3dbaac02e716b3b8cc8ad7fa7250fbbb82d1373;p=portage.git Deprecate pordbapi.mysettings since the portdbapi.settings alias is now supported by stable portage. (trunk r15306) svn path=/main/branches/2.1.7/; revision=15541 --- diff --git a/bin/repoman b/bin/repoman index a7ebb26ae..29832fd3d 100755 --- a/bin/repoman +++ b/bin/repoman @@ -557,7 +557,7 @@ repoman_settings.categories = tuple(sorted( portage.util.stack_lists([categories], incremental=1))) del categories -portdb.mysettings = repoman_settings +portdb.settings = repoman_settings root_config = RootConfig(repoman_settings, trees[root], None) # We really only need to cache the metadata that's necessary for visibility # filtering. Anything else can be discarded to reduce memory consumption. @@ -1770,7 +1770,7 @@ for x in scanlist: arch_xmatch_caches[xmatch_cache_key] = xcache trees["/"]["porttree"].settings = dep_settings - portdb.mysettings = dep_settings + portdb.settings = dep_settings portdb.xcache = xcache # for package.use.mask support inside dep_check dep_settings.setcpv(pkg) diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py index 7b6221107..40cd0a2b3 100644 --- a/pym/_emerge/main.py +++ b/pym/_emerge/main.py @@ -938,7 +938,7 @@ def repo_name_duplicate_check(trees): for root, root_trees in trees.items(): if 'porttree' in root_trees: portdb = root_trees['porttree'].dbapi - if portdb.mysettings.get('PORTAGE_REPO_DUPLICATE_WARN') != '0': + if portdb.settings.get('PORTAGE_REPO_DUPLICATE_WARN') != '0': for repo_name, paths in portdb._ignored_repos: k = (root, repo_name, portdb.getRepositoryPath(repo_name)) ignored_repos.setdefault(k, []).extend(paths) diff --git a/pym/portage/dbapi/__init__.py b/pym/portage/dbapi/__init__.py index 53358c829..c758491f1 100644 --- a/pym/portage/dbapi/__init__.py +++ b/pym/portage/dbapi/__init__.py @@ -171,7 +171,7 @@ class dbapi(object): continue else: # Check masked and forced flags for repoman. - mysettings = getattr(self, "mysettings", None) + mysettings = getattr(self, 'settings', None) if mysettings is not None and not mysettings.local_config: pkg = "%s:%s" % (cpv, slot) diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index d5ecce987..4cf7d410d 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -125,17 +125,22 @@ class portdbapi(dbapi): _use_mutable = True def _get_settings(self): - return self.mysettings + warnings.warn("Use portdbapi.settings insead of portdbapi.mysettings", + DeprecationWarning) + return self.settings def _set_settings(self, settings): - self.mysettings = settings + warnings.warn("Use portdbapi.settings insead of portdbapi.mysettings", + DeprecationWarning) + self.settings = settings def _del_settings (self): - del self.mysettings + warnings.warn("Use portdbapi.settings insead of portdbapi.mysettings", + DeprecationWarning) + del self.settings - settings = property(_get_settings, _set_settings, _del_settings, - "Define self.settings as an alias for self.mysettings, " + \ - "for conformity with other dbapi classes.") + mysettings = property(_get_settings, _set_settings, _del_settings, + "Deprecated self.mysettings, only for backward compatibility") @property def _categories(self): @@ -152,12 +157,12 @@ class portdbapi(dbapi): from portage import config if mysettings: - self.mysettings = mysettings + self.settings = mysettings else: from portage import settings - self.mysettings = config(clone=settings) + self.settings = config(clone=settings) - porttree_root = self.mysettings['PORTDIR'] + porttree_root = self.settings['PORTDIR'] # always show this warning after this parameter # is unused in stable portage @@ -172,8 +177,8 @@ class portdbapi(dbapi): # is generated by the depend phase. It's safest to use a clone for # this purpose because doebuild makes many changes to the config # instance that is passed in. - self.doebuild_settings = config(clone=self.mysettings) - self.depcachedir = os.path.realpath(self.mysettings.depcachedir) + self.doebuild_settings = config(clone=self.settings) + self.depcachedir = os.path.realpath(self.settings.depcachedir) if os.environ.get("SANDBOX_ON") == "1": # Make api consumers exempt from sandbox violations @@ -186,7 +191,7 @@ class portdbapi(dbapi): porttrees = [os.path.realpath(porttree_root)] porttrees.extend(os.path.realpath(x) for x in \ - self.mysettings.get('PORTDIR_OVERLAY', '').split()) + self.settings.get('PORTDIR_OVERLAY', '').split()) treemap = {} repository_map = {} self.treemap = treemap @@ -242,7 +247,7 @@ class portdbapi(dbapi): self._have_root_eclass_dir = os.path.isdir( os.path.join(self.porttree_root, "eclass")) - self.metadbmodule = self.mysettings.load_best_module("portdbapi.metadbmodule") + self.metadbmodule = self.settings.load_best_module("portdbapi.metadbmodule") #if the portdbapi is "frozen", then we assume that we can cache everything (that no updates to it are happening) self.xcache = {} @@ -250,7 +255,7 @@ class portdbapi(dbapi): self._repo_info = {} eclass_dbs = {porttree_root : self.eclassdb} - local_repo_configs = self.mysettings._local_repo_configs + local_repo_configs = self.settings._local_repo_configs default_loc_repo_config = None repo_aliases = {} if local_repo_configs is not None: @@ -265,7 +270,7 @@ class portdbapi(dbapi): "'%s' alias in " \ "'%s'\n") % (alias, repo_name, overridden_alias, - self.mysettings._local_repo_conf_path), + self.settings._local_repo_conf_path), level=logging.WARNING, noiselevel=-1) repo_aliases[alias] = repo_name @@ -324,7 +329,7 @@ class portdbapi(dbapi): writemsg_level(_("Unavailable repository '%s' " \ "referenced by eclass-overrides entry in " \ "'%s'\n") % (other_name, - self.mysettings._local_repo_conf_path), + self.settings._local_repo_conf_path), level=logging.ERROR, noiselevel=-1) continue porttrees.append(other_path) @@ -342,7 +347,7 @@ class portdbapi(dbapi): self._repo_info[path] = _repo_info(repo_name, path, eclass_db) - self.auxdbmodule = self.mysettings.load_best_module("portdbapi.auxdbmodule") + self.auxdbmodule = self.settings.load_best_module("portdbapi.auxdbmodule") self.auxdb = {} self._pregen_auxdb = {} self._init_cache_dirs() @@ -379,7 +384,7 @@ class portdbapi(dbapi): self.depcachedir, x, filtered_auxdbkeys, **cache_kwargs) if self.auxdbmodule is metadata_overlay.database: self.auxdb[x].db_ro.ec = self._repo_info[x].eclass_db - if "metadata-transfer" not in self.mysettings.features: + if "metadata-transfer" not in self.settings.features: for x in self.porttrees: if x in self._pregen_auxdb: continue @@ -806,7 +811,7 @@ class portdbapi(dbapi): if myebuild is None: raise AssertionError("ebuild not found for '%s'" % mypkg) pkgdir = os.path.dirname(myebuild) - mf = Manifest(pkgdir, self.mysettings["DISTDIR"]) + mf = Manifest(pkgdir, self.settings["DISTDIR"]) checksums = mf.getDigests() if not checksums: if debug: @@ -821,7 +826,7 @@ class portdbapi(dbapi): if debug: writemsg(_("[bad digest]: missing %(file)s for %(pkg)s\n") % {"file":myfile, "pkg":mypkg}) continue - file_path = os.path.join(self.mysettings["DISTDIR"], myfile) + file_path = os.path.join(self.settings["DISTDIR"], myfile) mystat = None try: mystat = os.stat(file_path) @@ -851,7 +856,7 @@ class portdbapi(dbapi): if myebuild is None: raise AssertionError("ebuild not found for '%s'" % mypkg) pkgdir = os.path.dirname(myebuild) - mf = Manifest(pkgdir, self.mysettings["DISTDIR"]) + mf = Manifest(pkgdir, self.settings["DISTDIR"]) mysums = mf.getDigests() failures = {} @@ -862,7 +867,7 @@ class portdbapi(dbapi): else: try: ok, reason = portage.checksum.verify_all( - os.path.join(self.mysettings["DISTDIR"], x), mysums[x]) + os.path.join(self.settings["DISTDIR"], x), mysums[x]) except FileNotFound as e: ok = False reason = _("File Not Found: '%s'") % (e,) @@ -887,7 +892,7 @@ class portdbapi(dbapi): def cp_all(self): "returns a list of all keys in our tree" d = {} - for x in self.mysettings.categories: + for x in self.settings.categories: for oroot in self.porttrees: for y in listdir(oroot+"/"+x, EmptyOnError=1, ignorecvs=1, dirsonly=1): if not self._pkg_dir_name_re.match(y) or \ @@ -948,7 +953,7 @@ class portdbapi(dbapi): if invalid_category and d: writemsg(_("\n!!! '%s' has a category that is not listed in " \ "%setc/portage/categories\n") % \ - (mycp, self.mysettings["PORTAGE_CONFIGROOT"]), noiselevel=-1) + (mycp, self.settings["PORTAGE_CONFIGROOT"]), noiselevel=-1) mylist = [] else: mylist = list(d) @@ -986,7 +991,7 @@ class portdbapi(dbapi): if not mydep: #this stuff only runs on first call of xmatch() #create mydep, mykey from origdep - mydep = dep_expand(origdep, mydb=self, settings=self.mysettings) + mydep = dep_expand(origdep, mydb=self, settings=self.settings) mykey = mydep.cp if level == "list-visible": @@ -1015,7 +1020,7 @@ class portdbapi(dbapi): else: mylist = match_from_list(mydep, self.cp_list(mykey)) myval = "" - settings = self.mysettings + settings = self.settings local_config = settings.local_config aux_keys = list(self._aux_cache_keys) if level == "minimum-visible": @@ -1102,8 +1107,8 @@ class portdbapi(dbapi): db_keys = ["SLOT"] visible = [] - getMaskAtom = self.mysettings._getMaskAtom - getProfileMaskAtom = self.mysettings._getProfileMaskAtom + getMaskAtom = self.settings._getMaskAtom + getProfileMaskAtom = self.settings._getProfileMaskAtom for cpv in mylist: try: metadata = dict(zip(db_keys, self.aux_get(cpv, db_keys))) @@ -1127,9 +1132,9 @@ class portdbapi(dbapi): newlist=[] aux_keys = list(self._aux_cache_keys) metadata = {} - local_config = self.mysettings.local_config - chost = self.mysettings.get('CHOST', '') - accept_chost = self.mysettings._accept_chost + local_config = self.settings.local_config + chost = self.settings.get('CHOST', '') + accept_chost = self.settings._accept_chost for mycpv in mylist: metadata.clear() try: @@ -1147,7 +1152,7 @@ class portdbapi(dbapi): continue if _eapi_is_deprecated(eapi): continue - if self.mysettings._getMissingKeywords(mycpv, metadata): + if self.settings._getMissingKeywords(mycpv, metadata): continue if local_config: metadata['CHOST'] = chost @@ -1158,9 +1163,9 @@ class portdbapi(dbapi): self.doebuild_settings.setcpv(mycpv, mydb=metadata) metadata['USE'] = self.doebuild_settings['PORTAGE_USE'] try: - if self.mysettings._getMissingLicenses(mycpv, metadata): + if self.settings._getMissingLicenses(mycpv, metadata): continue - if self.mysettings._getMissingProperties(mycpv, metadata): + if self.settings._getMissingProperties(mycpv, metadata): continue except InvalidDependString: continue diff --git a/pym/portage/news.py b/pym/portage/news.py index c178a8c48..a1ce42246 100644 --- a/pym/portage/news.py +++ b/pym/portage/news.py @@ -59,9 +59,9 @@ class NewsManager(object): portdir = portdb.porttree_root profiles_base = os.path.join(portdir, 'profiles') + os.path.sep profile_path = None - if portdb.mysettings.profile_path: + if portdb.settings.profile_path: profile_path = normalize_path( - os.path.realpath(portdb.mysettings.profile_path)) + os.path.realpath(portdb.settings.profile_path)) if profile_path.startswith(profiles_base): profile_path = profile_path[len(profiles_base):] self._profile_path = profile_path