Ported "Blocklist", "Example" and "Execute" to the "deluge.plugins" namespace.

This commit is contained in:
Pedro Algarvio 2010-12-09 23:11:20 +00:00
parent f17634ea63
commit 20635773b3
37 changed files with 50 additions and 27 deletions

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 LOG as log
from deluge.ui.client import client
@ -43,6 +42,6 @@ from deluge.plugins.pluginbase import WebPluginBase
from common import get_resource
class WebUI(WebPluginBase):
scripts = [get_resource("execute.js")]
debug_scripts = scripts

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)
)