diff --git a/deluge/common.py b/deluge/common.py index 5fb4f25cf..9e8513546 100644 --- a/deluge/common.py +++ b/deluge/common.py @@ -56,7 +56,15 @@ def get_version(): return pkg_resources.require("Deluge")[0].version.split("r")[0] def get_revision(): - return pkg_resources.require("Deluge")[0].version.split("r")[1] + revision = "" + try: + f = open(pkg_resources.resource_filename("deluge", os.path.join("data", "revision"))) + revision = f.read() + f.close() + except IOError, e: + log.debug("Could not open revision file: %s", e) + + return revision def get_config_dir(filename=None): """ Returns the config path if no filename is specified diff --git a/deluge/data/revision b/deluge/data/revision new file mode 100644 index 000000000..e69de29bb diff --git a/deluge/ui/gtkui/aboutdialog.py b/deluge/ui/gtkui/aboutdialog.py index 83f160e4c..a47f4f37e 100644 --- a/deluge/ui/gtkui/aboutdialog.py +++ b/deluge/ui/gtkui/aboutdialog.py @@ -50,10 +50,14 @@ class AboutDialog: "aboutdialog") self.about.set_position(gtk.WIN_POS_CENTER) self.about.set_name("Deluge") - try: - self.about.set_version(deluge.common.get_version() + "r" + deluge.common.get_revision()) - except IndexError: - self.about.set_version(deluge.common.get_version()) + + # Get the version and revision numbers + rev = deluge.common.get_revision() + version = deluge.common.get_version() + if rev != "": + version = version + "r" + rev + + self.about.set_version(version) self.about.set_authors(["Andrew Resch", "Marcos Pinto"]) self.about.set_artists(["Andrew Wedderburn", "Andrew Resch"]) self.about.set_translator_credits(_("translator-credits")) diff --git a/setup.py b/setup.py index ecafa1684..7e2dc9dbc 100644 --- a/setup.py +++ b/setup.py @@ -50,11 +50,15 @@ try: stdout = os.popen("svn info") for line in stdout: if line.split(" ")[0] == "Revision:": - revision_string = "r%s" % line.split(" ")[1].strip() + revision_string = line.split(" ")[1].strip() break + f = open("deluge/data/revision", "w") + f.write(revision_string) + f.close() except: pass + # The libtorrent extension _extra_compile_args = [ "-Wno-missing-braces", @@ -173,7 +177,7 @@ for path in glob.glob('deluge/plugins/*'): setup( name = "deluge", fullname = "Deluge Bittorent Client", - version = "0.6.0.0" + revision_string, + version = "0.6.0.0", author = "Andrew Resch, Marcos Pinto", author_email = "andrewresch@gmail.com, markybob@dipconsultants.com", description = "GTK+ bittorrent client", @@ -183,6 +187,7 @@ setup( package_data = {"deluge": ["ui/gtkui/glade/*.glade", "data/pixmaps/*.png", "data/pixmaps/deluge.svg", + "data/revision", "plugins/*.egg", "i18n/*.pot", "i18n/*/LC_MESSAGES/*.mo",