Compare commits

...

25 Commits

Author SHA1 Message Date
John Garland
8c36830456 Fix hang on quit 2011-02-09 09:07:32 -08:00
John Garland
568321a8ed Fix man deluged not showing '-u' on its own line 2010-08-20 01:18:39 +10:00
Damien Churchill
2c10218efd use the get_libtorrent.sh script to get libtorrent if it is missing 2010-07-22 21:13:26 +01:00
Damien Churchill
ee73936c26 add libtorrent fetch script 2010-07-22 18:17:50 +01:00
Damien Churchill
d299ecedb2 remove libtorrent submodule 2010-07-22 18:17:06 +01:00
Andrew Resch
0b609bf4ad Do not attempt to move a torrents storage if the destination path does
not exist
2010-07-12 14:46:04 -07:00
John Garland
131af5a50a Fix uncaught exception when closing deluge in classic mode 2010-07-02 02:36:04 +10:00
John Garland
65b4f8c543 Fix typo 2010-07-02 02:25:41 +10:00
Andrew Resch
e79461c7d2 Fix issue where a new lt state will cause an uncaught exception 2010-06-30 16:21:34 -07:00
Andrew Resch
c1f137505a Fix uncaught exception when closing deluge in classic mode 2010-06-30 15:17:09 -07:00
John Garland
f598d048d1 Fix man deluged not showing '-d' on its own line 2010-05-16 22:33:14 +10:00
John Garland
4f134731df Fix remote save path dialog not disappearing after creating a torrent 2010-05-16 18:14:51 +10:00
John Garland
de25c17af1 Fix only being able to click "remote path" once when creating a torrent 2010-05-16 18:14:50 +10:00
John Garland
41314e595a Fix deluged crashing on windows when logfile's directory doesn't exist 2010-05-16 18:14:47 +10:00
John Garland
e5e43532d3 Fix deluge-gtk hanging on shutdown (for real this time) 2010-05-02 23:12:19 +10:00
John Garland
9e4a92444b Close connection manager on shutdown - patch from Jan Steffens 2010-05-02 22:28:51 +10:00
John Garland
72fd3bd061 Fix deluge-gtk hanging on shutdown (thanks Jan Steffens) 2010-05-02 22:28:10 +10:00
Andrew Resch
cc086917c1 Add export-ignore attribute to .gitignore 2010-03-27 13:20:46 -07:00
Andrew Resch
3e0a35c802 Prep for release 2010-03-27 12:37:04 -07:00
John Garland
4a2316411d Add .gitignore file to 1.2 branch 2010-03-27 19:15:04 +11:00
Andrew Resch
1b54d5b93b Merge branch '1.2-stable' of deluge-torrent.org:deluge into 1.2-stable 2010-03-22 13:58:51 -07:00
Andrew Resch
64d927b499 Fix libtorrent 0.15 compat 2010-03-22 13:58:32 -07:00
John Garland
3e639c3445 Merged test_versionsplit.py into test_common.py 2010-03-22 18:19:10 +11:00
John Garland
ec39a8d501 Add test case for deluge/common.py 2010-03-22 18:19:10 +11:00
Andrew Resch
90103358f3 Fix VersionSplit comparison to do a proper compare and not simply
against the version strings
2010-03-21 15:58:55 -07:00
25 changed files with 178 additions and 68 deletions

1
.gitattributes vendored
View File

@@ -6,3 +6,4 @@ docs/source export-ignore
deluge/scripts export-ignore
.gitattributes export-ignore
.gitmodules export-ignore
.gitignore export-ignore

8
.gitignore vendored Normal file
View File

@@ -0,0 +1,8 @@
*~
build
dist
*egg-info
*.egg
*.log
*.pyc
*.tar.*

3
.gitmodules vendored
View File

@@ -1,3 +0,0 @@
[submodule "libtorrent"]
path = libtorrent
url = git://deluge-torrent.org/libtorrent

View File

@@ -1,23 +1,31 @@
=== Deluge 1.2.3 (27 March 2010) ===
==== Core ====
* Fix libtorrent version compare to use a proper numerical compare instead
of string. This fixes a problem where using lt 0.14.10 wouldn't allow
Deluge to start.
* Fix libtorrent 0.15 compatibility
* Fix hang on quit
=== Deluge 1.2.2 (19 March 2010) ===
==== Core ====
* Fix #1109 auto add halting when a torrent with invalid filename encoding
* Fix #1109 auto add halting when a torrent with invalid filename encoding
is in the directory
==== GtkUI ====
* Fix #1162 problem with the queued torrents dialog from not properly adding
* Fix #1162 problem with the queued torrents dialog from not properly adding
to the add torrent dialog if set to auto add
* Fix #1172 notify startup complete when adding torrents externally
* Fix issue where the gtkui sometimes won't start if there is a stale lock
file or socket in the ipc/ directory.
==== Console ====
* Fix #1143 deluge-console crashes when tab-completing not-existent directory
=== Deluge 1.2.1 (20 February 2010) ===
==== Core ====
* Make Deluge dependent upon libtorrent 0.14.9 or greater. This is due to
an over-downloading bug in previous versions of libtorrent.
==== GtkUI ====
* Fix #1128 Show an error dialog when unable to start a 'deluged' process
* Increased max enterable download / upload limit to 60000 KiB/s

View File

@@ -210,7 +210,7 @@ def open_url_in_browser(url):
:param url: the url to open
:type url: string
"""
import webbrowser
webbrowser.open(url)
@@ -469,13 +469,13 @@ def free_space(path):
:type path: string
:returns: the free space at path in bytes
:rtype: int
:raises InvalidPathError: if the path is not valid
"""
if not os.path.exists(path):
raise InvalidPathError("%s is not a valid path" % path)
if windows_check():
import win32file
sectors, bytes, free, total = map(long, win32file.GetDiskFreeSpace(path))
@@ -514,19 +514,19 @@ def is_ip(ip):
return True
except socket.error:
return False
class VersionSplit(object):
"""
Used for comparing version numbers.
:param ver: the version
:type ver: string
"""
def __init__(self, ver):
ver = ver.lower()
vs = ver.split("_") if "_" in ver else ver.split("-")
self.version = vs[0]
self.version = [int(x) for x in vs[0].split(".")]
self.suffix = None
if len(vs) > 1:
for s in ("rc", "alpha", "beta", "dev"):
@@ -536,12 +536,12 @@ class VersionSplit(object):
def __cmp__(self, ver):
"""
The comparison method.
:param ver: the version to compare with
:type ver: VersionSplit
"""
if self.version > ver.version or (self.suffix and self.suffix[:3] == "dev"):
return 1
if self.version < ver.version:

View File

@@ -299,14 +299,11 @@ class Torrent:
log.debug("Setting trackers for %s: %s", self.torrent_id, trackers)
tracker_list = []
if lt.version_minor < 15:
for tracker in trackers:
new_entry = lt.announce_entry(tracker["url"])
new_entry.tier = tracker["tier"]
tracker_list.append(new_entry)
self.handle.replace_trackers(tracker_list)
else:
self.handle.replace_trackers(trackers)
for tracker in trackers:
new_entry = lt.announce_entry(tracker["url"])
new_entry.tier = tracker["tier"]
tracker_list.append(new_entry)
self.handle.replace_trackers(tracker_list)
# Print out the trackers
#for t in self.handle.trackers():
@@ -334,6 +331,10 @@ class Torrent:
LTSTATE = deluge.common.LT_TORRENT_STATE
ltstate = int(self.handle.status().state)
# Set self.state to the ltstate right away just incase we don't hit some
# of the logic below
self.state = str(ltstate)
log.debug("set_state_based_on_ltstate: %s", deluge.common.LT_TORRENT_STATE[ltstate])
log.debug("session.is_paused: %s", component.get("Core").session.is_paused())
@@ -739,6 +740,9 @@ class Torrent:
def move_storage(self, dest):
"""Move a torrent's storage location"""
if not os.path.exists(dest):
log.error("Could not move storage for torrent %s since %s does not exist!", self.torrent_id, dest)
return False
try:
self.handle.move_storage(dest.encode("utf8"))
except:

View File

@@ -197,6 +197,11 @@ this should be an IP address", metavar="IFACE",
write_pidfile()
# Setup the logger
try:
# Try to make the logfile's directory if it doesn't exist
os.makedirs(os.path.abspath(os.path.dirname(options.logfile)))
except:
pass
deluge.log.setupLogger(level=options.loglevel, filename=options.logfile)
from deluge.log import LOG as log

View File

@@ -410,7 +410,7 @@ class DaemonClassicProxy(DaemonProxy):
self.connected = True
self.host = "localhost"
self.port = 58846
self.user = "localclient"
self.username = "localclient"
# Register the event handlers
for event in event_handlers:
for handler in event_handlers[event]:

View File

@@ -99,12 +99,16 @@ class ConnectionManager(component.Component):
self.config = ConfigManager("hostlist.conf.1.2", DEFAULT_CONFIG)
self.running = False
# Component overrides
def start(self):
pass
def stop(self):
pass
# Close this dialog when we are shutting down
if self.running:
self.connection_manager.response(gtk.RESPONSE_CLOSE)
def shutdown(self):
pass

View File

@@ -210,7 +210,7 @@ class CreateTorrentDialog:
client.core.get_path_size(result).addCallback(_on_get_path_size)
client.force_call(True)
dialog.destroy()
dialog.hide()
def _on_button_cancel_clicked(self, widget):
log.debug("_on_button_cancel_clicked")
@@ -224,11 +224,14 @@ class CreateTorrentDialog:
is_remote = self.files_treestore[0][1] == gtk.STOCK_NETWORK
if is_remote:
# This is a remote path
response = self.glade.get_widget("remote_save_dialog").run()
dialog = self.glade.get_widget("remote_save_dialog")
response = dialog.run()
if response == gtk.RESPONSE_OK:
result = self.glade.get_widget("entry_save_path").get_text()
else:
dialog.hide()
return
dialog.hide()
else:
# Setup the filechooserdialog
chooser = gtk.FileChooserDialog(_("Save .torrent file"),
@@ -340,7 +343,6 @@ class CreateTorrentDialog:
trackers,
add_to_session).addCallback(hide_progress)
chooser.destroy()
self.dialog.destroy()
def create_torrent(self, path, tracker, piece_length, progress, comment, target,

View File

@@ -167,7 +167,7 @@ class GtkUI(object):
self.gnome_prog = gnome.init("Deluge", deluge.common.get_version())
self.gnome_client = gnome.ui.master_client()
def on_die(*args):
gtk.main_quit()
reactor.stop()
self.gnome_client.connect("die", on_die)
log.debug("GNOME session 'die' handler registered!")
except Exception, e:
@@ -180,7 +180,7 @@ class GtkUI(object):
def win_handler(ctrl_type):
log.debug("ctrl_type: %s", ctrl_type)
if ctrl_type in (CTRL_CLOSE_EVENT, CTRL_SHUTDOWN_EVENT):
gtk.main_quit()
reactor.stop()
return 1
SetConsoleCtrlHandler(win_handler)

View File

@@ -46,6 +46,7 @@ from deluge.ui.client import client
import deluge.component as component
from deluge.configmanager import ConfigManager
from deluge.ui.gtkui.ipcinterface import process_args
from twisted.internet import reactor
import deluge.common
import common
@@ -151,8 +152,16 @@ class MainWindow(component.Component):
"""Returns a reference to the main window glade object."""
return self.main_glade
def quit(self):
gtk.main_quit()
def quit(self, shutdown=False):
"""
Quits the GtkUI
:param shutdown: whether or not to shutdown the daemon as well
:type shutdown: boolean
"""
if shutdown:
client.daemon.shutdown()
reactor.stop()
def load_window_state(self):
x = self.config["window_x_pos"]
@@ -238,7 +247,6 @@ class MainWindow(component.Component):
def on_newversionavailable_event(self, new_version):
if self.config["show_new_releases"]:
from twisted.internet import reactor
from deluge.ui.gtkui.new_release_dialog import NewReleaseDialog
reactor.callLater(5.0, NewReleaseDialog().show, new_version)

View File

@@ -253,15 +253,10 @@ class MenuBar(component.Component):
def on_menuitem_quitdaemon_activate(self, data=None):
log.debug("on_menuitem_quitdaemon_activate")
# Tell the core to shutdown
def on_shutdown(result):
self.window.quit()
client.daemon.shutdown().addCallback(on_shutdown)
self.window.quit(shutdown=True)
def on_menuitem_quit_activate(self, data=None):
log.debug("on_menuitem_quit_activate")
if self.config["classic_mode"] and client.is_classicmode():
client.daemon.shutdown()
self.window.quit()
## Edit Menu ##

View File

@@ -324,9 +324,6 @@ class SystemTray(component.Component):
if self.config["lock_tray"] and not self.window.visible():
self.unlock_tray()
if self.config["classic_mode"]:
client.daemon.shutdown()
self.window.quit()
def on_menuitem_quitdaemon_activate(self, menuitem):
@@ -334,8 +331,7 @@ class SystemTray(component.Component):
if self.config["lock_tray"] and not self.window.visible():
self.unlock_tray()
client.daemon.shutdown()
self.window.quit()
self.window.quit(shutdown=True)
def tray_setbwdown(self, widget, data=None):
self.setbwlimit(widget, _("Set Maximum Download Speed"), "max_download_speed",

View File

@@ -1,4 +1,4 @@
.TH DELUGE-CONSOLE 1 "October 2009" "1.2.2"
.TH DELUGE-CONSOLE 1 "October 2009" "1.2.3"
.SH NAME
deluge-console - a bittorrent client curses interface

View File

@@ -1,4 +1,4 @@
.TH DELUGE-GTK 1 "October 2009" "1.2.2"
.TH DELUGE-GTK 1 "October 2009" "1.2.3"
.SH NAME
deluge-gtk - a bittorrent client gtk interface

View File

@@ -1,4 +1,4 @@
.TH DELUGE-WEB 1 "October 2009" "1.2.2"
.TH DELUGE-WEB 1 "October 2009" "1.2.3"
.SH NAME
deluge-web - a bittorrent client ajax web interface

View File

@@ -1,4 +1,4 @@
.TH DELUGE 1 "October 2009" "1.2.2"
.TH DELUGE 1 "October 2009" "1.2.3"
.SH NAME
deluge - a bittorrent client

View File

@@ -1,4 +1,4 @@
.TH DELUGED 1 "October 2009" "1.2.2"
.TH DELUGED 1 "October 2009" "1.2.3"
.SH NAME
deluged - a bittorrent client daemon
@@ -27,8 +27,10 @@ Port daemon will listen on, default is 58846
.TP
.I -i INTERFACE, --interface=INTERFACE
Interface daemon will listen for bittorrent connections on, this should be an IP address
.TP
.I -u UI_INTERFACE, --ui-interface=UI_INTERFACE
Interface daemon will listen for UI connections on, this should be an IP address
.TP
.I -d, --do-not-daemonize
Do not daemonize
.TP

16
get_libtorrent.sh Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/bash
#
# This script checks out libtorrent from subversion
#
SVN=$(which svn)
LT_URL=https://libtorrent.svn.sourceforge.net/svnroot/libtorrent
VERSION=14
[ "$1" != "" ] && VERSION=$1
BRANCH=branches/RC_0_$VERSION
if [ -d libtorrent ]; then
$SVN up libtorrent
else
$SVN co $LT_URL/$BRANCH libtorrent
fi

Submodule libtorrent deleted from a069275ba2

View File

@@ -211,18 +211,29 @@ except ImportError:
else:
build_libtorrent = False
if build_libtorrent and os.path.exists("libtorrent") and os.listdir("libtorrent"):
# There isn't a system libtorrent library, so let's build the one included with deluge
libtorrent = Extension(
'libtorrent',
extra_compile_args = _extra_compile_args,
include_dirs = _include_dirs,
libraries = _libraries,
library_dirs = _library_dirs,
sources = _sources
)
if build_libtorrent:
got_libtorrent = False
if not os.path.exists("libtorrent"):
import subprocess
if subprocess.call(['./get_libtorrent.sh']) > 0:
got_libtorrent = False
else:
got_libtorrent = True
else:
got_libtorrent = True
_ext_modules = [libtorrent]
if got_libtorrent:
# There isn't a system libtorrent library, so let's build the one included with deluge
libtorrent = Extension(
'libtorrent',
extra_compile_args = _extra_compile_args,
include_dirs = _include_dirs,
libraries = _libraries,
library_dirs = _library_dirs,
sources = _sources
)
_ext_modules = [libtorrent]
class build_trans(cmd.Command):
description = 'Compile .po files into .mo files'
@@ -397,7 +408,7 @@ _data_files = [
# Main setup
setup(
name = "deluge",
version = "1.2.2",
version = "1.2.3",
fullname = "Deluge Bittorrent Client",
description = "Bittorrent Client",
author = "Andrew Resch, Damien Churchill",

54
tests/test_common.py Normal file
View File

@@ -0,0 +1,54 @@
from twisted.trial import unittest
from deluge.common import *
import os
class CommonTestCase(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_fsize(self):
self.failUnless(fsize(112245) == "109.6 KiB")
def test_fpcnt(self):
self.failUnless(fpcnt(0.9311) == "93.11%")
def test_fspeed(self):
self.failUnless(fspeed(43134) == "42.1 KiB/s")
def test_fpeer(self):
self.failUnless(fpeer(10, 20) == "10 (20)")
self.failUnless(fpeer(10, -1) == "10")
def test_ftime(self):
self.failUnless(ftime(23011) == "6h 23m")
def test_fdate(self):
self.failUnless(fdate(-1) == "")
def test_is_url(self):
self.failUnless(is_url("http://deluge-torrent.org"))
self.failIf(is_url("file://test.torrent"))
def test_is_magnet(self):
self.failUnless(is_magnet("magnet:?xt=urn:btih:SU5225URMTUEQLDXQWRB2EQWN6KLTYKN"))
def test_get_path_size(self):
self.failUnless(get_path_size(os.devnull) == 0)
self.failUnless(get_path_size("non-existant.file") == -1)
def test_is_ip(self):
self.failUnless(is_ip("127.0.0.1"))
self.failIf(is_ip("127..0.0"))
def test_VersionSplit(self):
self.failUnless(VersionSplit("1.2.2") == VersionSplit("1.2.2"))
self.failUnless(VersionSplit("1.2.1") < VersionSplit("1.2.2"))
self.failUnless(VersionSplit("1.1.9") < VersionSplit("1.2.2"))
self.failUnless(VersionSplit("1.2.2") > VersionSplit("1.2.1"))
self.failIf(VersionSplit("1.2.2") == VersionSplit("1.2.2-dev"))
self.failUnless(VersionSplit("0.14.9") == VersionSplit("0.14.9"))
self.failUnless(VersionSplit("0.14.9") > VersionSplit("0.14.5"))
self.failUnless(VersionSplit("0.14.10") >= VersionSplit("0.14.9"))

View File

@@ -1,4 +1,4 @@
build_version = "1.2.2"
build_version = "1.2.3"
python_path = "C:\\Python26\\"
import shutil

View File

@@ -37,7 +37,7 @@ SetCompressor lzma
# Deluge program information
!define PROGRAM_NAME "Deluge"
!define PROGRAM_VERSION "1.2.2"
!define PROGRAM_VERSION "1.2.3"
!define PROGRAM_WEB_SITE "http://deluge-torrent.org"
# Python files generated with bbfreeze (without DLLs from GTK+ runtime)
@@ -300,4 +300,4 @@ Section Uninstall
DELUGE_skip_delete:
# This key is only used by Deluge, so we should always delete it
DeleteRegKey HKCR "Deluge"
SectionEnd
SectionEnd