Fix #1505: Add libtorrent info to --version output

This commit is contained in:
Calum Lind 2011-07-09 14:00:29 +01:00
parent b81159f295
commit f0c327a024
2 changed files with 14 additions and 3 deletions

View File

@ -47,6 +47,11 @@ from optparse import OptionParser
import deluge.log import deluge.log
import deluge.error import deluge.error
try:
from deluge._libtorrent import lt
lt_version = "\nlibtorrent: %s" % lt.version
except ImportError:
lt_version = ""
def start_ui(): def start_ui():
"""Entry point for ui script""" """Entry point for ui script"""
@ -54,7 +59,7 @@ def start_ui():
# Setup the argument parser # Setup the argument parser
parser = OptionParser(usage="%prog [options] [actions]", parser = OptionParser(usage="%prog [options] [actions]",
version=deluge.common.get_version()) version= "%prog: " + deluge.common.get_version() + lt_version)
parser.add_option("-u", "--ui", dest="ui", parser.add_option("-u", "--ui", dest="ui",
help="""The UI that you wish to launch. The UI choices are:\n help="""The UI that you wish to launch. The UI choices are:\n
@ -139,7 +144,7 @@ def start_daemon():
# Setup the argument parser # Setup the argument parser
parser = OptionParser(usage="%prog [options] [actions]", parser = OptionParser(usage="%prog [options] [actions]",
version=deluge.common.get_version()) version= "%prog: " + deluge.common.get_version() + lt_version)
parser.add_option("-p", "--port", dest="port", parser.add_option("-p", "--port", dest="port",
help="Port daemon will listen on", action="store", type="int") help="Port daemon will listen on", action="store", type="int")
parser.add_option("-i", "--interface", dest="interface", parser.add_option("-i", "--interface", dest="interface",

View File

@ -40,6 +40,12 @@ import deluge.common
import deluge.configmanager import deluge.configmanager
import deluge.log import deluge.log
try:
from deluge._libtorrent import lt
lt_version = "\nlibtorrent: %s" % lt.version
except ImportError:
lt_version = ""
DEFAULT_PREFS = { DEFAULT_PREFS = {
"default_ui": "gtk" "default_ui": "gtk"
} }
@ -53,7 +59,7 @@ class _UI(object):
def __init__(self, name="gtk"): def __init__(self, name="gtk"):
self.__name = name self.__name = name
self.__parser = OptionParser(version=deluge.common.get_version()) self.__parser = OptionParser(version="%prog: " + deluge.common.get_version() + lt_version)
group = OptionGroup(self.__parser, "Common Options") group = OptionGroup(self.__parser, "Common Options")
group.add_option("-c", "--config", dest="config", group.add_option("-c", "--config", dest="config",