diff options
Diffstat (limited to '')
-rw-r--r-- | plugins/etc_proposals.py | 2 | ||||
-rw-r--r-- | plugins/exception.py | 2 | ||||
-rw-r--r-- | plugins/gpytage.py | 2 | ||||
-rw-r--r-- | plugins/new_version.py | 62 | ||||
-rw-r--r-- | plugins/notify.py | 2 | ||||
-rw-r--r-- | plugins/package_details.py | 2 | ||||
-rw-r--r-- | plugins/reload_portage.py | 4 |
7 files changed, 38 insertions, 38 deletions
diff --git a/plugins/etc_proposals.py b/plugins/etc_proposals.py index 052f3d3..80f1ef9 100644 --- a/plugins/etc_proposals.py +++ b/plugins/etc_proposals.py @@ -3,7 +3,7 @@ # File: plugins/etc_proposals.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2009 René 'Necoro' Neumann +# Copyright (C) 2006-2010 René 'Necoro' Neumann # This is free software. You may redistribute copies of it under the terms of # the GNU General Public License version 2. # There is NO WARRANTY, to the extent permitted by law. diff --git a/plugins/exception.py b/plugins/exception.py index 3fe7287..02d0cc3 100644 --- a/plugins/exception.py +++ b/plugins/exception.py @@ -3,7 +3,7 @@ # File: plugins/exception.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2009 René 'Necoro' Neumann +# Copyright (C) 2006-2010 René 'Necoro' Neumann # This is free software. You may redistribute copies of it under the terms of # the GNU General Public License version 2. # There is NO WARRANTY, to the extent permitted by law. diff --git a/plugins/gpytage.py b/plugins/gpytage.py index b7b48d7..00f85ab 100644 --- a/plugins/gpytage.py +++ b/plugins/gpytage.py @@ -3,7 +3,7 @@ # File: plugins/gpytage.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2009 René 'Necoro' Neumann +# Copyright (C) 2006-2010 René 'Necoro' Neumann # This is free software. You may redistribute copies of it under the terms of # the GNU General Public License version 2. # There is NO WARRANTY, to the extent permitted by law. diff --git a/plugins/new_version.py b/plugins/new_version.py index 94e61ca..876beea 100644 --- a/plugins/new_version.py +++ b/plugins/new_version.py @@ -3,7 +3,7 @@ # File: plugins/new_version.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2009 René 'Necoro' Neumann +# Copyright (C) 2006-2010 René 'Necoro' Neumann # This is free software. You may redistribute copies of it under the terms of # the GNU General Public License version 2. # There is NO WARRANTY, to the extent permitted by law. @@ -12,16 +12,11 @@ from portato.helper import debug, warning -try: - from bzrlib import plugin, branch -except ImportError: - plugin = branch = None - warning("NEW_VERSION :: Cannot import 'bzrlib'") - +from subprocess import Popen, PIPE import gobject from portato import get_listener -from portato.constants import REPOURI, VERSION, APP_ICON, APP +from portato.constants import REPOURI, REVISION, APP_ICON, APP from portato.gui.utils import GtkThread class NewVersionFinder(WidgetPlugin): @@ -29,7 +24,7 @@ class NewVersionFinder(WidgetPlugin): Checks for a new version of portato every 30 minutes and on startup. """ __author__ = "René 'Necoro' Neumann" - __dependency__ = ["dev-util/bzr"] + __dependency__ = ["dev-util/git"] def init (self): self.add_call("main", self.run) @@ -37,20 +32,30 @@ class NewVersionFinder(WidgetPlugin): def widget_init (self): self.create_widget("Plugin Menu", "Check for new _versions", activate = self.menu) + def get_notify_callback (self, rev): + def callback(): + get_listener().send_notify( + base = "New Portato Live Version Found", + descr = "The most recent revision is %s." % rev, + icon = APP_ICON) + return False + + return callback + def find_version (self, rev): - try: - b = branch.Branch.open(REPOURI) - except Exception, e: - warning("NEW_VERSION :: Exception occured while accessing the remote branch: %s", str(e)) - return - - debug("NEW_VERSION :: Installed rev: %s - Current rev: %s", rev, b.revno()) - if int(rev) < int(b.revno()): - def callback(): - get_listener().send_notify(base = "New Portato Live Version Found", descr = "You have rev. %s, but the most recent revision is %s." % (rev, b.revno()), icon = APP_ICON) - return False - - gobject.idle_add(callback) + + repo, branch = REPOURI.split('::') + + remote_rev = Popen(['git', 'ls-remote', repo, branch], stdout = PIPE).communicate()[0].strip().split('\t') + + if len(remote_rev) and remote_rev[1] not in (branch, 'refs/heads/'+branch, 'refs/tags/'+branch): + warning('NEW_VERSION :: Returned revision information looks strange: %s', str(remote_rev)) + else: + remote_rev = remote_rev[0] + debug("NEW_VERSION :: Installed rev: %s - Current rev: %s", remote_rev, rev) + + if rev != remote_rev: + gobject.idle_add(self.get_notify_callback(remote_rev)) def start_thread(self, rev): t = GtkThread(target = self.find_version, name = "Version Updater Thread", args = (rev,)) @@ -62,16 +67,11 @@ class NewVersionFinder(WidgetPlugin): """ Run the thread once. """ - v = VERSION.split() - if len(v) != 3: + if not REVISION: return None - - rev = v[-1] - - plugin.load_plugins() # to have lp: addresses parsed - self.start_thread(rev) - return rev + self.start_thread(REVISION) + return REVISION def run (self, *args, **kwargs): """ @@ -82,4 +82,4 @@ class NewVersionFinder(WidgetPlugin): if rev is not None: gobject.timeout_add(30*60*1000, self.start_thread, rev) # call it every 30 minutes -register(NewVersionFinder, (branch is None)) +register(NewVersionFinder, REVISION == '') diff --git a/plugins/notify.py b/plugins/notify.py index 4aba2c6..e762b5c 100644 --- a/plugins/notify.py +++ b/plugins/notify.py @@ -3,7 +3,7 @@ # File: plugins/notify.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2009 René 'Necoro' Neumann +# Copyright (C) 2006-2010 René 'Necoro' Neumann # This is free software. You may redistribute copies of it under the terms of # the GNU General Public License version 2. # There is NO WARRANTY, to the extent permitted by law. diff --git a/plugins/package_details.py b/plugins/package_details.py index 19f3126..dc1ce03 100644 --- a/plugins/package_details.py +++ b/plugins/package_details.py @@ -3,7 +3,7 @@ # File: plugins/package_details.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2009 René 'Necoro' Neumann +# Copyright (C) 2006-2010 René 'Necoro' Neumann # This is free software. You may redistribute copies of it under the terms of # the GNU General Public License version 2. # There is NO WARRANTY, to the extent permitted by law. diff --git a/plugins/reload_portage.py b/plugins/reload_portage.py index 539e949..cc9d173 100644 --- a/plugins/reload_portage.py +++ b/plugins/reload_portage.py @@ -3,7 +3,7 @@ # File: plugins/reload_portage.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2009 René 'Necoro' Neumann +# Copyright (C) 2006-2010 René 'Necoro' Neumann # This is free software. You may redistribute copies of it under the terms of # the GNU General Public License version 2. # There is NO WARRANTY, to the extent permitted by law. @@ -15,7 +15,7 @@ from portato.backend import system class ReloadPortage (Plugin): __author__ = "René 'Necoro' Neumann" __description__ = """Reloads portage when an emerge process has finished. -This can take some time, but sometimes it is necessairy.""" +This can take some time, but sometimes it is necessary.""" def init(self): self.add_call("after_emerge", self.hook, type = "after", dep = "EtcProposals") |