Merge branch 'master' of deluge-torrent.org:deluge

This commit is contained in:
Andrew Resch 2011-06-03 14:55:34 -07:00
commit 84c5078667
161 changed files with 314 additions and 147 deletions

View file

@ -5,6 +5,8 @@
now, it even supports multiple users perfectly.
* Authentication/Permission exceptions are now sent to clients and recreated
there to allow acting upon them.
* Enforced the use of the "deluge.plugins" namespace to reduce package
names clashing beetween regular packages and deluge plugins.
==== Core ====
* Implement #1063 option to delete torrent file copy on torrent removal - patch from Ghent

View file

@ -1 +1,4 @@
"""Deluge"""
# this is a namespace package
import pkg_resources
pkg_resources.declare_namespace(__name__)

View file

@ -59,6 +59,16 @@ METADATA_KEYS = [
"Description",
]
DEPRECATION_WARNING = """
The plugin %s is not using the "deluge.plugins" namespace.
In order to avoid package name clashes between regular python packages and
deluge plugins, the way deluge plugins should be created has changed.
If you're seeing this message and you're not the developer of the plugin which
triggered this warning, please report to it's author.
If you're the developer, please take a look at the plugins hosted on deluge's
git repository to have an idea of what needs to be changed.
"""
class PluginManagerBase:
"""PluginManagerBase is a base class for PluginManagers to inherit"""
@ -140,6 +150,13 @@ class PluginManagerBase:
log.exception(e)
continue
instance.enable()
if not instance.__module__.startswith("deluge.plugins"):
import warnings
warnings.warn_explicit(
DEPRECATION_WARNING % name,
DeprecationWarning,
instance.__module__, 0
)
if self._component_state == "Started":
component.start([instance.plugin._component_name])
plugin_name = plugin_name.replace("-", " ")

View file

@ -0,0 +1,3 @@
# this is a namespace package
import pkg_resources
pkg_resources.declare_namespace(__name__)

View file

@ -0,0 +1,3 @@
# this is a namespace package
import pkg_resources
pkg_resources.declare_namespace(__name__)

View file

@ -39,4 +39,5 @@
def get_resource(filename):
import pkg_resources, os
return pkg_resources.resource_filename("autoadd", os.path.join("data", filename))
return pkg_resources.resource_filename("deluge.plugins.autoadd",
os.path.join("data", filename))

View file

@ -38,7 +38,7 @@
# statement from all source files in the program, then also delete it here.
#
from setuptools import setup
from setuptools import setup, find_packages
__plugin_name__ = "AutoAdd"
__author__ = "Chase Sterling, Pedro Algarvio"
@ -48,7 +48,7 @@ __url__ = "http://dev.deluge-torrent.org/wiki/Plugins/AutoAdd"
__license__ = "GPLv3"
__description__ = "Monitors folders for .torrent files."
__long_description__ = """"""
__pkg_data__ = {__plugin_name__.lower(): ["template/*", "data/*"]}
__pkg_data__ = {'deluge.plugins.'+__plugin_name__.lower(): ["template/*", "data/*"]}
setup(
name=__plugin_name__,
@ -59,16 +59,16 @@ setup(
url=__url__,
license=__license__,
long_description=__long_description__ if __long_description__ else __description__,
packages=[__plugin_name__.lower()],
packages=find_packages(),
namespace_packages = ["deluge", "deluge.plugins"],
package_data = __pkg_data__,
entry_points="""
[deluge.plugin.core]
%s = %s:CorePlugin
%s = deluge.plugins.%s:CorePlugin
[deluge.plugin.gtkui]
%s = %s:GtkUIPlugin
%s = deluge.plugins.%s:GtkUIPlugin
[deluge.plugin.webui]
%s = %s:WebUIPlugin
%s = deluge.plugins.%s:WebUIPlugin
""" % ((__plugin_name__, __plugin_name__.lower())*3)
)

View file

@ -0,0 +1,3 @@
# this is a namespace package
import pkg_resources
pkg_resources.declare_namespace(__name__)

View file

@ -0,0 +1,3 @@
# this is a namespace package
import pkg_resources
pkg_resources.declare_namespace(__name__)

View file

@ -40,7 +40,8 @@ from functools import wraps
from sys import exc_info
def get_resource(filename):
return pkg_resources.resource_filename("blocklist", os.path.join("data", filename))
return pkg_resources.resource_filename("deluge.plugins.blocklist",
os.path.join("data", filename))
def raisesErrorsAs(error):
"""
@ -73,14 +74,14 @@ def raisesErrorsAs(error):
def remove_zeros(ip):
"""
Removes unneeded zeros from ip addresses.
Example: 000.000.000.003 -> 0.0.0.3
:param ip: the ip address
:type ip: string
:returns: the ip address without the unneeded zeros
:rtype: string
"""
return ".".join([part.lstrip("0").zfill(1) for part in ip.split(".")])

View file

Before

Width:  |  Height:  |  Size: 705 B

After

Width:  |  Height:  |  Size: 705 B

View file

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -31,7 +31,7 @@
#
from setuptools import setup
from setuptools import setup, find_packages
__plugin_name__ = "Blocklist"
__author__ = "John Garland"
@ -41,7 +41,7 @@ __url__ = "http://deluge-torrent.org"
__license__ = "GPLv3"
__description__ = "Download and import IP blocklists"
__long_description__ = __description__
__pkg_data__ = {__plugin_name__.lower(): ["data/*"]}
__pkg_data__ = {'deluge.plugins.'+__plugin_name__.lower(): ["data/*"]}
setup(
name=__plugin_name__,
@ -53,15 +53,16 @@ setup(
license=__license__,
long_description=__long_description__,
packages=[__plugin_name__.lower()],
packages=find_packages(),
namespace_packages = ["deluge", "deluge.plugins"],
package_data = __pkg_data__,
entry_points="""
[deluge.plugin.core]
%s = %s:CorePlugin
%s = deluge.plugins.%s:CorePlugin
[deluge.plugin.gtkui]
%s = %s:GtkUIPlugin
%s = deluge.plugins.%s:GtkUIPlugin
[deluge.plugin.webui]
%s = %s:WebUIPlugin
%s = deluge.plugins.%s:WebUIPlugin
""" % ((__plugin_name__, __plugin_name__.lower())*3)
)

View file

@ -0,0 +1,3 @@
# this is a namespace package
import pkg_resources
pkg_resources.declare_namespace(__name__)

View file

@ -0,0 +1,3 @@
# this is a namespace package
import pkg_resources
pkg_resources.declare_namespace(__name__)

View file

@ -37,4 +37,5 @@ import pkg_resources
import os.path
def get_resource(filename):
return pkg_resources.resource_filename("execute", os.path.join("data", filename))
return pkg_resources.resource_filename("deluge.plugins.example",
os.path.join("data", filename))

View file

@ -31,7 +31,7 @@
#
#
from setuptools import setup
from setuptools import setup, find_packages
__plugin_name__ = "Example"
__author__ = "Andrew Resch"
@ -41,7 +41,7 @@ __url__ = "http://deluge-torrent.org"
__license__ = "GPLv3"
__description__ = "Example plugin"
__long_description__ = __description__
__pkg_data__ = {__plugin_name__.lower(): []}
__pkg_data__ = {"deluge.plugins."+__plugin_name__.lower(): []}
setup(
name=__plugin_name__,
@ -53,15 +53,16 @@ setup(
license=__license__,
long_description=__long_description__,
packages=[__plugin_name__.lower()],
packages=find_packages(),
namespace_packages = ["deluge", "deluge.plugins"],
package_data = __pkg_data__,
entry_points="""
[deluge.plugin.core]
%s = %s:CorePlugin
%s = %s:deluge.plugins.CorePlugin
[deluge.plugin.gtkui]
%s = %s:GtkUIPlugin
%s = %s:deluge.plugins.GtkUIPlugin
[deluge.plugin.webui]
%s = %s:WebUIPlugin
%s = %s:deluge.plugins.WebUIPlugin
""" % ((__plugin_name__, __plugin_name__.lower())*3)
)

View file

@ -0,0 +1,3 @@
# this is a namespace package
import pkg_resources
pkg_resources.declare_namespace(__name__)

View file

@ -0,0 +1,3 @@
# this is a namespace package
import pkg_resources
pkg_resources.declare_namespace(__name__)

View file

@ -37,4 +37,5 @@ import pkg_resources
import os.path
def get_resource(filename):
return pkg_resources.resource_filename("example", os.path.join("data", filename))
return pkg_resources.resource_filename("deluge.plugins.execute",
os.path.join("data", filename))

View file

@ -33,7 +33,6 @@
#
#
import pkg_resources
from deluge.log import getPluginLogger
from deluge.ui.client import client

View file

@ -31,7 +31,7 @@
#
#
from setuptools import setup
from setuptools import setup, find_packages
__plugin_name__ = "Execute"
__author__ = "Damien Churchill"
@ -41,7 +41,7 @@ __url__ = "http://deluge-torrent.org"
__license__ = "GPLv3"
__description__ = "Plugin to execute a command upon an event"
__long_description__ = __description__
__pkg_data__ = {__plugin_name__.lower(): ["data/*"]}
__pkg_data__ = {"deluge.plugins."+__plugin_name__.lower(): ["data/*"]}
setup(
name=__plugin_name__,
@ -53,15 +53,16 @@ setup(
license=__license__,
long_description=__long_description__,
packages=[__plugin_name__.lower()],
packages=find_packages(),
namespace_packages = ["deluge", "deluge.plugins"],
package_data = __pkg_data__,
entry_points="""
[deluge.plugin.core]
%s = %s:CorePlugin
%s = %s:deluge.plugins.CorePlugin
[deluge.plugin.gtkui]
%s = %s:GtkUIPlugin
%s = %s:deluge.plugins.GtkUIPlugin
[deluge.plugin.web]
%s = %s:WebUIPlugin
%s = %s:deluge.plugins.WebUIPlugin
""" % ((__plugin_name__, __plugin_name__.lower())*3)
)

View file

@ -0,0 +1,3 @@
# this is a namespace package
import pkg_resources
pkg_resources.declare_namespace(__name__)

View file

@ -0,0 +1,3 @@
# this is a namespace package
import pkg_resources
pkg_resources.declare_namespace(__name__)

View file

@ -35,4 +35,5 @@
def get_resource(filename):
import pkg_resources, os
return pkg_resources.resource_filename("extractor", os.path.join("data", filename))
return pkg_resources.resource_filename("deluge.plugins.extractor",
os.path.join("data", filename))

View file

@ -37,7 +37,7 @@
#
#
from setuptools import setup
from setuptools import setup, find_packages
__plugin_name__ = "Extractor"
__author__ = "Andrew Resch"
@ -47,7 +47,7 @@ __url__ = "http://deluge-torrent.org"
__license__ = "GPLv3"
__description__ = "Extract files upon completion"
__long_description__ = """"""
__pkg_data__ = {__plugin_name__.lower(): ["template/*", "data/*"]}
__pkg_data__ = {"deluge.plugins."+__plugin_name__.lower(): ["template/*", "data/*"]}
setup(
name=__plugin_name__,
@ -59,15 +59,16 @@ setup(
license=__license__,
long_description=__long_description__ if __long_description__ else __description__,
packages=[__plugin_name__.lower()],
packages=find_packages(),
namespace_packages = ["deluge", "deluge.plugins"],
package_data = __pkg_data__,
entry_points="""
[deluge.plugin.core]
%s = %s:CorePlugin
%s = %s:deluge.plugins.CorePlugin
[deluge.plugin.gtkui]
%s = %s:GtkUIPlugin
%s = %s:deluge.plugins.GtkUIPlugin
[deluge.plugin.webui]
%s = %s:WebUIPlugin
%s = %s:deluge.plugins.WebUIPlugin
""" % ((__plugin_name__, __plugin_name__.lower())*3)
)

View file

@ -0,0 +1,3 @@
# this is a namespace package
import pkg_resources
pkg_resources.declare_namespace(__name__)

View file

@ -0,0 +1,3 @@
# this is a namespace package
import pkg_resources
pkg_resources.declare_namespace(__name__)

View file

@ -34,7 +34,7 @@
# but you are not obligated to do so. If you do not wish to do so, delete
# this exception statement from your version. If you delete this exception
from setuptools import setup
from setuptools import setup, find_packages
__plugin_name__ = "feeder"
__author__ = "Fredrik Eriksson"
@ -44,7 +44,7 @@ __url__ = ""
__license__ = "GPLv3"
__description__ = "A plugin for automatically downloadning torrents from a RSS-feed"
__long_description__ = """"""
__pkg_data__ = {__plugin_name__.lower(): ["template/*", "data/*"]}
__pkg_data__ = {"deluge.plugins."+__plugin_name__.lower(): ["template/*", "data/*"]}
setup(
name=__plugin_name__,
@ -56,15 +56,16 @@ setup(
license=__license__,
long_description=__long_description__,
packages=[__plugin_name__.lower()],
packages=find_packages(),
namespace_packages = ["deluge", "deluge.plugins"],
package_data = __pkg_data__,
entry_points="""
[deluge.plugin.core]
%s = %s:CorePlugin
%s = deluge.plugins.%s:CorePlugin
[deluge.plugin.gtkui]
%s = %s:GtkUIPlugin
%s = deluge.plugins.%s:GtkUIPlugin
[deluge.plugin.webui]
%s = %s:WebUIPlugin
%s = deluge.plugins.%s:WebUIPlugin
""" % ((__plugin_name__, __plugin_name__.lower())*3)
)

View file

@ -0,0 +1,11 @@
#!/bin/bash
BASEDIR=$(cd `dirname $0` && pwd)
CONFIG_DIR=$( test -z $1 && echo "" || echo "$1")
[ -d "$CONFIG_DIR/plugins" ] || echo "Config dir "$CONFIG_DIR" is either not a directory or is not a proper deluge config directory. Exiting"
[ -d "$CONFIG_DIR/plugins" ] || exit 1
cd $BASEDIR
test -d $BASEDIR/temp || mkdir $BASEDIR/temp
export PYTHONPATH=$BASEDIR/temp
python setup.py build develop --install-dir $BASEDIR/temp
cp $BASEDIR/temp/*.egg-link $CONFIG_DIR/plugins
rm -fr $BASEDIR/temp

View file

@ -0,0 +1,3 @@
# this is a namespace package
import pkg_resources
pkg_resources.declare_namespace(__name__)

View file

@ -0,0 +1,3 @@
# this is a namespace package
import pkg_resources
pkg_resources.declare_namespace(__name__)

View file

@ -39,4 +39,5 @@
def get_resource(filename):
import pkg_resources, os
return pkg_resources.resource_filename("freespace", os.path.join("data", filename))
return pkg_resources.resource_filename("deluge.plugins.freespace",
os.path.join("data", filename))

View file

@ -37,7 +37,7 @@
# statement from all source files in the program, then also delete it here.
#
from setuptools import setup
from setuptools import setup, find_packages
__plugin_name__ = "FreeSpace"
__author__ = "Pedro Algarvio"
@ -47,7 +47,7 @@ __url__ = "http://deluge.ufsoft.org/hg/Notification/"
__license__ = "GPLv3"
__description__ = "Plugin which continuously checks for available free space."
__long_description__ = __description__
__pkg_data__ = {__plugin_name__.lower(): ["template/*", "data/*"]}
__pkg_data__ = {"deluge.plugins."+__plugin_name__.lower(): ["template/*", "data/*"]}
setup(
name=__plugin_name__,
@ -59,13 +59,14 @@ setup(
license=__license__,
long_description=__long_description__ if __long_description__ else __description__,
packages=[__plugin_name__.lower()],
packages=find_packages(),
namespace_packages = ["deluge", "deluge.plugins"],
package_data = __pkg_data__,
entry_points="""
[deluge.plugin.core]
%s = %s:CorePlugin
%s = deluge.plugins.%s:CorePlugin
[deluge.plugin.gtkui]
%s = %s:GtkUIPlugin
%s = deluge.plugins.%s:GtkUIPlugin
""" % ((__plugin_name__, __plugin_name__.lower())*2)
)

View file

@ -0,0 +1,3 @@
# this is a namespace package
import pkg_resources
pkg_resources.declare_namespace(__name__)

View file

@ -0,0 +1,3 @@
# this is a namespace package
import pkg_resources
pkg_resources.declare_namespace(__name__)

View file

@ -48,7 +48,8 @@ from deluge import component
log = getPluginLogger(__name__)
def get_resource(filename):
return pkg_resources.resource_filename("label", os.path.join("data", filename))
return pkg_resources.resource_filename("deluge.plugins.label",
os.path.join("data", filename))
class WebUI(WebPluginBase):

View file

@ -31,7 +31,7 @@
#
from setuptools import setup
from setuptools import setup, find_packages
__plugin_name__ = "Label"
__author__ = "Martijn Voncken"
@ -45,7 +45,7 @@ Allows labels to be assigned to torrents
Also offers filters on state, tracker and keywords
"""
__pkg_data__ = {__plugin_name__.lower(): ["template/*", "data/*"]}
__pkg_data__ = {"deluge.plugins."+__plugin_name__.lower(): ["template/*", "data/*"]}
setup(
name=__plugin_name__,
@ -57,15 +57,16 @@ setup(
license=__license__,
long_description=__long_description__,
packages=[__plugin_name__.lower(), "label.gtkui"],
packages=find_packages(),
namespace_packages = ["deluge", "deluge.plugins"],
package_data = __pkg_data__,
entry_points="""
[deluge.plugin.core]
%s = %s:CorePlugin
%s = deluge.plugins.%s:CorePlugin
[deluge.plugin.gtkui]
%s = %s:GtkUIPlugin
%s = deluge.plugins.%s:GtkUIPlugin
[deluge.plugin.web]
%s = %s:WebUIPlugin
%s = deluge.plugins.%s:WebUIPlugin
""" % ((__plugin_name__, __plugin_name__.lower())*3)
)

View file

@ -0,0 +1,11 @@
#!/bin/bash
BASEDIR=$(cd `dirname $0` && pwd)
CONFIG_DIR=$( test -z $1 && echo "" || echo "$1")
[ -d "$CONFIG_DIR/plugins" ] || echo "Config dir "$CONFIG_DIR" is either not a directory or is not a proper deluge config directory. Exiting"
[ -d "$CONFIG_DIR/plugins" ] || exit 1
cd $BASEDIR
test -d $BASEDIR/temp || mkdir $BASEDIR/temp
export PYTHONPATH=$BASEDIR/temp
python setup.py build develop --install-dir $BASEDIR/temp
cp $BASEDIR/temp/*.egg-link $CONFIG_DIR/plugins
rm -fr $BASEDIR/temp

View file

@ -0,0 +1,3 @@
# this is a namespace package
import pkg_resources
pkg_resources.declare_namespace(__name__)

View file

@ -0,0 +1,3 @@
# this is a namespace package
import pkg_resources
pkg_resources.declare_namespace(__name__)

View file

@ -52,7 +52,7 @@ except ImportError:
def get_resource(filename):
import pkg_resources, os
return pkg_resources.resource_filename("notifications",
return pkg_resources.resource_filename("deluge.plugins.notifications",
os.path.join("data", filename))

Some files were not shown because too many files have changed in this diff Show more