diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-07-03 12:04:45 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-07-03 12:04:45 +0000 |
commit | 216e0d1372c85916dd17e1f472bbae2a384b9c72 (patch) | |
tree | 06ae190b4f84d0189f53eb9574c6b9a1cead3124 | |
parent | 1dc18aae05e58df758e0f20d2f82d0628f67ed11 (diff) | |
download | portage-216e0d1372c85916dd17e1f472bbae2a384b9c72.tar.gz portage-216e0d1372c85916dd17e1f472bbae2a384b9c72.tar.bz2 portage-216e0d1372c85916dd17e1f472bbae2a384b9c72.zip |
Split out a _create_prefetcher() method from _add_prefetchers().
svn path=/main/trunk/; revision=10913
-rw-r--r-- | pym/_emerge/__init__.py | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index 09aff941a..bff2e3a04 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -7168,21 +7168,33 @@ class Scheduler(object): getbinpkg = "--getbinpkg" in self.myopts for pkg in self._mergelist: - if not isinstance(pkg, Package): - continue - if pkg.type_name == "ebuild": - self._add_task(EbuildFetcherAsync( - logfile=self._fetch_log, - pkg=pkg, register=self._register, - unregister=self._unregister)) - elif pkg.type_name == "binary" and getbinpkg and \ - pkg.root_config.trees["bintree"].isremote(pkg.cpv): - prefetcher = BinpkgFetcherAsync( - logfile=self._fetch_log, - pkg=pkg, register=self._register, - unregister=self._unregister) - prefetchers[pkg] = prefetcher + prefetcher = self._create_prefetcher(pkg) + if prefetcher is not None: self._add_task(prefetcher) + prefetchers[pkg] = prefetcher + + def _create_prefetcher(self, pkg): + """ + @return: a prefetcher, or None if not applicable + """ + prefetcher = None + + if not isinstance(pkg, Package): + pass + + elif pkg.type_name == "ebuild": + + prefetcher = EbuildFetcherAsync(logfile=self._fetch_log, pkg=pkg, + register=self._register, unregister=self._unregister) + + elif pkg.type_name == "binary" and \ + "--getbinpkg" in self.myopts and \ + pkg.root_config.trees["bintree"].isremote(pkg.cpv): + + prefetcher = BinpkgFetcherAsync(logfile=self._fetch_log, + pkg=pkg, register=self._register, unregister=self._unregister) + + return prefetcher def _show_failed_fetches(self): failed_fetches = self._failed_fetches |