From 0fafa52dbc4fc908c88b61c0d28fe60c3bf6ef89 Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Sun, 14 Mar 2010 15:54:41 +0100 Subject: [PATCH] [entropy.client] more refactoring work in entropy.client.interfaces.methods --- client/text_rescue.py | 2 +- .../entropy/client/interfaces/methods.py | 11 +- .../entropy/client/interfaces/package.py | 2 +- .../entropy/client/interfaces/repository.py | 8 +- libraries/entropy/security.py | 100 +++++++------- .../entropy/server/interfaces/mirrors.py | 2 +- libraries/tests/client.py | 4 +- services/client-updates-daemon | 2 +- sulfur/src/repo-manager-client.py | 12 +- sulfur/src/sulfur/__init__.py | 124 +++++++++--------- sulfur/src/sulfur/dialogs.py | 23 ++-- sulfur/src/sulfur/entropyapi.py | 4 +- sulfur/src/sulfur/events.py | 106 +++++++-------- sulfur/src/sulfur/views.py | 66 +++++----- 14 files changed, 233 insertions(+), 233 deletions(-) diff --git a/client/text_rescue.py b/client/text_rescue.py index 73347b07c..580330588 100644 --- a/client/text_rescue.py +++ b/client/text_rescue.py @@ -475,7 +475,7 @@ def _database_spmsync(entropy_client): if rc == _("No"): return 0 - acquired = entropy_client.resources_create_lock() + acquired = entropy_client.lock_resources() if not acquired: print_info(red(" %s." % (_("Entropy locked during lock acquire"),))) return 2 diff --git a/libraries/entropy/client/interfaces/methods.py b/libraries/entropy/client/interfaces/methods.py index 1e80abfed..ce67017af 100644 --- a/libraries/entropy/client/interfaces/methods.py +++ b/libraries/entropy/client/interfaces/methods.py @@ -1069,15 +1069,14 @@ class MiscMixin: RESOURCES_LOCK_F_REF = None RESOURCES_LOCK_F_COUNT = 0 - def reload_constants(self): + def _reload_constants(self): initconfig_entropy_constants(etpSys['rootdir']) self.SystemSettings.clear() - def setup_default_file_perms(self, filepath): - # setup file permissions - const_setup_file(filepath, etpConst['entropygid'], 0o664) + def setup_file_permissions(self, file_path): + const_setup_file(file_path, etpConst['entropygid'], 0o664) - def resources_create_lock(self): + def lock_resources(self): acquired = self.create_pid_file_lock( etpConst['locks']['using_resources']) if acquired: @@ -1247,7 +1246,7 @@ class MiscMixin: if chroot.endswith("/"): chroot = chroot[:-1] etpSys['rootdir'] = chroot - self.reload_constants() + self._reload_constants() self._validate_repositories() self.reopen_installed_repository() # keep them closed, since SystemSettings.clear() is called diff --git a/libraries/entropy/client/interfaces/package.py b/libraries/entropy/client/interfaces/package.py index 7ebbdb8bb..13a0f34dd 100644 --- a/libraries/entropy/client/interfaces/package.py +++ b/libraries/entropy/client/interfaces/package.py @@ -2919,7 +2919,7 @@ class Package: return 21 # lock - acquired = self._entropy.resources_create_lock() + acquired = self._entropy.lock_resources() if not acquired: self._entropy.output( blue(_("Cannot acquire Entropy resources lock.")), diff --git a/libraries/entropy/client/interfaces/repository.py b/libraries/entropy/client/interfaces/repository.py index d66623abf..83a4d7f9c 100644 --- a/libraries/entropy/client/interfaces/repository.py +++ b/libraries/entropy/client/interfaces/repository.py @@ -344,7 +344,7 @@ class Repository: raise AttributeError(mytxt) if rc == 0: - self._entropy.setup_default_file_perms(path) + self._entropy.setup_file_permissions(path) return rc @@ -482,7 +482,7 @@ class Repository: del fetchConn if rc in ("-1", "-2", "-3", "-4"): return False - self._entropy.setup_default_file_perms(filepath) + self._entropy.setup_file_permissions(filepath) return True def _check_downloaded_database(self, repo, cmethod): @@ -1458,7 +1458,7 @@ class Repository: continue if os.path.isfile(dbfile) and os.access(dbfile, os.W_OK): - self._entropy.setup_default_file_perms(dbfile) + self._entropy.setup_file_permissions(dbfile) # database has been updated self.updated = True @@ -2074,7 +2074,7 @@ class Repository: return 4 # lock - acquired = self._entropy.resources_create_lock() + acquired = self._entropy.lock_resources() if not acquired: return 4 # app locked during lock acquire try: diff --git a/libraries/entropy/security.py b/libraries/entropy/security.py index 408eb7ce8..cf4375071 100644 --- a/libraries/entropy/security.py +++ b/libraries/entropy/security.py @@ -94,7 +94,7 @@ class System: raise AttributeError( "entropy.client.interfaces.Client instance expected") - self.Entropy = entropy_client_instance + self._entropy = entropy_client_instance self.__cacher = EntropyCacher() self._settings = SystemSettings() @@ -247,19 +247,19 @@ class System: @return: download status (True if download succeeded) @rtype: bool """ - fetcher = self.Entropy.urlFetcher(url, save_to, resume = False, + fetcher = self._entropy.urlFetcher(url, save_to, resume = False, show_speed = show_speed) rc_fetch = fetcher.download() del fetcher if rc_fetch in ("-1", "-2", "-3", "-4"): return False # setup permissions - self.Entropy.setup_default_file_perms(save_to) + self._entropy.setup_file_permissions(save_to) return True def __load_gpg(self): try: - repo_sec = self.Entropy.RepositorySecurity( + repo_sec = self._entropy.RepositorySecurity( keystore_dir = self.__gpg_keystore_dir) except Repository.GPGError: return None # GPG not available @@ -275,7 +275,7 @@ class System: def do_warn_user(fingerprint): mytxt = purple(_("Make sure to verify the imported key and set an appropriate trust level")) - self.Entropy.output( + self._entropy.output( mytxt + ":", type = "warning", header = red(" # ") @@ -283,7 +283,7 @@ class System: mytxt = brown("gpg --homedir '%s' --edit-key '%s'" % ( self.__gpg_keystore_dir, fingerprint,) ) - self.Entropy.output( + self._entropy.output( "$ " + mytxt, type = "warning", header = red(" # ") @@ -294,7 +294,7 @@ class System: if pk_avail: tmp_dir = tempfile.mkdtemp() - repo_tmp_sec = self.Entropy.RepositorySecurity( + repo_tmp_sec = self._entropy.RepositorySecurity( keystore_dir = tmp_dir) # try to install and get fingerprint try: @@ -313,7 +313,7 @@ class System: purple(_("GPG key changed for")), bold(easy_url), ) - self.Entropy.output( + self._entropy.output( mytxt, type = "warning", header = red(" # ") @@ -322,7 +322,7 @@ class System: darkgreen(fingerprint), purple(downloaded_key_fp), ) - self.Entropy.output( + self._entropy.output( mytxt, type = "warning", header = red(" # ") @@ -332,7 +332,7 @@ class System: purple(_("GPG key already installed for")), bold(easy_url), ) - self.Entropy.output( + self._entropy.output( mytxt, type = "info", header = red(" # ") @@ -345,7 +345,7 @@ class System: purple(_("GPG key EXPIRED for URL")), bold(easy_url), ) - self.Entropy.output( + self._entropy.output( mytxt, type = "warning", header = red(" # ") @@ -356,7 +356,7 @@ class System: purple(_("Installing GPG key for URL")), brown(easy_url), ) - self.Entropy.output( + self._entropy.output( mytxt, type = "info", header = red(" # "), @@ -370,7 +370,7 @@ class System: darkred(_("Error during GPG key installation")), err, ) - self.Entropy.output( + self._entropy.output( mytxt, type = "error", header = red(" # ") @@ -381,7 +381,7 @@ class System: purple(_("Successfully installed GPG key for URL")), brown(easy_url), ) - self.Entropy.output( + self._entropy.output( mytxt, type = "info", header = red(" # ") @@ -390,7 +390,7 @@ class System: darkgreen(_("Fingerprint")), bold(fingerprint), ) - self.Entropy.output( + self._entropy.output( mytxt, type = "info", header = red(" # ") @@ -415,7 +415,7 @@ class System: purple(_("Error during GPG verification of")), os.path.basename(self.download_package), ) - self.Entropy.output( + self._entropy.output( mytxt, type = "error", header = red(" # ") + bold(" !!! ") @@ -424,7 +424,7 @@ class System: purple(_("It could mean a potential security risk")), err_msg, ) - self.Entropy.output( + self._entropy.output( mytxt, type = "error", header = red(" # ") + bold(" !!! ") @@ -435,7 +435,7 @@ class System: bold(_("Security Advisories")), purple(_("GPG key verification successful")), ) - self.Entropy.output( + self._entropy.output( mytxt, type = "info", header = red(" # ") @@ -520,9 +520,9 @@ class System: """ Validate cache by looking at some checksum data """ - inst_pkgs_cksum = self.Entropy.installed_repository().checksum( + inst_pkgs_cksum = self._entropy.installed_repository().checksum( do_order = True, strict = False, strings = True) - repo_cksum = self.Entropy._all_repositories_checksum() + repo_cksum = self._entropy._all_repositories_checksum() sys_hash = str(hash(repo_cksum + inst_pkgs_cksum)) cached = self.__cacher.pop(sys_hash, cache_dir = System._CACHE_DIR) @@ -618,7 +618,7 @@ class System: count += 1 if not etpUi['quiet']: - self.Entropy.output(":: " + \ + self._entropy.output(":: " + \ str(round((float(count)/maxlen)*100, 1)) + "% ::", importance = 0, type = "info", back = True) @@ -643,7 +643,7 @@ class System: blue(_("advisory broken")), more_info, ) - self.Entropy.output( + self._entropy.output( mytxt, importance = 1, type = "warning", @@ -678,7 +678,7 @@ class System: valid = False skipping_keys = set() for a_key in affected_keys: - match = self.Entropy.atom_match(a_key) + match = self._entropy.atom_match(a_key) if match[0] != -1: # it's in the repos, it's valid valid = True @@ -731,13 +731,13 @@ class System: if not vul_atoms: return False for atom in unaff_atoms: - matches = self.Entropy.installed_repository().atomMatch(atom, + matches = self._entropy.installed_repository().atomMatch(atom, multiMatch = True) for idpackage in matches[0]: unaffected_atoms.add((idpackage, 0)) for atom in vul_atoms: - match = self.Entropy.installed_repository().atomMatch(atom) + match = self._entropy.installed_repository().atomMatch(atom) if (match[0] != -1) and (match not in unaffected_atoms): self.affected_atoms.add(atom) return True @@ -991,7 +991,7 @@ class System: bold(_("Security Advisories")), blue(_("testing service connection")), ) - self.Entropy.output( + self._entropy.output( mytxt, importance = 2, type = "info", @@ -1004,24 +1004,24 @@ class System: blue(_("getting latest advisories")), red("..."), ) - self.Entropy.output( + self._entropy.output( mytxt, importance = 2, type = "info", header = red(" @@ ") ) - gave_up = self.Entropy.lock_check( - self.Entropy.resources_check_lock) + gave_up = self._entropy.lock_check( + self._entropy.resources_check_lock) if gave_up: return 7 - locked = self.Entropy.application_lock_check() + locked = self._entropy.application_lock_check() if locked: return 4 # lock - acquired = self.Entropy.resources_create_lock() + acquired = self._entropy.lock_resources() if not acquired: return 4 # app locked during lock acquire @@ -1030,7 +1030,7 @@ class System: if rc_lock != 0: return rc_lock finally: - self.Entropy.resources_remove_lock() + self._entropy.resources_remove_lock() if self.advisories_changed: advtext = "%s: %s" % ( @@ -1045,7 +1045,7 @@ class System: darkgreen(_("already up to date")), ) - self.Entropy.output( + self._entropy.output( advtext, importance = 2, type = "info", @@ -1065,13 +1065,13 @@ class System: bold(_("Security Advisories")), darkred(_("cannot download checksum, sorry")), ) - self.Entropy.output( + self._entropy.output( mytxt, importance = 2, type = "error", header = red(" ## ") ) - self.Entropy.resources_remove_lock() + self._entropy.resources_remove_lock() return 2 # check if we need to go further @@ -1089,13 +1089,13 @@ class System: bold(_("Security Advisories")), darkred(_("unable to download advisories, sorry")), ) - self.Entropy.output( + self._entropy.output( mytxt, importance = 2, type = "error", header = red(" ## ") ) - self.Entropy.resources_remove_lock() + self._entropy.resources_remove_lock() return 1 mytxt = "%s: %s %s" % ( @@ -1103,7 +1103,7 @@ class System: blue(_("Verifying checksum")), red("..."), ) - self.Entropy.output( + self._entropy.output( mytxt, importance = 1, type = "info", @@ -1119,46 +1119,46 @@ class System: bold(_("Security Advisories")), darkred(_("cannot open packages, sorry")), ) - self.Entropy.output( + self._entropy.output( mytxt, importance = 2, type = "error", header = red(" ## ") ) - self.Entropy.resources_remove_lock() + self._entropy.resources_remove_lock() return 3 elif status == 2: mytxt = "%s: %s." % ( bold(_("Security Advisories")), darkred(_("cannot read the checksum, sorry")), ) - self.Entropy.output( + self._entropy.output( mytxt, importance = 2, type = "error", header = red(" ## ") ) - self.Entropy.resources_remove_lock() + self._entropy.resources_remove_lock() return 4 elif status == 3: mytxt = "%s: %s." % ( bold(_("Security Advisories")), darkred(_("digest verification failed, sorry")), ) - self.Entropy.output( + self._entropy.output( mytxt, importance = 2, type = "error", header = red(" ## ") ) - self.Entropy.resources_remove_lock() + self._entropy.resources_remove_lock() return 5 elif status == 0: mytxt = "%s: %s." % ( bold(_("Security Advisories")), darkgreen(_("verification successful")), ) - self.Entropy.output( + self._entropy.output( mytxt, importance = 1, type = "info", @@ -1179,7 +1179,7 @@ class System: bold(_("Security Advisories")), purple(_("GPG service not available")), ) - self.Entropy.output( + self._entropy.output( mytxt, type = "info", header = red(" # ") @@ -1195,7 +1195,7 @@ class System: except OSError: shutil.copy2(self.download_package_checksum, self.old_download_package_checksum) - self.Entropy.setup_default_file_perms( + self._entropy.setup_file_permissions( self.old_download_package_checksum) # now unpack in place @@ -1205,13 +1205,13 @@ class System: bold(_("Security Advisories")), darkred(_("digest verification failed, try again later")), ) - self.Entropy.output( + self._entropy.output( mytxt, importance = 2, type = "error", header = red(" ## ") ) - self.Entropy.resources_remove_lock() + self._entropy.resources_remove_lock() return 6 mytxt = "%s: %s %s" % ( @@ -1219,7 +1219,7 @@ class System: blue(_("installing")), red("..."), ) - self.Entropy.output( + self._entropy.output( mytxt, importance = 1, type = "info", diff --git a/libraries/entropy/server/interfaces/mirrors.py b/libraries/entropy/server/interfaces/mirrors.py index dbaec49b8..135e935c9 100644 --- a/libraries/entropy/server/interfaces/mirrors.py +++ b/libraries/entropy/server/interfaces/mirrors.py @@ -2001,7 +2001,7 @@ class Server(ServerNoticeBoardMixin): fromfile = os.path.join(mytmpdir, myfile) tofile = os.path.join(database_dir_path, myfile) shutil.move(fromfile, tofile) - self._entropy.setup_default_file_perms(tofile) + self._entropy.setup_file_permissions(tofile) if os.path.isdir(mytmpdir): shutil.rmtree(mytmpdir) diff --git a/libraries/tests/client.py b/libraries/tests/client.py index 323ab9736..0d98a3ba0 100644 --- a/libraries/tests/client.py +++ b/libraries/tests/client.py @@ -57,12 +57,12 @@ class EntropyRepositoryTest(unittest.TestCase): const_val = set([1, 2, 3]) etpConst[const_key] = const_val self.Client.backup_constant(const_key) - self.Client.reload_constants() + self.Client._reload_constants() self.assertEqual(True, const_key in etpConst) self.assertEqual(const_val, etpConst.get(const_key)) # now remove etpConst['backed_up'].pop(const_key) - self.Client.reload_constants() + self.Client._reload_constants() self.assertEqual(False, const_key in etpConst) self.assertEqual(None, etpConst.get(const_key)) diff --git a/services/client-updates-daemon b/services/client-updates-daemon index cb13063c4..5f55961ff 100644 --- a/services/client-updates-daemon +++ b/services/client-updates-daemon @@ -354,7 +354,7 @@ class UpdatesDaemon(dbus.service.Object): return rc_fetch # acquire resources lock - acquired = entropy.resources_create_lock() + acquired = entropy.lock_resources() if not acquired: if DAEMON_DEBUG: write_output("__run_fetcher: resources locked during acquire") diff --git a/sulfur/src/repo-manager-client.py b/sulfur/src/repo-manager-client.py index 00206e878..285deac42 100644 --- a/sulfur/src/repo-manager-client.py +++ b/sulfur/src/repo-manager-client.py @@ -23,7 +23,6 @@ sys.path.insert(0, "../../client") sys.path.insert(0, "sulfur") sys.path.insert(0, "repoman") -from sulfur.entropyapi import Equo # Sulfur Imports import gtk, gobject from sulfur.setup import const @@ -45,22 +44,22 @@ class MyRepositoryManager(RepositoryManagerMenu): class ManagerApplication: def __init__(self): - self.Equo = Equo() + self._entropy = Equo() self.ui = None self.progress_log_write = sys.stdout self.std_output = sys.stdout self.progress = None - self.Equo.connect_to_gui(self) + self._entropy.connect_to_gui(self) def init(self): - mymenu = MyRepositoryManager(self.Equo, None) + mymenu = MyRepositoryManager(self._entropy, None) rc_status = mymenu.load() if not rc_status: del mymenu raise SystemExit(1) def destroy(self): - self.Equo.destroy() + self._entropy.destroy() def dummy_func(self, *args, **kwargs): pass @@ -79,7 +78,8 @@ if __name__ == "__main__": gtk.gdk.threads_enter() gtk.main() gtk.gdk.threads_leave() - Equo.destroy() + from sulfur.entropyapi import Equo + Equo().destroy() except SystemExit: print("Quit by User") main_app.destroy() diff --git a/sulfur/src/sulfur/__init__.py b/sulfur/src/sulfur/__init__.py index 4452bf003..31b3d0385 100644 --- a/sulfur/src/sulfur/__init__.py +++ b/sulfur/src/sulfur/__init__.py @@ -65,14 +65,14 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): def __init__(self): - self.Equo = Equo() + self._entropy = Equo() self._cacher = EntropyCacher() self._settings = SystemSettings() self.do_debug = False self._ugc_status = "--nougc" not in sys.argv self._RESOURCES_LOCKED = False - locked = self.Equo.application_lock_check(silent = True) + locked = self._entropy.application_lock_check(silent = True) is_root = os.getuid() == 0 if locked or (not is_root): self._RESOURCES_LOCKED = True @@ -81,8 +81,8 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): _("Another Entropy instance is running. You won't be able to install/remove/sync applications.") ) self.safe_mode_txt = '' # check if we'are running in safe mode - if self.Equo.safe_mode: - reason = etpConst['safemodereasons'].get(self.Equo.safe_mode) + if self._entropy.safe_mode: + reason = etpConst['safemodereasons'].get(self._entropy.safe_mode) okDialog( None, "%s: %s. %s" % ( _("Entropy is running in safe mode"), reason, _("Please fix as soon as possible"),) @@ -90,7 +90,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): self.safe_mode_txt = _("Safe Mode") self.isBusy = False - self.etpbase = EntropyPackages(self.Equo) + self.etpbase = EntropyPackages(self._entropy) # Create and ui object contains the widgets. ui = UI( const.GLADE_FILE, 'main', 'entropy' ) @@ -118,7 +118,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): if not pkg_installing: if "--nonoticeboard" not in sys.argv: - if not self.Equo.are_noticeboards_marked_as_read(): + if not self._entropy.are_noticeboards_marked_as_read(): self.show_notice_board(force = False) else: self.show_sulfur_tips() @@ -133,8 +133,8 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): for pid in FORK_PIDS: do_kill(pid) - if hasattr(self, 'Equo'): - self.Equo.destroy() + if hasattr(self, '_entropy'): + self._entropy.destroy() if sysexit != -1: self.exit_now() @@ -175,7 +175,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): self.filesView = EntropyFilesView(self.ui.filesView, self.ui.systemVbox) self.advisoriesView = EntropyAdvisoriesView(self.ui.advisoriesView, self.ui, self.etpbase) - self.queue.connect_objects(self.Equo, self.etpbase, self.pkgView, self.ui) + self.queue.connect_objects(self._entropy, self.etpbase, self.pkgView, self.ui) self.repoView = EntropyRepoView(self.ui.viewRepo, self.ui, self) # Left Side Toolbar self._notebook_tabs_cache = {} @@ -278,7 +278,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): self.abortQueueNow = False self._is_working = False self.lastPkgPB = "updates" - self.Equo.connect_to_gui(self) + self._entropy.connect_to_gui(self) self.setup_editor() self.switch_notebook_page("packages") @@ -349,7 +349,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): # configuration files update cache generation def file_updates_cache_gen(): - self.Equo.FileUpdates.scan(quiet = True) + self._entropy.FileUpdates.scan(quiet = True) self._cacher.sync() return False @@ -586,10 +586,10 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): def warn_repositories(self): all_repos = self._settings['repositories']['order'] - valid_repos = self.Equo.repositories() + valid_repos = self._entropy.repositories() invalid_repos = [x for x in all_repos if x not in valid_repos] invalid_repos = [x for x in invalid_repos if \ - (self.Equo.get_repository_revision(x) == -1)] + (self._entropy.get_repository_revision(x) == -1)] if invalid_repos: mydialog = ConfirmationDialog(self.ui.main, invalid_repos, top_text = _("The repositories listed below are configured but not available. They should be downloaded."), @@ -618,7 +618,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): # parse atoms matches = [] for atom in atoms: - pkg_id, repo_id = self.Equo.atom_match(atom) + pkg_id, repo_id = self._entropy.atom_match(atom) if pkg_id == -1: return False matches.append((pkg_id, repo_id,)) @@ -795,7 +795,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): if self.do_debug: print_generic("entering UGC") - if self.Equo.UGC is None: + if self._entropy.UGC is None: return if self._spawning_ugc or self.disable_ugc: @@ -803,14 +803,14 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): if not force: eapi3_repos = [] - for repoid in self.Equo.repositories(): - aware = self.Equo.UGC.is_repository_eapi3_aware(repoid) + for repoid in self._entropy.repositories(): + aware = self._entropy.UGC.is_repository_eapi3_aware(repoid) if aware: eapi3_repos.append(repoid) cache_available = True for repoid in eapi3_repos: - if not self.Equo.is_ugc_cached(repoid): + if not self._entropy.is_ugc_cached(repoid): cache_available = False pingus_id = "sulfur_ugc_content_spawn" @@ -846,11 +846,11 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): def _ugc_update(self): - for repo in self.Equo.repositories(): + for repo in self._entropy.repositories(): if self.do_debug: t1 = time.time() print_generic("working UGC update for", repo) - self.Equo.update_ugc_cache(repo) + self._entropy.update_ugc_cache(repo) if self.do_debug: t2 = time.time() td = t2 - t1 @@ -858,7 +858,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): def fill_pref_db_backup_page(self): self.dbBackupStore.clear() - backed_up_dbs = self.Equo.installed_repository_backups() + backed_up_dbs = self._entropy.installed_repository_backups() for mypath in backed_up_dbs: mymtime = os.path.getmtime(mypath) mytime = entropy.tools.convert_unix_time_to_human_time(mymtime) @@ -929,19 +929,19 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): obj = model.get_value( myiter, 0 ) if obj: t = "%s" % (_("Not logged in"),) - if self.Equo.UGC != None: - logged_data = self.Equo.UGC.read_login(obj['repoid']) + if self._entropy.UGC != None: + logged_data = self._entropy.UGC.read_login(obj['repoid']) if logged_data != None: t = "%s" % (logged_data[0],) cell.set_property('markup', t) def get_ugc_status_pix( column, cell, model, myiter ): - if self.Equo.UGC == None: + if self._entropy.UGC == None: cell.set_property( 'icon-name', 'gtk-cancel' ) return obj = model.get_value( myiter, 0 ) if obj: - if self.Equo.UGC.is_repository_eapi3_aware(obj['repoid']): + if self._entropy.UGC.is_repository_eapi3_aware(obj['repoid']): cell.set_property( 'icon-name', 'gtk-apply' ) else: cell.set_property( 'icon-name', 'gtk-cancel' ) @@ -1260,7 +1260,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): break def clean_entropy_caches(self): - self.Equo.clear_cache() + self._entropy.clear_cache() # clear views self.etpbase.clear_groups() self.etpbase.clear_cache() @@ -1285,7 +1285,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): cached = {} if cached: - self.advisoriesView.populate(self.Equo.Security(), cached, show, + self.advisoriesView.populate(self._entropy.Security(), cached, show, use_cache = meta_cached) if widget is not None: @@ -1293,7 +1293,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): def _populate_files_update(self): # load filesUpdate interface and fill self.filesView - cached = self.Equo.FileUpdates.scan(quiet = True) + cached = self._entropy.FileUpdates.scan(quiet = True) if cached: self.filesView.populate(cached) @@ -1304,8 +1304,8 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): def show_notice_board(self, force = True): repoids = {} - for repoid in self.Equo.repositories(): - if self.Equo.is_noticeboard_marked_as_read(repoid) and not force: + for repoid in self._entropy.repositories(): + if self._entropy.is_noticeboard_marked_as_read(repoid) and not force: continue avail_repos = self._settings['repositories']['available'] board_file = avail_repos[repoid]['local_notice_board'] @@ -1321,7 +1321,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): self.show_sulfur_tips() def load_notice_board(self, repoids): - my = NoticeBoardWindow(self.ui.main, self.Equo) + my = NoticeBoardWindow(self.ui.main, self._entropy) my.load(repoids) def update_repositories(self, repos): @@ -1332,7 +1332,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): force = self.ui.forceRepoUpdate.get_active() try: - repoConn = self.Equo.Repositories(repos, force = force) + repoConn = self._entropy.Repositories(repos, force = force) except AttributeError: msg = "%s: %s" % (_('No repositories specified in'), etpConst['repositoriesconf'],) @@ -1374,9 +1374,9 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): for repo in repos: # inform UGC that we are syncing this repo - if self.Equo.UGC is not None: + if self._entropy.UGC is not None: try: - self.Equo.UGC.add_download_stats(repo, [repo]) + self._entropy.UGC.add_download_stats(repo, [repo]) except TimeoutError: continue @@ -1445,7 +1445,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): self.__deptest_deps_not_matched = None def run_up(): - self.__deptest_deps_not_matched = self.Equo.dependencies_test() + self.__deptest_deps_not_matched = self._entropy.dependencies_test() t = ParallelTask(run_up) t.start() @@ -1462,11 +1462,11 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): self.switch_notebook_page('preferences') return - c_repo = self.Equo.installed_repository() + c_repo = self._entropy.installed_repository() found_matches = set() not_all = False for dep in deps_not_matched: - match = self.Equo.atom_match(dep) + match = self._entropy.atom_match(dep) if match[0] != -1: found_matches.add(match) continue @@ -1479,10 +1479,10 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): for c_idpackage in c_idpackages: key, slot = c_repo.retrieveKeySlot( c_idpackage) - match = self.Equo.atom_match(key, match_slot = slot) + match = self._entropy.atom_match(key, match_slot = slot) cmpstat = 0 if match[0] != -1: - cmpstat = self.Equo.get_package_action(match) + cmpstat = self._entropy.get_package_action(match) if cmpstat != 0: found_matches.add(match) continue @@ -1544,11 +1544,11 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): packages_matched, broken_execs = {}, set() self.__libtest_abort = False - QA = self.Equo.QA() + QA = self._entropy.QA() def run_up(): try: - x, y, z = QA.test_shared_objects(self.Equo.installed_repository(), + x, y, z = QA.test_shared_objects(self._entropy.installed_repository(), task_bombing_func = task_bombing) packages_matched.update(x) broken_execs.update(y) @@ -1788,7 +1788,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): if not matches: # resolve atoms ? for atom in atoms: - match = self.Equo.atom_match(atom) + match = self._entropy.atom_match(atom) if match[0] != -1: matches.add(match) if not matches: @@ -1831,7 +1831,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): # 2-3 more cycles than having unattended # behaviours self._settings.clear() - self.Equo.close_repositories() + self._entropy.close_repositories() def hide_notebook_tabs_for_install(self): self.ui.securityVbox.hide() @@ -1857,12 +1857,12 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): def do_name_search(keyword): keyword = const_convert_to_unicode(keyword) matches = [] - for repoid in self.Equo.repositories(): - dbconn = self.Equo.open_repository(repoid) + for repoid in self._entropy.repositories(): + dbconn = self._entropy.open_repository(repoid) results = dbconn.searchPackages(keyword, just_id = True) matches += [(x, repoid) for x in results] # disabled due to duplicated entries annoyance - #results = self.Equo.installed_repository().searchPackages(keyword, + #results = self._entropy.installed_repository().searchPackages(keyword, # just_id = True) #matches += [(x, 0) for x in results] return matches @@ -1870,12 +1870,12 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): def do_name_desc_search(keyword): keyword = const_convert_to_unicode(keyword) matches = [] - for repoid in self.Equo.repositories(): - dbconn = self.Equo.open_repository(repoid) + for repoid in self._entropy.repositories(): + dbconn = self._entropy.open_repository(repoid) results = dbconn.searchDescription(keyword) matches += [(x, repoid) for atom, x in results] # disabled due to duplicated entries annoyance - #results = self.Equo.installed_repository().searchDescription( + #results = self._entropy.installed_repository().searchDescription( # keyword) #matches += [(x, 0) for atom, x in results] return matches @@ -1889,7 +1889,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): ('search_string', _('Search string'), fake_callback, False), ('search_type', ('combo', (_('Search type'), search_types),), fake_callback, False) ] - data = self.Equo.input_box( + data = self._entropy.input_box( _('Entropy Search'), input_params, cancel_button = True @@ -1909,7 +1909,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): entropy_pkg = "sys-apps/entropy" - etp_matches, etp_rc = self.Equo.atom_match(entropy_pkg, + etp_matches, etp_rc = self._entropy.atom_match(entropy_pkg, multi_match = True, multi_repo = True) if etp_rc != 0: return False @@ -1922,7 +1922,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): if not found_match: return False - rc, pkg_match = self.Equo.check_package_update(entropy_pkg, deep = True) + rc, pkg_match = self._entropy.check_package_update(entropy_pkg, deep = True) if rc: return True return False @@ -1932,7 +1932,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): etpConst['system_settings_plugins_ids']['client_plugin'] misc_set = self._settings[sys_set_client_plg_id]['misc'] if misc_set.get('forcedupdates'): - crit_atoms, crit_mtchs = self.Equo.calculate_critical_updates() + crit_atoms, crit_mtchs = self._entropy.calculate_critical_updates() if crit_atoms: crit_objs = [] for crit_match in crit_mtchs: @@ -1994,7 +1994,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): self.show_progress_bars() # preventive check against other instances - locked = self.Equo.application_lock_check() + locked = self._entropy.application_lock_check() if locked or not entropy.tools.is_root(): okDialog(self.ui.main, _("Another Entropy instance is running. Cannot process queue.")) @@ -2004,7 +2004,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): self.disable_ugc = True # acquire Entropy resources here to avoid surpises afterwards - acquired = self.Equo.resources_create_lock() + acquired = self._entropy.lock_resources() if not acquired: okDialog(self.ui.main, _("Another Entropy instance is locking this task at the moment. Try in a few minutes.")) @@ -2022,8 +2022,8 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): total += len(pkgs[key]) def do_file_updates_check(): - self.Equo.FileUpdates.scan(dcache = False, quiet = True) - fs_data = self.Equo.FileUpdates.scan() + self._entropy.FileUpdates.scan(dcache = False, quiet = True) + fs_data = self._entropy.FileUpdates.scan() if fs_data: if len(fs_data) > 0: switch_back_page = 'filesconf' @@ -2149,7 +2149,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): _("Attention. You have updated Entropy." "\nSulfur will be reloaded.") ) - self.Equo.resources_remove_lock() + self._entropy.resources_remove_lock() self.quit(sysexit = 99) if self.do_debug: @@ -2166,12 +2166,12 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): print_generic("process_queue: cleared caches") for myrepo in remove_repos: - self.Equo.remove_repository(myrepo) + self._entropy.remove_repository(myrepo) self.reset_cache_status() if self.do_debug: print_generic("process_queue: closed repo dbs") - self.Equo.reopen_installed_repository() + self._entropy.reopen_installed_repository() if self.do_debug: print_generic("process_queue: cleared caches (again)") # regenerate packages information @@ -2200,7 +2200,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): rb = self.packageRB["updates"] gobject.timeout_add(0, rb.clicked) - self.Equo.resources_remove_lock() + self._entropy.resources_remove_lock() if state: self.progress.set_mainLabel(_("Tasks completed successfully.")) @@ -2263,7 +2263,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): my.load(item) def load_package_info_menu(self, pkg): - mymenu = PkgInfoMenu(self.Equo, pkg, self.ui.main) + mymenu = PkgInfoMenu(self._entropy, pkg, self.ui.main) load_count = 6 while True: try: diff --git a/sulfur/src/sulfur/dialogs.py b/sulfur/src/sulfur/dialogs.py index a134a8117..e4884d8a6 100644 --- a/sulfur/src/sulfur/dialogs.py +++ b/sulfur/src/sulfur/dialogs.py @@ -122,7 +122,7 @@ class AddRepositoryWindow(MenuSkel): self.repoMirrorsView = EntropyRepositoryMirrorsView( self.addrepo_ui.mirrorsView) self.addrepo_ui.addRepoWin.set_transient_for(window) - self.Equo = entropy + self._entropy = entropy self.Sulfur = application self.window = window self.addrepo_ui.repoSubmit.show() @@ -173,7 +173,7 @@ class AddRepositoryWindow(MenuSkel): if not repodata['repoid']: errors.append(_('No Repository Identifier')) - if repodata['repoid'] and repodata['repoid'] in self.Equo.SystemSettings['repositories']['available']: + if repodata['repoid'] and repodata['repoid'] in self._entropy.SystemSettings['repositories']['available']: if not edit: errors.append(_('Duplicated Repository Identifier')) @@ -264,10 +264,10 @@ class AddRepositoryWindow(MenuSkel): _("Insert Repository identification string")+" ") if text: if (text.startswith("repository|")) and (len(text.split("|")) == 5): - current_branch = self.Equo.SystemSettings['repositories']['branch'] - current_product = self.Equo.SystemSettings['repositories']['product'] + current_branch = self._entropy.SystemSettings['repositories']['branch'] + current_product = self._entropy.SystemSettings['repositories']['product'] repoid, repodata = \ - self.Equo.SystemSettings._analyze_client_repo_string(text, + self._entropy.SystemSettings._analyze_client_repo_string(text, current_branch, current_product) self._load_repo_data(repodata) else: @@ -283,7 +283,7 @@ class AddRepositoryWindow(MenuSkel): # validate errors = self._validate_repo_submit(repodata) if not errors: - self.Equo.add_repository(repodata) + self._entropy.add_repository(repodata) self.Sulfur.reset_cache_status() self.Sulfur.setup_repoView() self.addrepo_ui.addRepoWin.hide() @@ -300,12 +300,12 @@ class AddRepositoryWindow(MenuSkel): return True else: disable = False - repo_excluded = self.Equo.SystemSettings['repositories']['excluded'] + repo_excluded = self._entropy.SystemSettings['repositories']['excluded'] if repodata['repoid'] in repo_excluded: disable = True - self.Equo.remove_repository(repodata['repoid'], disable = disable) + self._entropy.remove_repository(repodata['repoid'], disable = disable) if not disable: - self.Equo.add_repository(repodata) + self._entropy.add_repository(repodata) self.Sulfur.reset_cache_status() self.Sulfur.setup_repoView() @@ -371,7 +371,10 @@ class NoticeBoardWindow(MenuSkel): obj = model.get_value(iterator, 0) if obj: if 'is_repo' in obj: - cell.set_property('markup', "%s\n%s" % (cleanMarkupString(obj['name']), cleanMarkupString(obj['desc']),)) + cell.set_property('markup', + "%s\n%s" % ( + cleanMarkupString(obj['name']), + cleanMarkupString(obj['desc']),)) else: mytxt = '%s\n%s: %s' % ( cleanMarkupString(obj['pubDate']), diff --git a/sulfur/src/sulfur/entropyapi.py b/sulfur/src/sulfur/entropyapi.py index cd78eab5d..916649f35 100644 --- a/sulfur/src/sulfur/entropyapi.py +++ b/sulfur/src/sulfur/entropyapi.py @@ -40,7 +40,7 @@ class QueueExecutor: def __init__(self, SulfurApplication): self.Sulfur = SulfurApplication - self._entropy = SulfurApplication.Equo + self._entropy = Equo() self.__on_lic_request = False self.__on_lic_rc = None # clear download mirrors status @@ -311,8 +311,6 @@ class Equo(Client): self.progress = application.progress GuiUrlFetcher.progress = application.progress self.urlFetcher = GuiUrlFetcher - # EXPERIMENTALLY enable color - # nocolor() self.progress_log = application.progress_log_write self.std_output = application.std_output self.ui = application.ui diff --git a/sulfur/src/sulfur/events.py b/sulfur/src/sulfur/events.py index 96686a9c5..d984359ad 100644 --- a/sulfur/src/sulfur/events.py +++ b/sulfur/src/sulfur/events.py @@ -52,7 +52,7 @@ class SulfurApplicationEventsMixin: def on_dbBackupButton_clicked(self, widget): self.start_working() - status, err_msg = self.Equo.backup_repository( + status, err_msg = self._entropy.backup_repository( etpConst['etpdatabaseclientfilepath']) self.end_working() if not status: @@ -68,10 +68,10 @@ class SulfurApplicationEventsMixin: if myiter == None: return dbpath = model.get_value(myiter, 0) self.start_working() - status, err_msg = self.Equo.restore_repository(dbpath, + status, err_msg = self._entropy.restore_repository(dbpath, etpConst['etpdatabaseclientfilepath']) self.end_working() - self.Equo.reopen_installed_repository() + self._entropy.reopen_installed_repository() self.reset_cache_status() self.show_packages() if not status: @@ -114,7 +114,7 @@ class SulfurApplicationEventsMixin: def on_updateAdvAll_clicked( self, widget ): - security = self.Equo.Security() + security = self._entropy.Security() adv_data = security.get_advisories_metadata() atoms = set() for key in adv_data: @@ -142,31 +142,31 @@ class SulfurApplicationEventsMixin: identifier, source, dest = self._get_Edit_filename() if not identifier: return True - self.Equo.FileUpdates.remove(identifier) - self.filesView.populate(self.Equo.FileUpdates.scan()) + self._entropy.FileUpdates.remove(identifier) + self.filesView.populate(self._entropy.FileUpdates.scan()) def on_filesMerge_clicked( self, widget ): identifier, source, dest = self._get_Edit_filename() if not identifier: return True - self.Equo.FileUpdates.merge(identifier) - self.filesView.populate(self.Equo.FileUpdates.scan()) + self._entropy.FileUpdates.merge(identifier) + self.filesView.populate(self._entropy.FileUpdates.scan()) def on_mergeFiles_clicked( self, widget ): - self.Equo.FileUpdates.scan(dcache = True) - keys = list(self.Equo.FileUpdates.scan().keys()) + self._entropy.FileUpdates.scan(dcache = True) + keys = list(self._entropy.FileUpdates.scan().keys()) for key in keys: - self.Equo.FileUpdates.merge(key) + self._entropy.FileUpdates.merge(key) # it's cool watching it runtime - self.filesView.populate(self.Equo.FileUpdates.scan()) + self.filesView.populate(self._entropy.FileUpdates.scan()) def on_deleteFiles_clicked( self, widget ): - self.Equo.FileUpdates.scan(dcache = True) - keys = list(self.Equo.FileUpdates.scan().keys()) + self._entropy.FileUpdates.scan(dcache = True) + keys = list(self._entropy.FileUpdates.scan().keys()) for key in keys: - self.Equo.FileUpdates.remove(key) + self._entropy.FileUpdates.remove(key) # it's cool watching it runtime - self.filesView.populate(self.Equo.FileUpdates.scan()) + self.filesView.populate(self._entropy.FileUpdates.scan()) def on_filesEdit_clicked( self, widget ): identifier, source, dest = self._get_Edit_filename() @@ -208,8 +208,8 @@ class SulfurApplicationEventsMixin: TextReadDialog(dest, mybuffer) def on_filesViewRefresh_clicked( self, widget ): - self.Equo.FileUpdates.scan(dcache = False) - self.filesView.populate(self.Equo.FileUpdates.scan()) + self._entropy.FileUpdates.scan(dcache = False) + self.filesView.populate(self._entropy.FileUpdates.scan()) def on_shiftUp_clicked( self, widget ): idx, repoid, iterdata = self._get_selected_repo_index() @@ -217,7 +217,7 @@ class SulfurApplicationEventsMixin: path = iterdata[0].get_path(iterdata[1])[0] if path > 0 and idx > 0: idx -= 1 - self.Equo.shift_repository(repoid, idx) + self._entropy.shift_repository(repoid, idx) # get next iter prev = iterdata[0].get_iter(path-1) self.repoView.store.swap(iterdata[1], prev) @@ -228,11 +228,11 @@ class SulfurApplicationEventsMixin: next = iterdata[0].iter_next(iterdata[1]) if next: idx += 1 - self.Equo.shift_repository(repoid, idx) + self._entropy.shift_repository(repoid, idx) self.repoView.store.swap(iterdata[1], next) def on_addRepo_clicked( self, widget ): - my = AddRepositoryWindow(self, self.ui.main, self.Equo) + my = AddRepositoryWindow(self, self.ui.main, self._entropy) my.load() def on_removeRepo_clicked( self, widget ): @@ -246,7 +246,7 @@ class SulfurApplicationEventsMixin: okDialog( self.ui.main, _("You! Why do you want to remove the main repository ?")) return True - self.Equo.remove_repository(repoid) + self._entropy.remove_repository(repoid) self.reset_cache_status() self.setup_repoView() @@ -261,7 +261,7 @@ class SulfurApplicationEventsMixin: repodata = self._settings['repositories']['excluded'][repoid] return repodata.copy() - my = AddRepositoryWindow(self, self.ui.main, self.Equo) + my = AddRepositoryWindow(self, self.ui.main, self._entropy) my.addrepo_ui.repoSubmit.hide() my.addrepo_ui.repoSubmitEdit.show() my.addrepo_ui.repoInsert.hide() @@ -307,7 +307,7 @@ class SulfurApplicationEventsMixin: # re-read configprotect self.reset_cache_status() self.show_packages() - self.Equo.reload_repositories_config() + self._entropy.reload_repositories_config() self.setup_preferences() def on_preferencesRestoreButton_clicked(self, widget): @@ -407,7 +407,7 @@ class SulfurApplicationEventsMixin: newrepo = os.path.basename(fn) # we have it ! - status, atomsfound = self.Equo.add_package_to_repositories(fn) + status, atomsfound = self._entropy.add_package_to_repositories(fn) if status != 0: errtxt = _("is not a valid Entropy package") if status == -3: @@ -421,9 +421,9 @@ class SulfurApplicationEventsMixin: return def clean_n_quit(newrepo): - self.Equo.remove_repository(newrepo) + self._entropy.remove_repository(newrepo) self.reset_cache_status() - self.Equo.reopen_installed_repository() + self._entropy.reopen_installed_repository() # regenerate packages information self.setup_application() @@ -470,7 +470,7 @@ class SulfurApplicationEventsMixin: def setup_metadata(): self.advisoriesView.populate_loading_message() self.gtk_loop() - security = self.Equo.Security() + security = self._entropy.Security() security.get_advisories_metadata() gobject.timeout_add(0, adv_populate) @@ -587,14 +587,14 @@ class SulfurApplicationEventsMixin: pkgdata = self.queue.get().copy() for key in list(pkgdata.keys()): if pkgdata[key]: pkgdata[key] = [x.matched_atom for x in pkgdata[key]] - self.Equo.dumpTools.dumpobj(fn, pkgdata, True) + self._entropy.dumpTools.dumpobj(fn, pkgdata, True) def on_queueOpen_clicked( self, widget ): fn = FileChooser() if fn: try: - pkgdata = self.Equo.dumpTools.loadobj(fn, complete_path = True) + pkgdata = self._entropy.dumpTools.loadobj(fn, complete_path = True) except: return @@ -674,9 +674,9 @@ class SulfurApplicationEventsMixin: if license_identifier: repoid = self.pkgProperties_selected.matched_atom[1] if isinstance(repoid, int): - dbconn = self.Equo.installed_repository() + dbconn = self._entropy.installed_repository() else: - dbconn = self.Equo.open_repository(repoid) + dbconn = self._entropy.open_repository(repoid) if dbconn.isLicensedataKeyAvailable(license_identifier): license_text = dbconn.retrieveLicenseText(license_identifier) found = True @@ -692,7 +692,7 @@ class SulfurApplicationEventsMixin: normal_cursor(self.ui.main) # now start updating the system if not sts: - rc = self.Equo.ask_question(_("Update your system now ?")) + rc = self._entropy.ask_question(_("Update your system now ?")) if rc == _("Yes"): self.install_queue() @@ -740,7 +740,7 @@ class SulfurApplicationEventsMixin: flt.activate(False) else: flt.activate() - flt.setKeys(txt.split(), self.Equo.get_package_groups()) + flt.setKeys(txt.split(), self._entropy.get_package_groups()) self.pkgView.expand() self.show_packages() @@ -768,46 +768,46 @@ class SulfurApplicationEventsMixin: self.load_color_settings() def on_ugcLoginButton_clicked(self, widget): - if self.Equo.UGC == None: return + if self._entropy.UGC == None: return model, myiter = self.ugcRepositoriesView.get_selection().get_selected() if (myiter == None) or (model == None): return obj = model.get_value( myiter, 0 ) if obj: - #logged_data = self.Equo.UGC.read_login(obj['repoid']) - self.Equo.UGC.login(obj['repoid'], force = True) + #logged_data = self._entropy.UGC.read_login(obj['repoid']) + self._entropy.UGC.login(obj['repoid'], force = True) self.load_ugc_repositories() def on_ugcClearLoginButton_clicked(self, widget): - if self.Equo.UGC == None: return + if self._entropy.UGC == None: return model, myiter = self.ugcRepositoriesView.get_selection().get_selected() if (myiter == None) or (model == None): return obj = model.get_value( myiter, 0 ) if obj: - if not self.Equo.UGC.is_repository_eapi3_aware(obj['repoid']): + if not self._entropy.UGC.is_repository_eapi3_aware(obj['repoid']): return - logged_data = self.Equo.UGC.read_login(obj['repoid']) - if logged_data: self.Equo.UGC.remove_login(obj['repoid']) + logged_data = self._entropy.UGC.read_login(obj['repoid']) + if logged_data: self._entropy.UGC.remove_login(obj['repoid']) self.load_ugc_repositories() def on_ugcClearCacheButton_clicked(self, widget): - if self.Equo.UGC == None: return + if self._entropy.UGC == None: return repo_excluded = self._settings['repositories']['excluded'] avail_repos = self._settings['repositories']['available'] for repoid in list(set(list(avail_repos.keys())+list(repo_excluded.keys()))): - self.Equo.UGC.UGCCache.clear_cache(repoid) + self._entropy.UGC.UGCCache.clear_cache(repoid) self.set_status_ticker("%s: %s ..." % (_("Cleaning UGC cache of"), repoid,)) self.set_status_ticker("%s" % (_("UGC cache cleared"),)) def on_ugcClearCredentialsButton_clicked(self, widget): - if self.Equo.UGC == None: + if self._entropy.UGC == None: return repo_excluded = self._settings['repositories']['excluded'] avail_repos = self._settings['repositories']['available'] for repoid in list(set(list(avail_repos.keys())+list(repo_excluded.keys()))): - if not self.Equo.UGC.is_repository_eapi3_aware(repoid): + if not self._entropy.UGC.is_repository_eapi3_aware(repoid): continue - logged_data = self.Equo.UGC.read_login(repoid) - if logged_data: self.Equo.UGC.remove_login(repoid) + logged_data = self._entropy.UGC.read_login(repoid) + if logged_data: self._entropy.UGC.remove_login(repoid) self.load_ugc_repositories() self.set_status_ticker("%s" % (_("UGC credentials cleared"),)) @@ -819,7 +819,7 @@ class SulfurApplicationEventsMixin: def on_pkgsetAddButton_clicked(self, widget, edit = False): - sets = self.Equo.Sets() + sets = self._entropy.Sets() current_sets = sets.available() def fake_callback(s): @@ -841,10 +841,10 @@ class SulfurApplicationEventsMixin: return False def lv_callback(atom): - c_id, c_rc = self.Equo.installed_repository().atomMatch(atom) + c_id, c_rc = self._entropy.installed_repository().atomMatch(atom) if c_id != -1: return True - c_id, c_rc = self.Equo.atom_match(atom) + c_id, c_rc = self._entropy.atom_match(atom) if c_id != -1: return True return False @@ -876,7 +876,7 @@ class SulfurApplicationEventsMixin: ('atoms', ('list', (_('Package atoms'), [],),), lv_callback, False) ] - data = self.Equo.input_box( + data = self._entropy.input_box( edit_title, input_params, cancel_button = True @@ -901,7 +901,7 @@ class SulfurApplicationEventsMixin: def on_pkgsetRemoveButton_clicked(self, widget): - sets = self.Equo.Sets() + sets = self._entropy.Sets() def mymf(m): set_from, set_name, set_deps = m if set_from == etpConst['userpackagesetsid']: @@ -921,7 +921,7 @@ class SulfurApplicationEventsMixin: fake_callback, False) ] - data = self.Equo.input_box( + data = self._entropy.input_box( _('Choose what Package Set you want to remove'), input_params, cancel_button = True diff --git a/sulfur/src/sulfur/views.py b/sulfur/src/sulfur/views.py index efd801119..e9cf18b06 100644 --- a/sulfur/src/sulfur/views.py +++ b/sulfur/src/sulfur/views.py @@ -476,7 +476,7 @@ class EntropyPackageView: def __init__( self, treeview, queue, ui, etpbase, main_window, application = None ): - self.Equo = Equo() + self._entropy = Equo() self.Sulfur = application self._ugc_status = True if self.Sulfur is not None: @@ -709,7 +709,7 @@ class EntropyPackageView: if not issubclass(injector, EntropyPackageViewModelInjector): raise AttributeError("wrong sorter") self.__current_model_injector_class = injector - self.Injector = injector(self.store, self.Equo, self.etpbase, + self.Injector = injector(self.store, self._entropy, self.etpbase, self.dummyCats) def reset_install_menu(self): @@ -929,7 +929,7 @@ class EntropyPackageView: for obj in objs: if obj.is_group or obj.is_pkgset_cat: continue - mymenu = PkgInfoMenu(self.Equo, obj, self.ui.main) + mymenu = PkgInfoMenu(self._entropy, obj, self.ui.main) mymenu.load() def run_install_menu_stuff(self, objs): @@ -1115,7 +1115,7 @@ class EntropyPackageView: busy_cursor(self.main_window) objs = self.selected_objs oldmask = self.etpbase.unmaskingPackages.copy() - mydialog = MaskedPackagesDialog(self.Equo, self.etpbase, self.ui.main, objs) + mydialog = MaskedPackagesDialog(self._entropy, self.etpbase, self.ui.main, objs) result = mydialog.run() if result != -5: self.etpbase.unmaskingPackages = oldmask.copy() @@ -1255,7 +1255,7 @@ class EntropyPackageView: result = confirmDialog.run() confirmDialog.destroy() if result != -5: return - for obj in objs: self.Equo.mask_match(obj.matched_atom) + for obj in objs: self._entropy.mask_match(obj.matched_atom) # clear cache self.clear() self.etpbase.clear_groups() @@ -1271,7 +1271,7 @@ class EntropyPackageView: def _get_pkgset_data(self, items, add = True, remove_action = False): - sets = self.Equo.Sets() + sets = self._entropy.Sets() pkgsets = set() realpkgs = set() @@ -1316,12 +1316,12 @@ class EntropyPackageView: exp_matches = set() if remove_action: for exp_atom in exp_atoms: - exp_match = self.Equo.installed_repository().atomMatch(exp_atom) + exp_match = self._entropy.installed_repository().atomMatch(exp_atom) if exp_match[0] == -1: continue exp_matches.add(exp_match) else: for exp_atom in exp_atoms: - exp_match = self.Equo.atom_match(exp_atom) + exp_match = self._entropy.atom_match(exp_atom) if exp_match[0] == -1: continue exp_matches.add(exp_match) @@ -1416,10 +1416,10 @@ class EntropyPackageView: repo_objs = [] for idpackage, rid in exp_matches: - key, slot = self.Equo.installed_repository().retrieveKeySlot(idpackage) - if not self.Equo.validate_package_removal(idpackage): + key, slot = self._entropy.installed_repository().retrieveKeySlot(idpackage) + if not self._entropy.validate_package_removal(idpackage): continue - mymatch = self.Equo.atom_match(key, match_slot = slot) + mymatch = self._entropy.atom_match(key, match_slot = slot) if mymatch[0] == -1: continue yp, new = self.etpbase.get_package_item(mymatch) repo_objs.append(yp) @@ -1547,7 +1547,7 @@ class EntropyPackageView: objs = [] for x in self.selected_objs: key, slot = x.keyslot - m = self.Equo.atom_match(key, match_slot = slot) + m = self._entropy.atom_match(key, match_slot = slot) if m[0] != -1: objs.append(x) @@ -1703,7 +1703,7 @@ class EntropyPackageView: key, repoid = self._ugc_dnd_cache_taint.pop() except KeyError: break - self.Equo.UGC.get_docs(repoid, key) + self._entropy.UGC.get_docs(repoid, key) self.__pkg_ugc_icon_cache.clear() self.__pkg_ugc_icon_call_cache.clear() @@ -1751,7 +1751,7 @@ class EntropyPackageView: pkg_key = pkg.key repoid = pkg.repoid_clean # this is an image! - my = UGCAddMenu(self.Equo, pkg_key, repoid, self.ui.main, + my = UGCAddMenu(self._entropy, pkg_key, repoid, self.ui.main, self.__ugc_dnd_updates_clear_cache) self._ugc_dnd_cache_taint.add((pkg_key, repoid,)) my.load() @@ -1774,7 +1774,7 @@ class EntropyPackageView: os.fsync(tmp_fd) os.close(tmp_fd) - my = UGCAddMenu(self.Equo, pkg_key, repoid, self.ui.main, + my = UGCAddMenu(self._entropy, pkg_key, repoid, self.ui.main, self.__ugc_dnd_updates_clear_cache) self._ugc_dnd_cache_taint.add((pkg_key, repoid,)) my.load() @@ -1811,7 +1811,7 @@ class EntropyPackageView: obj.voted = 0.0 return repository = obj.repoid - if not self.Equo.UGC.is_repository_eapi3_aware(repository): + if not self._entropy.UGC.is_repository_eapi3_aware(repository): obj.voted = 0.0 return atom = obj.name @@ -1823,7 +1823,7 @@ class EntropyPackageView: t.start() def vote_submit_thread(self, repository, key, obj): - status, err_msg = self.Equo.UGC.add_vote(repository, key, int(obj.voted)) + status, err_msg = self._entropy.UGC.add_vote(repository, key, int(obj.voted)) if status: color = SulfurConf.color_good @@ -1878,7 +1878,7 @@ class EntropyPackageView: selected_objs = [] for inst_obj in self.selected_objs: key, slot = inst_obj.keyslot - m_tup = self.Equo.atom_match(key, match_slot = slot) + m_tup = self._entropy.atom_match(key, match_slot = slot) if m_tup[0] != -1: ep, new = self.etpbase.get_package_item(m_tup) if new: @@ -2019,9 +2019,9 @@ class EntropyPackageView: def do_ugc_sync(): for key, repoid in pkgs: - if self.Equo.UGC.UGCCache.is_alldocs_cached(key, repoid): + if self._entropy.UGC.UGCCache.is_alldocs_cached(key, repoid): continue - self.Equo.UGC.get_docs(repoid, key) + self._entropy.UGC.get_docs(repoid, key) self.__pkg_ugc_icon_call_cache.clear() def do_fork(): @@ -2032,7 +2032,7 @@ class EntropyPackageView: def _spawn_ugc_icon_fetch(self, icon_doc, repoid): def do_icon_fetch(): - self.Equo.UGC.UGCCache.store_document(icon_doc['iddoc'], + self._entropy.UGC.UGCCache.store_document(icon_doc['iddoc'], repoid, icon_doc['store_url']) fork_function(do_icon_fetch, self._emit_ugc_update) @@ -2060,7 +2060,7 @@ class EntropyPackageView: if repoid is None: return - icon_doc = self.Equo.UGC.UGCCache.get_icon_cache(key, repoid) + icon_doc = self._entropy.UGC.UGCCache.get_icon_cache(key, repoid) if icon_doc is None: #const_debug_write(__name__, # "_get_cached_pkg_ugc_icon %s NOT on disk" % ( @@ -2072,7 +2072,7 @@ class EntropyPackageView: # "_get_cached_pkg_ugc_icon %s on disk?" % ( # cache_key,)) - store_path = self.Equo.UGC.UGCCache.get_stored_document( + store_path = self._entropy.UGC.UGCCache.get_stored_document( icon_doc['iddoc'], repoid, icon_doc['store_url']) if store_path is None: @@ -2141,7 +2141,7 @@ class EntropyPackageView: if sync_item in self._ugc_metadata_sync_exec_cache: return - if not self.Equo.UGC.is_repository_eapi3_aware(repoid): + if not self._entropy.UGC.is_repository_eapi3_aware(repoid): self._ugc_metadata_sync_exec_cache.add(sync_item) return @@ -2366,7 +2366,7 @@ class EntropyQueueView: self.view = widget self.setup_view() self.queue = queue - self.Equo = Equo() + self._entropy = Equo() self.ugc_update_event_handler_id = \ SulfurSignals.connect('ugc_data_update', self.__ugc_refresh) @@ -2462,7 +2462,7 @@ class EntropyQueueView: grandfather = model.append( None, (label,) ) for category in cats: cat_desc = _("No description") - cat_desc_data = self.Equo.get_category_description(category) + cat_desc_data = self._entropy.get_category_description(category) if _LOCALE in cat_desc_data: cat_desc = cat_desc_data[_LOCALE] elif 'en' in cat_desc_data: @@ -2743,7 +2743,7 @@ class EntropyRepoView: self.view = widget self.headers = [_('Repository'), _('Filename')] self.store = self.setup_view() - self.Equo = Equo() + self._entropy = Equo() self.ui = ui self.okDialog = okDialog self.Sulfur = application @@ -2754,15 +2754,15 @@ class EntropyRepoView: myiter = self.store.get_iter( path ) state = self.store.get_value(myiter, 0) repoid = self.store.get_value(myiter, 3) - if repoid != self.Equo.SystemSettings['repositories']['default_repository']: + if repoid != self._entropy.SystemSettings['repositories']['default_repository']: self.store.set_value(myiter, 0, not state) self.Sulfur.gtk_loop() if state: self.store.set_value(myiter, 1, not state) - self.Equo.disable_repository(repoid) + self._entropy.disable_repository(repoid) initconfig_entropy_constants(etpSys['rootdir']) else: - self.Equo.enable_repository(repoid) + self._entropy.enable_repository(repoid) initconfig_entropy_constants(etpSys['rootdir']) self.Sulfur.reset_cache_status() self.Sulfur.show_packages(back_to_page = "repos") @@ -2826,12 +2826,12 @@ class EntropyRepoView: def populate(self): self.store.clear() - for repo in self.Equo.SystemSettings['repositories']['order']: - repodata = self.Equo.SystemSettings['repositories']['available'][repo] + for repo in self._entropy.SystemSettings['repositories']['order']: + repodata = self._entropy.SystemSettings['repositories']['available'][repo] self.store.append([1, 1, repodata['dbrevision'], repo, repodata['description']]) # excluded ones - repo_excluded = self.Equo.SystemSettings['repositories']['excluded'] + repo_excluded = self._entropy.SystemSettings['repositories']['excluded'] for repo in repo_excluded: repodata = repo_excluded[repo] self.store.append([0, 0, repodata['dbrevision'], repo,