[entropy.client] drop urlFetcher and MultipleUrlFetcher properties, make them protected
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
|
||||
import os
|
||||
from entropy.core import Singleton
|
||||
from entropy.fetchers import UrlFetcher, MultipleUrlFetcher
|
||||
from entropy.output import TextInterface, bold, red, darkred, blue
|
||||
from entropy.client.interfaces.loaders import LoadersMixin
|
||||
from entropy.client.interfaces.cache import CacheMixin
|
||||
@@ -635,14 +636,12 @@ class Client(Singleton, TextInterface, LoadersMixin, CacheMixin, CalculatorsMixi
|
||||
level = self._settings['system']['log_level'],
|
||||
filename = etpConst['entropylogfile'], header = "[client]")
|
||||
|
||||
self.MultipleUrlFetcher = multiple_url_fetcher
|
||||
self.urlFetcher = url_fetcher
|
||||
if self.urlFetcher == None:
|
||||
from entropy.fetchers import UrlFetcher
|
||||
self.urlFetcher = UrlFetcher
|
||||
if self.MultipleUrlFetcher == None:
|
||||
from entropy.fetchers import MultipleUrlFetcher
|
||||
self.MultipleUrlFetcher = MultipleUrlFetcher
|
||||
self._multiple_url_fetcher = multiple_url_fetcher
|
||||
self._url_fetcher = url_fetcher
|
||||
if url_fetcher is None:
|
||||
self._url_fetcher = UrlFetcher
|
||||
if multiple_url_fetcher is None:
|
||||
self._multiple_url_fetcher = MultipleUrlFetcher
|
||||
|
||||
self._cacher = EntropyCacher()
|
||||
|
||||
|
||||
@@ -820,7 +820,7 @@ class AvailablePackagesRepositoryUpdater(object):
|
||||
const_setup_perms(filepath_dir, etpConst['entropygid'],
|
||||
f_perms = 0o644)
|
||||
|
||||
fetcher = self._entropy.urlFetcher(
|
||||
fetcher = self._entropy._url_fetcher(
|
||||
url,
|
||||
filepath,
|
||||
resume = False,
|
||||
|
||||
@@ -1539,8 +1539,8 @@ class MiscMixin:
|
||||
|
||||
start_time = time.time()
|
||||
for idx in range(retries):
|
||||
fetcher = self.urlFetcher(mirror, tmp_path, resume = False,
|
||||
show_speed = False)
|
||||
fetcher = self._url_fetcher(mirror, tmp_path,
|
||||
resume = False, show_speed = False)
|
||||
fetcher.download()
|
||||
end_time = time.time()
|
||||
|
||||
|
||||
@@ -171,13 +171,13 @@ class Package:
|
||||
for pkg_id, repo, url, dest_path, cksum in url_data:
|
||||
url_path_list.append((url, dest_path,))
|
||||
self._setup_differential_download(
|
||||
self._entropy.MultipleUrlFetcher, url, resume, dest_path,
|
||||
self._entropy._multiple_url_fetcher, url, resume, dest_path,
|
||||
repo, pkg_id)
|
||||
|
||||
# load class
|
||||
fetch_intf = self._entropy.MultipleUrlFetcher(url_path_list,
|
||||
fetch_intf = self._entropy._multiple_url_fetcher(url_path_list,
|
||||
resume = resume, abort_check_func = fetch_abort_function,
|
||||
url_fetcher_class = self._entropy.urlFetcher,
|
||||
url_fetcher_class = self._entropy._url_fetcher,
|
||||
checksum = checksum)
|
||||
try:
|
||||
data = fetch_intf.download()
|
||||
@@ -627,9 +627,9 @@ class Package:
|
||||
return [], 0.0, False
|
||||
|
||||
fetch_abort_function = self.pkgmeta.get('fetch_abort_function')
|
||||
fetch_intf = self._entropy.MultipleUrlFetcher(url_path_list,
|
||||
fetch_intf = self._entropy._multiple_url_fetcher(url_path_list,
|
||||
resume = resume, abort_check_func = fetch_abort_function,
|
||||
url_fetcher_class = self._entropy.urlFetcher)
|
||||
url_fetcher_class = self._entropy._url_fetcher)
|
||||
try:
|
||||
data = fetch_intf.download()
|
||||
except KeyboardInterrupt:
|
||||
@@ -724,7 +724,7 @@ class Package:
|
||||
|
||||
for delta_url, delta_save in download_plan:
|
||||
|
||||
delta_fetcher = self._entropy.urlFetcher(delta_url,
|
||||
delta_fetcher = self._entropy._url_fetcher(delta_url,
|
||||
delta_save, resume = delta_resume,
|
||||
abort_check_func = fetch_abort_function)
|
||||
|
||||
@@ -802,12 +802,12 @@ class Package:
|
||||
if os.path.isfile(save_path) and os.path.exists(save_path):
|
||||
existed_before = True
|
||||
|
||||
fetch_intf = self._entropy.urlFetcher(url, save_path, resume = resume,
|
||||
fetch_intf = self._entropy._url_fetcher(url, save_path, resume = resume,
|
||||
abort_check_func = fetch_abort_function)
|
||||
if (download is not None) and (package_id is not None) and \
|
||||
(repository is not None):
|
||||
fetch_path = self.__get_fetch_disk_path(download)
|
||||
self._setup_differential_download(self._entropy.urlFetcher, url,
|
||||
self._setup_differential_download(self._entropy._url_fetcher, url,
|
||||
resume, fetch_path, repository, package_id)
|
||||
|
||||
# start to download
|
||||
|
||||
@@ -673,7 +673,7 @@ class Cache:
|
||||
raise PermissionDenied("PermissionDenied: %s %s" % (
|
||||
_("Cannot remove cache file"), cache_file,))
|
||||
|
||||
fetcher = self.Service.Entropy.urlFetcher(doc_url, cache_file,
|
||||
fetcher = self.Service.Entropy._url_fetcher(doc_url, cache_file,
|
||||
resume = False)
|
||||
rc = fetcher.download()
|
||||
if rc in ("-1", "-2", "-3", "-4"):
|
||||
|
||||
@@ -246,7 +246,7 @@ class System:
|
||||
@return: download status (True if download succeeded)
|
||||
@rtype: bool
|
||||
"""
|
||||
fetcher = self._entropy.urlFetcher(url, save_to, resume = False,
|
||||
fetcher = self._entropy._url_fetcher(url, save_to, resume = False,
|
||||
show_speed = show_speed)
|
||||
rc_fetch = fetcher.download()
|
||||
del fetcher
|
||||
|
||||
@@ -309,7 +309,6 @@ class Equo(Client):
|
||||
self.progress = None
|
||||
self.progress_log = None
|
||||
self.std_output = None
|
||||
self.urlFetcher = None
|
||||
Client.init_singleton(self, *args, **kwargs)
|
||||
self._progress_divider = 1
|
||||
self.xcache = True # force xcache enabling
|
||||
@@ -323,7 +322,7 @@ class Equo(Client):
|
||||
def connect_to_gui(self, application):
|
||||
self.progress = application.progress
|
||||
GuiUrlFetcher.progress = application.progress
|
||||
self.urlFetcher = GuiUrlFetcher
|
||||
self._url_fetcher = GuiUrlFetcher
|
||||
self.progress_log = application.progress_log_write
|
||||
self.std_output = application.std_output
|
||||
self.ui = application.ui
|
||||
|
||||
Reference in New Issue
Block a user