From 9358b069237f4e0ca6899b7c74c6820138318559 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 22 Dec 2008 01:24:12 +0000 Subject: Remove code from unused config.load_infodir() method and issue a deprecation warning if it's called. svn path=/main/trunk/; revision=12275 --- pym/portage/__init__.py | 70 +++---------------------------------------------- 1 file changed, 3 insertions(+), 67 deletions(-) diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index a69ca7a4a..e015bd596 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -1865,73 +1865,9 @@ class config(object): self.regenerate(use_cache=use_cache) def load_infodir(self,infodir): - self.modifying() - backup_pkg_metadata = dict(self.configdict["pkg"].iteritems()) - if "pkg" in self.configdict and \ - "CATEGORY" in self.configdict["pkg"]: - self.configdict["pkg"].clear() - self.configdict["pkg"]["CATEGORY"] = \ - backup_pkg_metadata["CATEGORY"] - else: - raise portage.exception.PortageException( - "No pkg setup for settings instance?") - - retval = 0 - found_category_file = False - if os.path.isdir(infodir): - if os.path.exists(infodir+"/environment"): - self.configdict["pkg"]["PORT_ENV_FILE"] = infodir+"/environment" - - myre = re.compile('^[A-Z]+$') - null_byte = "\0" - for filename in listdir(infodir,filesonly=1,EmptyOnError=1): - if filename == "FEATURES": - # FEATURES from the build host shouldn't be interpreted as - # FEATURES on the client system. - continue - if filename == "CATEGORY": - found_category_file = True - continue - if myre.match(filename): - try: - file_path = os.path.join(infodir, filename) - mydata = open(file_path).read().strip() - if len(mydata) < 2048 or filename == "USE": - if null_byte in mydata: - writemsg("!!! Null byte found in metadata " + \ - "file: '%s'\n" % file_path, noiselevel=-1) - continue - if filename == "USE": - binpkg_flags = "-* " + mydata - self.configdict["pkg"][filename] = binpkg_flags - self.configdict["env"][filename] = mydata - else: - self.configdict["pkg"][filename] = mydata - self.configdict["env"][filename] = mydata - except (OSError, IOError): - writemsg("!!! Unable to read file: %s\n" % infodir+"/"+filename, - noiselevel=-1) - pass - retval = 1 - - # Missing or corrupt CATEGORY will cause problems for - # doebuild(), which uses it to infer the cpv. We already - # know the category, so there's no need to trust this - # file. Show a warning if the file is missing though, - # because it's required (especially for binary packages). - if not found_category_file: - writemsg("!!! CATEGORY file is missing: %s\n" % \ - os.path.join(infodir, "CATEGORY"), noiselevel=-1) - self.configdict["pkg"].update(backup_pkg_metadata) - retval = 0 - - # Always set known good values for these variables, since - # corruption of these can cause problems: - cat, pf = catsplit(self.mycpv) - self.configdict["pkg"]["CATEGORY"] = cat - self.configdict["pkg"]["PF"] = pf - - return retval + warnings.warn("portage.config.load_infodir() is deprecated", + DeprecationWarning) + return 1 def setcpv(self, mycpv, use_cache=1, mydb=None): """ -- cgit v1.2.3-1-g7c22