Ported "Blocklist", "Example" and "Execute" to the "deluge.plugins" namespace.
This commit is contained in:
parent
f17634ea63
commit
20635773b3
|
@ -0,0 +1,3 @@
|
|||
# this is a namespace package
|
||||
import pkg_resources
|
||||
pkg_resources.declare_namespace(__name__)
|
|
@ -0,0 +1,3 @@
|
|||
# this is a namespace package
|
||||
import pkg_resources
|
||||
pkg_resources.declare_namespace(__name__)
|
|
@ -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(".")])
|
Before Width: | Height: | Size: 705 B After Width: | Height: | Size: 705 B |
Before Width: | Height: | Size: 926 B After Width: | Height: | Size: 926 B |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
@ -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)
|
||||
)
|
|
@ -0,0 +1,3 @@
|
|||
# this is a namespace package
|
||||
import pkg_resources
|
||||
pkg_resources.declare_namespace(__name__)
|
|
@ -0,0 +1,3 @@
|
|||
# this is a namespace package
|
||||
import pkg_resources
|
||||
pkg_resources.declare_namespace(__name__)
|
|
@ -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))
|
|
@ -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)
|
||||
)
|
|
@ -0,0 +1,3 @@
|
|||
# this is a namespace package
|
||||
import pkg_resources
|
||||
pkg_resources.declare_namespace(__name__)
|
|
@ -0,0 +1,3 @@
|
|||
# this is a namespace package
|
||||
import pkg_resources
|
||||
pkg_resources.declare_namespace(__name__)
|
|
@ -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))
|
|
@ -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
|
|
@ -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)
|
||||
)
|
Loading…
Reference in New Issue