Deprecate pordbapi.mysettings since the portdbapi.settings alias is now
authorZac Medico <zmedico@gentoo.org>
Sun, 31 Jan 2010 21:53:20 +0000 (21:53 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 31 Jan 2010 21:53:20 +0000 (21:53 -0000)
supported by stable portage.

svn path=/main/trunk/; revision=15306

bin/repoman
pym/_emerge/main.py
pym/portage/dbapi/__init__.py
pym/portage/dbapi/porttree.py
pym/portage/news.py

index c6fe0789de39ab47cfdb88c94e9c4381f7f78732..86139628bcfeb679873fadd03705b3c3d6b81154 100755 (executable)
@@ -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)
index d9916c9ddb4148990f04feaca5dd8bee8f337a4b..68d6aa466ff3f0bf087df073f03abfb616eaa25f 100644 (file)
@@ -1080,7 +1080,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)
index 53358c8295e987715f1a22f0d475d729b9d2d361..c758491f1e3e18fb89f9184f36b881bfe6405bd4 100644 (file)
@@ -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)
index d5ecce987619c85c385d528a2175f885130864ed..4cf7d410d1e02beacd7fee91254983c075ed1e9a 100644 (file)
@@ -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
index c178a8c4859c13baa4b50304f23d60351c46b19b..a1ce422462fac0224002bf8e102ad6e1151f5385 100644 (file)
@@ -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