From 16f617d240df2fbedf80121f25b7b293286e6409 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Thu, 9 Dec 2010 22:05:34 +0000 Subject: [PATCH 01/11] Initial commit to implement the "deluge.plugins" namespace package support. --- deluge/__init__.py | 7 +++++++ deluge/plugins/AutoAdd/deluge/__init__.py | 7 +++++++ deluge/plugins/AutoAdd/deluge/plugins/__init__.py | 7 +++++++ .../deluge/plugins}/autoadd/__init__.py | 0 .../deluge/plugins}/autoadd/common.py | 3 ++- .../deluge/plugins}/autoadd/core.py | 0 .../deluge/plugins}/autoadd/data/autoadd.js | 0 .../plugins}/autoadd/data/autoadd_options.glade | 0 .../deluge/plugins}/autoadd/data/config.glade | 0 .../deluge/plugins}/autoadd/gtkui.py | 0 .../deluge/plugins}/autoadd/webui.py | 0 deluge/plugins/{autoadd => AutoAdd}/setup.py | 14 +++++++------- deluge/plugins/__init__.py | 8 ++++++++ setup.py | 1 + 14 files changed, 39 insertions(+), 8 deletions(-) create mode 100644 deluge/plugins/AutoAdd/deluge/__init__.py create mode 100644 deluge/plugins/AutoAdd/deluge/plugins/__init__.py rename deluge/plugins/{autoadd => AutoAdd/deluge/plugins}/autoadd/__init__.py (100%) rename deluge/plugins/{autoadd => AutoAdd/deluge/plugins}/autoadd/common.py (92%) rename deluge/plugins/{autoadd => AutoAdd/deluge/plugins}/autoadd/core.py (100%) rename deluge/plugins/{autoadd => AutoAdd/deluge/plugins}/autoadd/data/autoadd.js (100%) rename deluge/plugins/{autoadd => AutoAdd/deluge/plugins}/autoadd/data/autoadd_options.glade (100%) rename deluge/plugins/{autoadd => AutoAdd/deluge/plugins}/autoadd/data/config.glade (100%) rename deluge/plugins/{autoadd => AutoAdd/deluge/plugins}/autoadd/gtkui.py (100%) rename deluge/plugins/{autoadd => AutoAdd/deluge/plugins}/autoadd/webui.py (100%) rename deluge/plugins/{autoadd => AutoAdd}/setup.py (87%) diff --git a/deluge/__init__.py b/deluge/__init__.py index 1836ded86..bb62714ce 100644 --- a/deluge/__init__.py +++ b/deluge/__init__.py @@ -1 +1,8 @@ """Deluge""" +# this is a namespace package +try: + import pkg_resources + pkg_resources.declare_namespace(__name__) +except ImportError: + import pkgutil + __path__ = pkgutil.extend_path(__path__, __name__) diff --git a/deluge/plugins/AutoAdd/deluge/__init__.py b/deluge/plugins/AutoAdd/deluge/__init__.py new file mode 100644 index 000000000..2e2033b3c --- /dev/null +++ b/deluge/plugins/AutoAdd/deluge/__init__.py @@ -0,0 +1,7 @@ +# this is a namespace package +try: + import pkg_resources + pkg_resources.declare_namespace(__name__) +except ImportError: + import pkgutil + __path__ = pkgutil.extend_path(__path__, __name__) diff --git a/deluge/plugins/AutoAdd/deluge/plugins/__init__.py b/deluge/plugins/AutoAdd/deluge/plugins/__init__.py new file mode 100644 index 000000000..2e2033b3c --- /dev/null +++ b/deluge/plugins/AutoAdd/deluge/plugins/__init__.py @@ -0,0 +1,7 @@ +# this is a namespace package +try: + import pkg_resources + pkg_resources.declare_namespace(__name__) +except ImportError: + import pkgutil + __path__ = pkgutil.extend_path(__path__, __name__) diff --git a/deluge/plugins/autoadd/autoadd/__init__.py b/deluge/plugins/AutoAdd/deluge/plugins/autoadd/__init__.py similarity index 100% rename from deluge/plugins/autoadd/autoadd/__init__.py rename to deluge/plugins/AutoAdd/deluge/plugins/autoadd/__init__.py diff --git a/deluge/plugins/autoadd/autoadd/common.py b/deluge/plugins/AutoAdd/deluge/plugins/autoadd/common.py similarity index 92% rename from deluge/plugins/autoadd/autoadd/common.py rename to deluge/plugins/AutoAdd/deluge/plugins/autoadd/common.py index 16172a975..cc1b6a01e 100644 --- a/deluge/plugins/autoadd/autoadd/common.py +++ b/deluge/plugins/AutoAdd/deluge/plugins/autoadd/common.py @@ -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)) diff --git a/deluge/plugins/autoadd/autoadd/core.py b/deluge/plugins/AutoAdd/deluge/plugins/autoadd/core.py similarity index 100% rename from deluge/plugins/autoadd/autoadd/core.py rename to deluge/plugins/AutoAdd/deluge/plugins/autoadd/core.py diff --git a/deluge/plugins/autoadd/autoadd/data/autoadd.js b/deluge/plugins/AutoAdd/deluge/plugins/autoadd/data/autoadd.js similarity index 100% rename from deluge/plugins/autoadd/autoadd/data/autoadd.js rename to deluge/plugins/AutoAdd/deluge/plugins/autoadd/data/autoadd.js diff --git a/deluge/plugins/autoadd/autoadd/data/autoadd_options.glade b/deluge/plugins/AutoAdd/deluge/plugins/autoadd/data/autoadd_options.glade similarity index 100% rename from deluge/plugins/autoadd/autoadd/data/autoadd_options.glade rename to deluge/plugins/AutoAdd/deluge/plugins/autoadd/data/autoadd_options.glade diff --git a/deluge/plugins/autoadd/autoadd/data/config.glade b/deluge/plugins/AutoAdd/deluge/plugins/autoadd/data/config.glade similarity index 100% rename from deluge/plugins/autoadd/autoadd/data/config.glade rename to deluge/plugins/AutoAdd/deluge/plugins/autoadd/data/config.glade diff --git a/deluge/plugins/autoadd/autoadd/gtkui.py b/deluge/plugins/AutoAdd/deluge/plugins/autoadd/gtkui.py similarity index 100% rename from deluge/plugins/autoadd/autoadd/gtkui.py rename to deluge/plugins/AutoAdd/deluge/plugins/autoadd/gtkui.py diff --git a/deluge/plugins/autoadd/autoadd/webui.py b/deluge/plugins/AutoAdd/deluge/plugins/autoadd/webui.py similarity index 100% rename from deluge/plugins/autoadd/autoadd/webui.py rename to deluge/plugins/AutoAdd/deluge/plugins/autoadd/webui.py diff --git a/deluge/plugins/autoadd/setup.py b/deluge/plugins/AutoAdd/setup.py similarity index 87% rename from deluge/plugins/autoadd/setup.py rename to deluge/plugins/AutoAdd/setup.py index 11c0e1158..7763a9270 100644 --- a/deluge/plugins/autoadd/setup.py +++ b/deluge/plugins/AutoAdd/setup.py @@ -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__ = "AutoAdd" __author__ = "Chase Sterling" @@ -47,7 +47,7 @@ __url__ = "http://forum.deluge-torrent.org/viewtopic.php?f=9&t=26775" __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__, @@ -58,16 +58,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) ) diff --git a/deluge/plugins/__init__.py b/deluge/plugins/__init__.py index e69de29bb..bf99a9da0 100644 --- a/deluge/plugins/__init__.py +++ b/deluge/plugins/__init__.py @@ -0,0 +1,8 @@ +# this is a namespace package +try: + import pkg_resources + pkg_resources.declare_namespace(__name__) +except ImportError: + import pkgutil + __path__ = pkgutil.extend_path(__path__, __name__) + diff --git a/setup.py b/setup.py index 6f9c60aac..c9b5234ee 100644 --- a/setup.py +++ b/setup.py @@ -485,5 +485,6 @@ setup( "ui/web/themes/images/*/*/*.png" ]}, packages = find_packages(exclude=["plugins", "docs", "tests"]), + namespace_packages = ["deluge", "deluge.plugins"], entry_points = entry_points ) From f17634ea638853bc7405f8c104edcb03fa0ac413 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Thu, 9 Dec 2010 22:18:59 +0000 Subject: [PATCH 02/11] Drop pkutil and simply use pkg_resources. --- deluge/__init__.py | 8 ++------ deluge/plugins/AutoAdd/deluge/__init__.py | 8 ++------ deluge/plugins/AutoAdd/deluge/plugins/__init__.py | 8 ++------ deluge/plugins/__init__.py | 9 ++------- 4 files changed, 8 insertions(+), 25 deletions(-) diff --git a/deluge/__init__.py b/deluge/__init__.py index bb62714ce..fe92cd136 100644 --- a/deluge/__init__.py +++ b/deluge/__init__.py @@ -1,8 +1,4 @@ """Deluge""" # this is a namespace package -try: - import pkg_resources - pkg_resources.declare_namespace(__name__) -except ImportError: - import pkgutil - __path__ = pkgutil.extend_path(__path__, __name__) +import pkg_resources +pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/AutoAdd/deluge/__init__.py b/deluge/plugins/AutoAdd/deluge/__init__.py index 2e2033b3c..94033e829 100644 --- a/deluge/plugins/AutoAdd/deluge/__init__.py +++ b/deluge/plugins/AutoAdd/deluge/__init__.py @@ -1,7 +1,3 @@ # this is a namespace package -try: - import pkg_resources - pkg_resources.declare_namespace(__name__) -except ImportError: - import pkgutil - __path__ = pkgutil.extend_path(__path__, __name__) +import pkg_resources +pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/AutoAdd/deluge/plugins/__init__.py b/deluge/plugins/AutoAdd/deluge/plugins/__init__.py index 2e2033b3c..94033e829 100644 --- a/deluge/plugins/AutoAdd/deluge/plugins/__init__.py +++ b/deluge/plugins/AutoAdd/deluge/plugins/__init__.py @@ -1,7 +1,3 @@ # this is a namespace package -try: - import pkg_resources - pkg_resources.declare_namespace(__name__) -except ImportError: - import pkgutil - __path__ = pkgutil.extend_path(__path__, __name__) +import pkg_resources +pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/__init__.py b/deluge/plugins/__init__.py index bf99a9da0..94033e829 100644 --- a/deluge/plugins/__init__.py +++ b/deluge/plugins/__init__.py @@ -1,8 +1,3 @@ # this is a namespace package -try: - import pkg_resources - pkg_resources.declare_namespace(__name__) -except ImportError: - import pkgutil - __path__ = pkgutil.extend_path(__path__, __name__) - +import pkg_resources +pkg_resources.declare_namespace(__name__) From 20635773b30f62897bf723549b1942d05f03eb48 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Thu, 9 Dec 2010 23:11:20 +0000 Subject: [PATCH 03/11] Ported "Blocklist", "Example" and "Execute" to the "deluge.plugins" namespace. --- deluge/plugins/Blocklist/deluge/__init__.py | 3 +++ .../plugins/Blocklist/deluge/plugins/__init__.py | 3 +++ .../deluge/plugins}/blocklist/__init__.py | 0 .../deluge/plugins}/blocklist/common.py | 11 ++++++----- .../deluge/plugins}/blocklist/core.py | 0 .../deluge/plugins}/blocklist/data/COPYING | 0 .../deluge/plugins}/blocklist/data/LICENSE | 0 .../deluge/plugins}/blocklist/data/blocklist16.png | Bin .../blocklist/data/blocklist_download24.png | Bin .../plugins}/blocklist/data/blocklist_import24.png | Bin .../plugins}/blocklist/data/blocklist_pref.glade | 0 .../deluge/plugins}/blocklist/decompressers.py | 0 .../deluge/plugins}/blocklist/detect.py | 0 .../deluge/plugins}/blocklist/gtkui.py | 0 .../deluge/plugins}/blocklist/peerguardian.py | 0 .../deluge/plugins}/blocklist/readers.py | 0 .../deluge/plugins}/blocklist/webui.py | 0 deluge/plugins/{blocklist => Blocklist}/setup.py | 13 +++++++------ deluge/plugins/Example/deluge/__init__.py | 3 +++ deluge/plugins/Example/deluge/plugins/__init__.py | 3 +++ .../deluge/plugins}/example/__init__.py | 0 .../deluge/plugins/example}/common.py | 3 ++- .../deluge/plugins}/example/core.py | 0 .../deluge/plugins}/example/data/example.js | 0 .../deluge/plugins}/example/gtkui.py | 0 .../deluge/plugins}/example/webui.py | 0 deluge/plugins/{example => Example}/setup.py | 13 +++++++------ deluge/plugins/Execute/deluge/__init__.py | 3 +++ deluge/plugins/Execute/deluge/plugins/__init__.py | 3 +++ .../deluge/plugins}/execute/__init__.py | 0 .../deluge/plugins/execute}/common.py | 3 ++- .../deluge/plugins}/execute/core.py | 0 .../deluge/plugins}/execute/data/execute.js | 0 .../plugins}/execute/data/execute_prefs.glade | 0 .../deluge/plugins}/execute/gtkui.py | 0 .../deluge/plugins}/execute/webui.py | 3 +-- deluge/plugins/{execute => Execute}/setup.py | 13 +++++++------ 37 files changed, 50 insertions(+), 27 deletions(-) create mode 100644 deluge/plugins/Blocklist/deluge/__init__.py create mode 100644 deluge/plugins/Blocklist/deluge/plugins/__init__.py rename deluge/plugins/{blocklist => Blocklist/deluge/plugins}/blocklist/__init__.py (100%) rename deluge/plugins/{blocklist => Blocklist/deluge/plugins}/blocklist/common.py (94%) rename deluge/plugins/{blocklist => Blocklist/deluge/plugins}/blocklist/core.py (100%) rename deluge/plugins/{blocklist => Blocklist/deluge/plugins}/blocklist/data/COPYING (100%) rename deluge/plugins/{blocklist => Blocklist/deluge/plugins}/blocklist/data/LICENSE (100%) rename deluge/plugins/{blocklist => Blocklist/deluge/plugins}/blocklist/data/blocklist16.png (100%) rename deluge/plugins/{blocklist => Blocklist/deluge/plugins}/blocklist/data/blocklist_download24.png (100%) rename deluge/plugins/{blocklist => Blocklist/deluge/plugins}/blocklist/data/blocklist_import24.png (100%) rename deluge/plugins/{blocklist => Blocklist/deluge/plugins}/blocklist/data/blocklist_pref.glade (100%) rename deluge/plugins/{blocklist => Blocklist/deluge/plugins}/blocklist/decompressers.py (100%) rename deluge/plugins/{blocklist => Blocklist/deluge/plugins}/blocklist/detect.py (100%) rename deluge/plugins/{blocklist => Blocklist/deluge/plugins}/blocklist/gtkui.py (100%) rename deluge/plugins/{blocklist => Blocklist/deluge/plugins}/blocklist/peerguardian.py (100%) rename deluge/plugins/{blocklist => Blocklist/deluge/plugins}/blocklist/readers.py (100%) rename deluge/plugins/{blocklist => Blocklist/deluge/plugins}/blocklist/webui.py (100%) rename deluge/plugins/{blocklist => Blocklist}/setup.py (87%) create mode 100644 deluge/plugins/Example/deluge/__init__.py create mode 100644 deluge/plugins/Example/deluge/plugins/__init__.py rename deluge/plugins/{example => Example/deluge/plugins}/example/__init__.py (100%) rename deluge/plugins/{execute/execute => Example/deluge/plugins/example}/common.py (91%) rename deluge/plugins/{example => Example/deluge/plugins}/example/core.py (100%) rename deluge/plugins/{example => Example/deluge/plugins}/example/data/example.js (100%) rename deluge/plugins/{example => Example/deluge/plugins}/example/gtkui.py (100%) rename deluge/plugins/{example => Example/deluge/plugins}/example/webui.py (100%) rename deluge/plugins/{example => Example}/setup.py (87%) create mode 100644 deluge/plugins/Execute/deluge/__init__.py create mode 100644 deluge/plugins/Execute/deluge/plugins/__init__.py rename deluge/plugins/{execute => Execute/deluge/plugins}/execute/__init__.py (100%) rename deluge/plugins/{example/example => Execute/deluge/plugins/execute}/common.py (91%) rename deluge/plugins/{execute => Execute/deluge/plugins}/execute/core.py (100%) rename deluge/plugins/{execute => Execute/deluge/plugins}/execute/data/execute.js (100%) rename deluge/plugins/{execute => Execute/deluge/plugins}/execute/data/execute_prefs.glade (100%) rename deluge/plugins/{execute => Execute/deluge/plugins}/execute/gtkui.py (100%) rename deluge/plugins/{execute => Execute/deluge/plugins}/execute/webui.py (98%) rename deluge/plugins/{execute => Execute}/setup.py (87%) diff --git a/deluge/plugins/Blocklist/deluge/__init__.py b/deluge/plugins/Blocklist/deluge/__init__.py new file mode 100644 index 000000000..94033e829 --- /dev/null +++ b/deluge/plugins/Blocklist/deluge/__init__.py @@ -0,0 +1,3 @@ +# this is a namespace package +import pkg_resources +pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/Blocklist/deluge/plugins/__init__.py b/deluge/plugins/Blocklist/deluge/plugins/__init__.py new file mode 100644 index 000000000..94033e829 --- /dev/null +++ b/deluge/plugins/Blocklist/deluge/plugins/__init__.py @@ -0,0 +1,3 @@ +# this is a namespace package +import pkg_resources +pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/blocklist/blocklist/__init__.py b/deluge/plugins/Blocklist/deluge/plugins/blocklist/__init__.py similarity index 100% rename from deluge/plugins/blocklist/blocklist/__init__.py rename to deluge/plugins/Blocklist/deluge/plugins/blocklist/__init__.py diff --git a/deluge/plugins/blocklist/blocklist/common.py b/deluge/plugins/Blocklist/deluge/plugins/blocklist/common.py similarity index 94% rename from deluge/plugins/blocklist/blocklist/common.py rename to deluge/plugins/Blocklist/deluge/plugins/blocklist/common.py index c2076acae..147f77d5e 100644 --- a/deluge/plugins/blocklist/blocklist/common.py +++ b/deluge/plugins/Blocklist/deluge/plugins/blocklist/common.py @@ -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(".")]) diff --git a/deluge/plugins/blocklist/blocklist/core.py b/deluge/plugins/Blocklist/deluge/plugins/blocklist/core.py similarity index 100% rename from deluge/plugins/blocklist/blocklist/core.py rename to deluge/plugins/Blocklist/deluge/plugins/blocklist/core.py diff --git a/deluge/plugins/blocklist/blocklist/data/COPYING b/deluge/plugins/Blocklist/deluge/plugins/blocklist/data/COPYING similarity index 100% rename from deluge/plugins/blocklist/blocklist/data/COPYING rename to deluge/plugins/Blocklist/deluge/plugins/blocklist/data/COPYING diff --git a/deluge/plugins/blocklist/blocklist/data/LICENSE b/deluge/plugins/Blocklist/deluge/plugins/blocklist/data/LICENSE similarity index 100% rename from deluge/plugins/blocklist/blocklist/data/LICENSE rename to deluge/plugins/Blocklist/deluge/plugins/blocklist/data/LICENSE diff --git a/deluge/plugins/blocklist/blocklist/data/blocklist16.png b/deluge/plugins/Blocklist/deluge/plugins/blocklist/data/blocklist16.png similarity index 100% rename from deluge/plugins/blocklist/blocklist/data/blocklist16.png rename to deluge/plugins/Blocklist/deluge/plugins/blocklist/data/blocklist16.png diff --git a/deluge/plugins/blocklist/blocklist/data/blocklist_download24.png b/deluge/plugins/Blocklist/deluge/plugins/blocklist/data/blocklist_download24.png similarity index 100% rename from deluge/plugins/blocklist/blocklist/data/blocklist_download24.png rename to deluge/plugins/Blocklist/deluge/plugins/blocklist/data/blocklist_download24.png diff --git a/deluge/plugins/blocklist/blocklist/data/blocklist_import24.png b/deluge/plugins/Blocklist/deluge/plugins/blocklist/data/blocklist_import24.png similarity index 100% rename from deluge/plugins/blocklist/blocklist/data/blocklist_import24.png rename to deluge/plugins/Blocklist/deluge/plugins/blocklist/data/blocklist_import24.png diff --git a/deluge/plugins/blocklist/blocklist/data/blocklist_pref.glade b/deluge/plugins/Blocklist/deluge/plugins/blocklist/data/blocklist_pref.glade similarity index 100% rename from deluge/plugins/blocklist/blocklist/data/blocklist_pref.glade rename to deluge/plugins/Blocklist/deluge/plugins/blocklist/data/blocklist_pref.glade diff --git a/deluge/plugins/blocklist/blocklist/decompressers.py b/deluge/plugins/Blocklist/deluge/plugins/blocklist/decompressers.py similarity index 100% rename from deluge/plugins/blocklist/blocklist/decompressers.py rename to deluge/plugins/Blocklist/deluge/plugins/blocklist/decompressers.py diff --git a/deluge/plugins/blocklist/blocklist/detect.py b/deluge/plugins/Blocklist/deluge/plugins/blocklist/detect.py similarity index 100% rename from deluge/plugins/blocklist/blocklist/detect.py rename to deluge/plugins/Blocklist/deluge/plugins/blocklist/detect.py diff --git a/deluge/plugins/blocklist/blocklist/gtkui.py b/deluge/plugins/Blocklist/deluge/plugins/blocklist/gtkui.py similarity index 100% rename from deluge/plugins/blocklist/blocklist/gtkui.py rename to deluge/plugins/Blocklist/deluge/plugins/blocklist/gtkui.py diff --git a/deluge/plugins/blocklist/blocklist/peerguardian.py b/deluge/plugins/Blocklist/deluge/plugins/blocklist/peerguardian.py similarity index 100% rename from deluge/plugins/blocklist/blocklist/peerguardian.py rename to deluge/plugins/Blocklist/deluge/plugins/blocklist/peerguardian.py diff --git a/deluge/plugins/blocklist/blocklist/readers.py b/deluge/plugins/Blocklist/deluge/plugins/blocklist/readers.py similarity index 100% rename from deluge/plugins/blocklist/blocklist/readers.py rename to deluge/plugins/Blocklist/deluge/plugins/blocklist/readers.py diff --git a/deluge/plugins/blocklist/blocklist/webui.py b/deluge/plugins/Blocklist/deluge/plugins/blocklist/webui.py similarity index 100% rename from deluge/plugins/blocklist/blocklist/webui.py rename to deluge/plugins/Blocklist/deluge/plugins/blocklist/webui.py diff --git a/deluge/plugins/blocklist/setup.py b/deluge/plugins/Blocklist/setup.py similarity index 87% rename from deluge/plugins/blocklist/setup.py rename to deluge/plugins/Blocklist/setup.py index f690278a6..ee44297f4 100644 --- a/deluge/plugins/blocklist/setup.py +++ b/deluge/plugins/Blocklist/setup.py @@ -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) ) diff --git a/deluge/plugins/Example/deluge/__init__.py b/deluge/plugins/Example/deluge/__init__.py new file mode 100644 index 000000000..94033e829 --- /dev/null +++ b/deluge/plugins/Example/deluge/__init__.py @@ -0,0 +1,3 @@ +# this is a namespace package +import pkg_resources +pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/Example/deluge/plugins/__init__.py b/deluge/plugins/Example/deluge/plugins/__init__.py new file mode 100644 index 000000000..94033e829 --- /dev/null +++ b/deluge/plugins/Example/deluge/plugins/__init__.py @@ -0,0 +1,3 @@ +# this is a namespace package +import pkg_resources +pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/example/example/__init__.py b/deluge/plugins/Example/deluge/plugins/example/__init__.py similarity index 100% rename from deluge/plugins/example/example/__init__.py rename to deluge/plugins/Example/deluge/plugins/example/__init__.py diff --git a/deluge/plugins/execute/execute/common.py b/deluge/plugins/Example/deluge/plugins/example/common.py similarity index 91% rename from deluge/plugins/execute/execute/common.py rename to deluge/plugins/Example/deluge/plugins/example/common.py index b3e3ad59c..72e3750c6 100644 --- a/deluge/plugins/execute/execute/common.py +++ b/deluge/plugins/Example/deluge/plugins/example/common.py @@ -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)) diff --git a/deluge/plugins/example/example/core.py b/deluge/plugins/Example/deluge/plugins/example/core.py similarity index 100% rename from deluge/plugins/example/example/core.py rename to deluge/plugins/Example/deluge/plugins/example/core.py diff --git a/deluge/plugins/example/example/data/example.js b/deluge/plugins/Example/deluge/plugins/example/data/example.js similarity index 100% rename from deluge/plugins/example/example/data/example.js rename to deluge/plugins/Example/deluge/plugins/example/data/example.js diff --git a/deluge/plugins/example/example/gtkui.py b/deluge/plugins/Example/deluge/plugins/example/gtkui.py similarity index 100% rename from deluge/plugins/example/example/gtkui.py rename to deluge/plugins/Example/deluge/plugins/example/gtkui.py diff --git a/deluge/plugins/example/example/webui.py b/deluge/plugins/Example/deluge/plugins/example/webui.py similarity index 100% rename from deluge/plugins/example/example/webui.py rename to deluge/plugins/Example/deluge/plugins/example/webui.py diff --git a/deluge/plugins/example/setup.py b/deluge/plugins/Example/setup.py similarity index 87% rename from deluge/plugins/example/setup.py rename to deluge/plugins/Example/setup.py index c666efc18..59f8582fa 100644 --- a/deluge/plugins/example/setup.py +++ b/deluge/plugins/Example/setup.py @@ -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) ) diff --git a/deluge/plugins/Execute/deluge/__init__.py b/deluge/plugins/Execute/deluge/__init__.py new file mode 100644 index 000000000..94033e829 --- /dev/null +++ b/deluge/plugins/Execute/deluge/__init__.py @@ -0,0 +1,3 @@ +# this is a namespace package +import pkg_resources +pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/Execute/deluge/plugins/__init__.py b/deluge/plugins/Execute/deluge/plugins/__init__.py new file mode 100644 index 000000000..94033e829 --- /dev/null +++ b/deluge/plugins/Execute/deluge/plugins/__init__.py @@ -0,0 +1,3 @@ +# this is a namespace package +import pkg_resources +pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/execute/execute/__init__.py b/deluge/plugins/Execute/deluge/plugins/execute/__init__.py similarity index 100% rename from deluge/plugins/execute/execute/__init__.py rename to deluge/plugins/Execute/deluge/plugins/execute/__init__.py diff --git a/deluge/plugins/example/example/common.py b/deluge/plugins/Execute/deluge/plugins/execute/common.py similarity index 91% rename from deluge/plugins/example/example/common.py rename to deluge/plugins/Execute/deluge/plugins/execute/common.py index 71701676d..d0d33799c 100644 --- a/deluge/plugins/example/example/common.py +++ b/deluge/plugins/Execute/deluge/plugins/execute/common.py @@ -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)) diff --git a/deluge/plugins/execute/execute/core.py b/deluge/plugins/Execute/deluge/plugins/execute/core.py similarity index 100% rename from deluge/plugins/execute/execute/core.py rename to deluge/plugins/Execute/deluge/plugins/execute/core.py diff --git a/deluge/plugins/execute/execute/data/execute.js b/deluge/plugins/Execute/deluge/plugins/execute/data/execute.js similarity index 100% rename from deluge/plugins/execute/execute/data/execute.js rename to deluge/plugins/Execute/deluge/plugins/execute/data/execute.js diff --git a/deluge/plugins/execute/execute/data/execute_prefs.glade b/deluge/plugins/Execute/deluge/plugins/execute/data/execute_prefs.glade similarity index 100% rename from deluge/plugins/execute/execute/data/execute_prefs.glade rename to deluge/plugins/Execute/deluge/plugins/execute/data/execute_prefs.glade diff --git a/deluge/plugins/execute/execute/gtkui.py b/deluge/plugins/Execute/deluge/plugins/execute/gtkui.py similarity index 100% rename from deluge/plugins/execute/execute/gtkui.py rename to deluge/plugins/Execute/deluge/plugins/execute/gtkui.py diff --git a/deluge/plugins/execute/execute/webui.py b/deluge/plugins/Execute/deluge/plugins/execute/webui.py similarity index 98% rename from deluge/plugins/execute/execute/webui.py rename to deluge/plugins/Execute/deluge/plugins/execute/webui.py index 991219b04..7bdb6d198 100644 --- a/deluge/plugins/execute/execute/webui.py +++ b/deluge/plugins/Execute/deluge/plugins/execute/webui.py @@ -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 diff --git a/deluge/plugins/execute/setup.py b/deluge/plugins/Execute/setup.py similarity index 87% rename from deluge/plugins/execute/setup.py rename to deluge/plugins/Execute/setup.py index 2938e1757..ab93b6b4b 100644 --- a/deluge/plugins/execute/setup.py +++ b/deluge/plugins/Execute/setup.py @@ -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) ) From b0d77a4f2032848cdfa321a1c0b36f13f76e0937 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Fri, 10 Dec 2010 00:35:51 +0000 Subject: [PATCH 04/11] Ported the Extractor plugin to the plugins namespace. --- deluge/plugins/Extractor/deluge/__init__.py | 3 +++ deluge/plugins/Extractor/deluge/plugins/__init__.py | 3 +++ .../deluge/plugins}/extractor/__init__.py | 0 .../deluge/plugins}/extractor/common.py | 3 ++- .../deluge/plugins}/extractor/core.py | 0 .../plugins}/extractor/data/extractor_prefs.glade | 0 .../deluge/plugins}/extractor/gtkui.py | 0 .../deluge/plugins}/extractor/webui.py | 0 deluge/plugins/{extractor => Extractor}/setup.py | 13 +++++++------ 9 files changed, 15 insertions(+), 7 deletions(-) create mode 100644 deluge/plugins/Extractor/deluge/__init__.py create mode 100644 deluge/plugins/Extractor/deluge/plugins/__init__.py rename deluge/plugins/{extractor => Extractor/deluge/plugins}/extractor/__init__.py (100%) rename deluge/plugins/{extractor => Extractor/deluge/plugins}/extractor/common.py (90%) rename deluge/plugins/{extractor => Extractor/deluge/plugins}/extractor/core.py (100%) rename deluge/plugins/{extractor => Extractor/deluge/plugins}/extractor/data/extractor_prefs.glade (100%) rename deluge/plugins/{extractor => Extractor/deluge/plugins}/extractor/gtkui.py (100%) rename deluge/plugins/{extractor => Extractor/deluge/plugins}/extractor/webui.py (100%) rename deluge/plugins/{extractor => Extractor}/setup.py (87%) diff --git a/deluge/plugins/Extractor/deluge/__init__.py b/deluge/plugins/Extractor/deluge/__init__.py new file mode 100644 index 000000000..94033e829 --- /dev/null +++ b/deluge/plugins/Extractor/deluge/__init__.py @@ -0,0 +1,3 @@ +# this is a namespace package +import pkg_resources +pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/Extractor/deluge/plugins/__init__.py b/deluge/plugins/Extractor/deluge/plugins/__init__.py new file mode 100644 index 000000000..94033e829 --- /dev/null +++ b/deluge/plugins/Extractor/deluge/plugins/__init__.py @@ -0,0 +1,3 @@ +# this is a namespace package +import pkg_resources +pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/extractor/extractor/__init__.py b/deluge/plugins/Extractor/deluge/plugins/extractor/__init__.py similarity index 100% rename from deluge/plugins/extractor/extractor/__init__.py rename to deluge/plugins/Extractor/deluge/plugins/extractor/__init__.py diff --git a/deluge/plugins/extractor/extractor/common.py b/deluge/plugins/Extractor/deluge/plugins/extractor/common.py similarity index 90% rename from deluge/plugins/extractor/extractor/common.py rename to deluge/plugins/Extractor/deluge/plugins/extractor/common.py index 66175e894..0517f41db 100644 --- a/deluge/plugins/extractor/extractor/common.py +++ b/deluge/plugins/Extractor/deluge/plugins/extractor/common.py @@ -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)) diff --git a/deluge/plugins/extractor/extractor/core.py b/deluge/plugins/Extractor/deluge/plugins/extractor/core.py similarity index 100% rename from deluge/plugins/extractor/extractor/core.py rename to deluge/plugins/Extractor/deluge/plugins/extractor/core.py diff --git a/deluge/plugins/extractor/extractor/data/extractor_prefs.glade b/deluge/plugins/Extractor/deluge/plugins/extractor/data/extractor_prefs.glade similarity index 100% rename from deluge/plugins/extractor/extractor/data/extractor_prefs.glade rename to deluge/plugins/Extractor/deluge/plugins/extractor/data/extractor_prefs.glade diff --git a/deluge/plugins/extractor/extractor/gtkui.py b/deluge/plugins/Extractor/deluge/plugins/extractor/gtkui.py similarity index 100% rename from deluge/plugins/extractor/extractor/gtkui.py rename to deluge/plugins/Extractor/deluge/plugins/extractor/gtkui.py diff --git a/deluge/plugins/extractor/extractor/webui.py b/deluge/plugins/Extractor/deluge/plugins/extractor/webui.py similarity index 100% rename from deluge/plugins/extractor/extractor/webui.py rename to deluge/plugins/Extractor/deluge/plugins/extractor/webui.py diff --git a/deluge/plugins/extractor/setup.py b/deluge/plugins/Extractor/setup.py similarity index 87% rename from deluge/plugins/extractor/setup.py rename to deluge/plugins/Extractor/setup.py index 7f3afe9b4..135d698d7 100644 --- a/deluge/plugins/extractor/setup.py +++ b/deluge/plugins/Extractor/setup.py @@ -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) ) From 1c2eb0c737229f0abda312dfe521d9a262bf4743 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Fri, 10 Dec 2010 03:15:36 +0000 Subject: [PATCH 05/11] Improve and port the `create_plugin.py` script to generate the plugins under the "deluge.plugins" namespace. Any plugin not using the "deluge.plugins" namespace will get a `DeprecationWarning` printed on the console. --- deluge/pluginmanagerbase.py | 17 ++++++ deluge/scripts/create_plugin.py | 95 ++++++++++++++++++++------------- 2 files changed, 75 insertions(+), 37 deletions(-) diff --git a/deluge/pluginmanagerbase.py b/deluge/pluginmanagerbase.py index 4256a46c4..f4707af7d 100644 --- a/deluge/pluginmanagerbase.py +++ b/deluge/pluginmanagerbase.py @@ -58,6 +58,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""" @@ -139,6 +149,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("-", " ") diff --git a/deluge/scripts/create_plugin.py b/deluge/scripts/create_plugin.py index d195fbccf..8ce6da1f5 100644 --- a/deluge/scripts/create_plugin.py +++ b/deluge/scripts/create_plugin.py @@ -12,6 +12,7 @@ import os import deluge.common parser = OptionParser() parser.add_option("-n", "--name", dest="name",help="plugin name") +parser.add_option("-m", "--module-name", dest="module",help="plugin name") parser.add_option("-p", "--basepath", dest="path",help="base path") parser.add_option("-a", "--author-name", dest="author_name",help="author name,for the GPL header") parser.add_option("-e", "--author-email", dest="author_email",help="author email,for the GPL header") @@ -46,41 +47,53 @@ def create_plugin(): if not options.configdir: options.configdir = deluge.common.get_default_config_dir() - name = options.name.replace(" ", "_") + options.configdir = os.path.realpath(options.configdir) + + real_name = options.name + name = real_name.replace(" ", "_") safe_name = name.lower() - plugin_base = os.path.realpath(os.path.join(options.path, safe_name)) - src = os.path.join(plugin_base, safe_name) + if options.module: + safe_name = options.module.lower() + plugin_base = os.path.realpath(os.path.join(options.path, name)) + deluge_namespace = os.path.join(plugin_base, "deluge") + plugins_namespace = os.path.join(deluge_namespace, "plugins") + src = os.path.join(plugins_namespace, safe_name) data_dir = os.path.join(src, "data") if os.path.exists(plugin_base): print "the directory %s already exists, delete it first" % plugin_base return - def write_file(path, filename, template): - args = {"author_name":options.author_name, - "author_email":options.author_email , - "name":name, - "safe_name":safe_name, - "filename":filename, - "plugin_base":plugin_base, - "url": options.url, - "configdir": options.configdir + def write_file(path, filename, template, include_gpl=True): + args = { + "author_name": options.author_name, + "author_email": options.author_email, + "name": name, + "safe_name": safe_name, + "filename": filename, + "plugin_base": plugin_base, + "url": options.url, + "configdir": options.configdir } filename = os.path.join(path, filename) f = open(filename,"w") - if filename.endswith(".py"): + if filename.endswith(".py") and include_gpl: f.write(GPL % args) f.write(template % args) f.close() print "creating folders.." os.mkdir(plugin_base) + os.mkdir(deluge_namespace) + os.mkdir(plugins_namespace) os.mkdir(src) os.mkdir(data_dir) print "creating files.." write_file(plugin_base,"setup.py", SETUP) + write_file(deluge_namespace, "__init__.py", NAMESPACE_INIT, False) + write_file(plugins_namespace, "__init__.py", NAMESPACE_INIT, False) write_file(src,"__init__.py", INIT) write_file(src,"gtkui.py", GTKUI) write_file(src,"webui.py", WEBUI) @@ -92,7 +105,7 @@ def create_plugin(): #add an input parameter for this? print "building dev-link.." write_file(plugin_base,"create_dev_link.sh", CREATE_DEV_LINK) - dev_link_path = os.path.realpath(os.path.join(plugin_base, "create_dev_link.sh")) + dev_link_path = os.path.join(plugin_base, "create_dev_link.sh") os.system("chmod +x %s" % dev_link_path) #lazy.. os.system(dev_link_path) @@ -155,7 +168,7 @@ class WebUIPlugin(PluginInitBase): SETUP = """ -from setuptools import setup +from setuptools import setup, find_packages __plugin_name__ = "%(name)s" __author__ = "%(author_name)s" @@ -165,7 +178,7 @@ __url__ = "%(url)s" __license__ = "GPLv3" __description__ = "" __long_description__ = \"\"\"\"\"\" -__pkg_data__ = {__plugin_name__.lower(): ["template/*", "data/*"]} +__pkg_data__ = {"deluge.plugins."+__plugin_name__.lower(): ["template/*", "data/*"]} setup( name=__plugin_name__, @@ -177,16 +190,17 @@ 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 [deluge.plugin.web] - %%s = %%s:WebUIPlugin + %%s = deluge.plugins.%%s:WebUIPlugin \"\"\" %% ((__plugin_name__, __plugin_name__.lower())*3) ) """ @@ -194,7 +208,8 @@ setup( COMMON = """ def get_resource(filename): import pkg_resources, os - return pkg_resources.resource_filename("%(safe_name)s", os.path.join("data", filename)) + return pkg_resources.resource_filename("deluge.plugins.%(safe_name)s", + os.path.join("data", filename)) """ GTKUI = """ @@ -318,20 +333,20 @@ Copyright: */ %(name)sPlugin = Ext.extend(Deluge.Plugin, { - constructor: function(config) { - config = Ext.apply({ - name: "%(name)s" - }, config); - %(name)sPlugin.superclass.constructor.call(this, config); - }, + constructor: function(config) { + config = Ext.apply({ + name: "%(name)s" + }, config); + %(name)sPlugin.superclass.constructor.call(this, config); + }, - onDisable: function() { + onDisable: function() { - }, + }, - onEnable: function() { + onEnable: function() { - } + } }); new %(name)sPlugin(); """ @@ -376,13 +391,19 @@ GPL = """# # """ +NAMESPACE_INIT="""# this is a namespace package +import pkg_resources +pkg_resources.declare_namespace(__name__) +""" + CREATE_DEV_LINK = """#!/bin/bash -cd %(plugin_base)s -mkdir temp -export PYTHONPATH=./temp -python setup.py build develop --install-dir ./temp -cp ./temp/%(name)s.egg-link %(configdir)s/plugins -rm -fr ./temp +BASEDIR=$(cd `dirname $0` && pwd) +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 %(configdir)s/plugins +rm -fr $BASEDIR/temp """ create_plugin() From e43146a4ac313e44d6443e43579a765b25e25973 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Fri, 10 Dec 2010 03:25:39 +0000 Subject: [PATCH 06/11] Simplify some code on `create_plugin.py`. --- deluge/scripts/create_plugin.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/deluge/scripts/create_plugin.py b/deluge/scripts/create_plugin.py index 8ce6da1f5..0087c33fd 100644 --- a/deluge/scripts/create_plugin.py +++ b/deluge/scripts/create_plugin.py @@ -196,12 +196,12 @@ setup( entry_points=\"\"\" [deluge.plugin.core] - %%s = deluge.plugins.%%s:CorePlugin + %%(plugin_name)s = deluge.plugins.%%(plugin_module)s:CorePlugin [deluge.plugin.gtkui] - %%s = deluge.plugins.%%s:GtkUIPlugin + %%(plugin_name)s = deluge.plugins.%%(plugin_module)s:GtkUIPlugin [deluge.plugin.web] - %%s = deluge.plugins.%%s:WebUIPlugin - \"\"\" %% ((__plugin_name__, __plugin_name__.lower())*3) + %%(plugin_name)s = deluge.plugins.%%(plugin_module)s:WebUIPlugin + \"\"\" %% dict(plugin_name=__plugin_name__, plugin_module=__plugin_name__.lower()) ) """ From c9e4d286c38646df7143ad0c72f8b24339c2b5a1 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Fri, 10 Dec 2010 03:29:36 +0000 Subject: [PATCH 07/11] Ported the FreeSpace plugin to the deluge.plugins namespace. --- .../{freespace => FreeSpace}/create_dev_link.sh | 0 deluge/plugins/FreeSpace/deluge/__init__.py | 3 +++ deluge/plugins/FreeSpace/deluge/plugins/__init__.py | 3 +++ .../deluge/plugins}/freespace/__init__.py | 0 .../deluge/plugins}/freespace/common.py | 3 ++- .../deluge/plugins}/freespace/core.py | 0 .../deluge/plugins}/freespace/data/config.glade | 0 .../deluge/plugins}/freespace/data/freespace.js | 0 .../deluge/plugins}/freespace/gtkui.py | 0 .../deluge/plugins}/freespace/webui.py | 0 deluge/plugins/{freespace => FreeSpace}/setup.py | 11 ++++++----- 11 files changed, 14 insertions(+), 6 deletions(-) rename deluge/plugins/{freespace => FreeSpace}/create_dev_link.sh (100%) create mode 100644 deluge/plugins/FreeSpace/deluge/__init__.py create mode 100644 deluge/plugins/FreeSpace/deluge/plugins/__init__.py rename deluge/plugins/{freespace => FreeSpace/deluge/plugins}/freespace/__init__.py (100%) rename deluge/plugins/{freespace => FreeSpace/deluge/plugins}/freespace/common.py (91%) rename deluge/plugins/{freespace => FreeSpace/deluge/plugins}/freespace/core.py (100%) rename deluge/plugins/{freespace => FreeSpace/deluge/plugins}/freespace/data/config.glade (100%) rename deluge/plugins/{freespace => FreeSpace/deluge/plugins}/freespace/data/freespace.js (100%) rename deluge/plugins/{freespace => FreeSpace/deluge/plugins}/freespace/gtkui.py (100%) rename deluge/plugins/{freespace => FreeSpace/deluge/plugins}/freespace/webui.py (100%) rename deluge/plugins/{freespace => FreeSpace}/setup.py (89%) diff --git a/deluge/plugins/freespace/create_dev_link.sh b/deluge/plugins/FreeSpace/create_dev_link.sh similarity index 100% rename from deluge/plugins/freespace/create_dev_link.sh rename to deluge/plugins/FreeSpace/create_dev_link.sh diff --git a/deluge/plugins/FreeSpace/deluge/__init__.py b/deluge/plugins/FreeSpace/deluge/__init__.py new file mode 100644 index 000000000..94033e829 --- /dev/null +++ b/deluge/plugins/FreeSpace/deluge/__init__.py @@ -0,0 +1,3 @@ +# this is a namespace package +import pkg_resources +pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/FreeSpace/deluge/plugins/__init__.py b/deluge/plugins/FreeSpace/deluge/plugins/__init__.py new file mode 100644 index 000000000..94033e829 --- /dev/null +++ b/deluge/plugins/FreeSpace/deluge/plugins/__init__.py @@ -0,0 +1,3 @@ +# this is a namespace package +import pkg_resources +pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/freespace/freespace/__init__.py b/deluge/plugins/FreeSpace/deluge/plugins/freespace/__init__.py similarity index 100% rename from deluge/plugins/freespace/freespace/__init__.py rename to deluge/plugins/FreeSpace/deluge/plugins/freespace/__init__.py diff --git a/deluge/plugins/freespace/freespace/common.py b/deluge/plugins/FreeSpace/deluge/plugins/freespace/common.py similarity index 91% rename from deluge/plugins/freespace/freespace/common.py rename to deluge/plugins/FreeSpace/deluge/plugins/freespace/common.py index ef27e0af8..33820b8f6 100644 --- a/deluge/plugins/freespace/freespace/common.py +++ b/deluge/plugins/FreeSpace/deluge/plugins/freespace/common.py @@ -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)) diff --git a/deluge/plugins/freespace/freespace/core.py b/deluge/plugins/FreeSpace/deluge/plugins/freespace/core.py similarity index 100% rename from deluge/plugins/freespace/freespace/core.py rename to deluge/plugins/FreeSpace/deluge/plugins/freespace/core.py diff --git a/deluge/plugins/freespace/freespace/data/config.glade b/deluge/plugins/FreeSpace/deluge/plugins/freespace/data/config.glade similarity index 100% rename from deluge/plugins/freespace/freespace/data/config.glade rename to deluge/plugins/FreeSpace/deluge/plugins/freespace/data/config.glade diff --git a/deluge/plugins/freespace/freespace/data/freespace.js b/deluge/plugins/FreeSpace/deluge/plugins/freespace/data/freespace.js similarity index 100% rename from deluge/plugins/freespace/freespace/data/freespace.js rename to deluge/plugins/FreeSpace/deluge/plugins/freespace/data/freespace.js diff --git a/deluge/plugins/freespace/freespace/gtkui.py b/deluge/plugins/FreeSpace/deluge/plugins/freespace/gtkui.py similarity index 100% rename from deluge/plugins/freespace/freespace/gtkui.py rename to deluge/plugins/FreeSpace/deluge/plugins/freespace/gtkui.py diff --git a/deluge/plugins/freespace/freespace/webui.py b/deluge/plugins/FreeSpace/deluge/plugins/freespace/webui.py similarity index 100% rename from deluge/plugins/freespace/freespace/webui.py rename to deluge/plugins/FreeSpace/deluge/plugins/freespace/webui.py diff --git a/deluge/plugins/freespace/setup.py b/deluge/plugins/FreeSpace/setup.py similarity index 89% rename from deluge/plugins/freespace/setup.py rename to deluge/plugins/FreeSpace/setup.py index 3c0dce66f..03c732c3f 100755 --- a/deluge/plugins/freespace/setup.py +++ b/deluge/plugins/FreeSpace/setup.py @@ -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) ) From 4c3d068f0c32717cd344322aefe66e56825fe28b Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Fri, 10 Dec 2010 04:08:36 +0000 Subject: [PATCH 08/11] Improve `create_plugin.py` and the generated `create_dev_link.sh`. --- deluge/plugins/FreeSpace/create_dev_link.sh | 16 ++++++++++------ deluge/plugins/notifications/create_dev_link.sh | 16 ++++++++++------ deluge/plugins/stats/create_dev_link.sh | 15 ++++++++++----- deluge/plugins/webui/create_dev_link.sh | 16 ++++++++++------ deluge/scripts/create_plugin.py | 5 ++++- 5 files changed, 44 insertions(+), 24 deletions(-) diff --git a/deluge/plugins/FreeSpace/create_dev_link.sh b/deluge/plugins/FreeSpace/create_dev_link.sh index be73dcaeb..5e04057c3 100755 --- a/deluge/plugins/FreeSpace/create_dev_link.sh +++ b/deluge/plugins/FreeSpace/create_dev_link.sh @@ -1,7 +1,11 @@ #!/bin/bash -cd /home/vampas/projects/DelugeNotify/deluge/plugins/freespace -mkdir temp -export PYTHONPATH=./temp -python setup.py build develop --install-dir ./temp -cp ./temp/FreeSpace.egg-link .config/plugins -rm -fr ./temp +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 diff --git a/deluge/plugins/notifications/create_dev_link.sh b/deluge/plugins/notifications/create_dev_link.sh index fddef345f..5e04057c3 100755 --- a/deluge/plugins/notifications/create_dev_link.sh +++ b/deluge/plugins/notifications/create_dev_link.sh @@ -1,7 +1,11 @@ #!/bin/bash -cd /home/vampas/projects/DelugeNotify/deluge/plugins/notifications -mkdir temp -export PYTHONPATH=./temp -python setup.py build develop --install-dir ./temp -cp ./temp/Notifications.egg-link .config//plugins -rm -fr ./temp +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 diff --git a/deluge/plugins/stats/create_dev_link.sh b/deluge/plugins/stats/create_dev_link.sh index 35e5c2a5c..5e04057c3 100755 --- a/deluge/plugins/stats/create_dev_link.sh +++ b/deluge/plugins/stats/create_dev_link.sh @@ -1,6 +1,11 @@ #!/bin/bash -mkdir temp -export PYTHONPATH=./temp -python setup.py develop --install-dir ./temp -cp ./temp/Stats.egg-link ~/.config/deluge/plugins -rm -fr ./temp +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 diff --git a/deluge/plugins/webui/create_dev_link.sh b/deluge/plugins/webui/create_dev_link.sh index 6d3af263f..f4d60d2ae 100755 --- a/deluge/plugins/webui/create_dev_link.sh +++ b/deluge/plugins/webui/create_dev_link.sh @@ -1,7 +1,11 @@ #!/bin/bash -cd /home/damien/Projects/deluge/deluge/plugins/webui -mkdir temp -export PYTHONPATH=./temp -python setup.py build develop --install-dir ./temp -cp ./temp/WebUi.egg-link /home/damien/.config/deluge/plugins -rm -fr ./temp +BASEDIR=$(cd `dirname $0` && pwd) +CONFIG_DIR=$( test -z $1 && echo "/home/damien/.config/deluge/" || 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 diff --git a/deluge/scripts/create_plugin.py b/deluge/scripts/create_plugin.py index 0087c33fd..7c6006f93 100644 --- a/deluge/scripts/create_plugin.py +++ b/deluge/scripts/create_plugin.py @@ -398,11 +398,14 @@ pkg_resources.declare_namespace(__name__) CREATE_DEV_LINK = """#!/bin/bash BASEDIR=$(cd `dirname $0` && pwd) +CONFIG_DIR=$( test -z $1 && echo "%(configdir)s" || 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 %(configdir)s/plugins +cp $BASEDIR/temp/*.egg-link $CONFIG_DIR/plugins rm -fr $BASEDIR/temp """ From b9a8bf2409dd91bb5dc7296aba0c225e0695cb74 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Fri, 10 Dec 2010 04:09:25 +0000 Subject: [PATCH 09/11] Ported the Label plugin to the deluge.plugins namespace. --- deluge/plugins/{label => Label}/TODO | 0 deluge/plugins/Label/deluge/__init__.py | 3 +++ deluge/plugins/Label/deluge/plugins/__init__.py | 3 +++ .../deluge/plugins}/label/__init__.py | 0 .../{label => Label/deluge/plugins}/label/core.py | 0 .../deluge/plugins}/label/data/label.js | 0 .../deluge/plugins}/label/data/label_options.glade | 0 .../deluge/plugins}/label/data/label_pref.glade | 0 .../deluge/plugins}/label/gtkui/__init__.py | 0 .../deluge/plugins}/label/gtkui/label_config.py | 0 .../deluge/plugins}/label/gtkui/sidebar_menu.py | 0 .../deluge/plugins}/label/gtkui/submenu.py | 0 .../{label => Label/deluge/plugins}/label/test.py | 0 .../{label => Label/deluge/plugins}/label/webui.py | 3 ++- deluge/plugins/{label => Label}/setup.py | 13 +++++++------ 15 files changed, 15 insertions(+), 7 deletions(-) rename deluge/plugins/{label => Label}/TODO (100%) create mode 100644 deluge/plugins/Label/deluge/__init__.py create mode 100644 deluge/plugins/Label/deluge/plugins/__init__.py rename deluge/plugins/{label => Label/deluge/plugins}/label/__init__.py (100%) rename deluge/plugins/{label => Label/deluge/plugins}/label/core.py (100%) rename deluge/plugins/{label => Label/deluge/plugins}/label/data/label.js (100%) rename deluge/plugins/{label => Label/deluge/plugins}/label/data/label_options.glade (100%) rename deluge/plugins/{label => Label/deluge/plugins}/label/data/label_pref.glade (100%) rename deluge/plugins/{label => Label/deluge/plugins}/label/gtkui/__init__.py (100%) rename deluge/plugins/{label => Label/deluge/plugins}/label/gtkui/label_config.py (100%) rename deluge/plugins/{label => Label/deluge/plugins}/label/gtkui/sidebar_menu.py (100%) rename deluge/plugins/{label => Label/deluge/plugins}/label/gtkui/submenu.py (100%) rename deluge/plugins/{label => Label/deluge/plugins}/label/test.py (100%) rename deluge/plugins/{label => Label/deluge/plugins}/label/webui.py (93%) rename deluge/plugins/{label => Label}/setup.py (86%) diff --git a/deluge/plugins/label/TODO b/deluge/plugins/Label/TODO similarity index 100% rename from deluge/plugins/label/TODO rename to deluge/plugins/Label/TODO diff --git a/deluge/plugins/Label/deluge/__init__.py b/deluge/plugins/Label/deluge/__init__.py new file mode 100644 index 000000000..94033e829 --- /dev/null +++ b/deluge/plugins/Label/deluge/__init__.py @@ -0,0 +1,3 @@ +# this is a namespace package +import pkg_resources +pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/Label/deluge/plugins/__init__.py b/deluge/plugins/Label/deluge/plugins/__init__.py new file mode 100644 index 000000000..94033e829 --- /dev/null +++ b/deluge/plugins/Label/deluge/plugins/__init__.py @@ -0,0 +1,3 @@ +# this is a namespace package +import pkg_resources +pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/label/label/__init__.py b/deluge/plugins/Label/deluge/plugins/label/__init__.py similarity index 100% rename from deluge/plugins/label/label/__init__.py rename to deluge/plugins/Label/deluge/plugins/label/__init__.py diff --git a/deluge/plugins/label/label/core.py b/deluge/plugins/Label/deluge/plugins/label/core.py similarity index 100% rename from deluge/plugins/label/label/core.py rename to deluge/plugins/Label/deluge/plugins/label/core.py diff --git a/deluge/plugins/label/label/data/label.js b/deluge/plugins/Label/deluge/plugins/label/data/label.js similarity index 100% rename from deluge/plugins/label/label/data/label.js rename to deluge/plugins/Label/deluge/plugins/label/data/label.js diff --git a/deluge/plugins/label/label/data/label_options.glade b/deluge/plugins/Label/deluge/plugins/label/data/label_options.glade similarity index 100% rename from deluge/plugins/label/label/data/label_options.glade rename to deluge/plugins/Label/deluge/plugins/label/data/label_options.glade diff --git a/deluge/plugins/label/label/data/label_pref.glade b/deluge/plugins/Label/deluge/plugins/label/data/label_pref.glade similarity index 100% rename from deluge/plugins/label/label/data/label_pref.glade rename to deluge/plugins/Label/deluge/plugins/label/data/label_pref.glade diff --git a/deluge/plugins/label/label/gtkui/__init__.py b/deluge/plugins/Label/deluge/plugins/label/gtkui/__init__.py similarity index 100% rename from deluge/plugins/label/label/gtkui/__init__.py rename to deluge/plugins/Label/deluge/plugins/label/gtkui/__init__.py diff --git a/deluge/plugins/label/label/gtkui/label_config.py b/deluge/plugins/Label/deluge/plugins/label/gtkui/label_config.py similarity index 100% rename from deluge/plugins/label/label/gtkui/label_config.py rename to deluge/plugins/Label/deluge/plugins/label/gtkui/label_config.py diff --git a/deluge/plugins/label/label/gtkui/sidebar_menu.py b/deluge/plugins/Label/deluge/plugins/label/gtkui/sidebar_menu.py similarity index 100% rename from deluge/plugins/label/label/gtkui/sidebar_menu.py rename to deluge/plugins/Label/deluge/plugins/label/gtkui/sidebar_menu.py diff --git a/deluge/plugins/label/label/gtkui/submenu.py b/deluge/plugins/Label/deluge/plugins/label/gtkui/submenu.py similarity index 100% rename from deluge/plugins/label/label/gtkui/submenu.py rename to deluge/plugins/Label/deluge/plugins/label/gtkui/submenu.py diff --git a/deluge/plugins/label/label/test.py b/deluge/plugins/Label/deluge/plugins/label/test.py similarity index 100% rename from deluge/plugins/label/label/test.py rename to deluge/plugins/Label/deluge/plugins/label/test.py diff --git a/deluge/plugins/label/label/webui.py b/deluge/plugins/Label/deluge/plugins/label/webui.py similarity index 93% rename from deluge/plugins/label/label/webui.py rename to deluge/plugins/Label/deluge/plugins/label/webui.py index bfc495307..59ed7af99 100644 --- a/deluge/plugins/label/label/webui.py +++ b/deluge/plugins/Label/deluge/plugins/label/webui.py @@ -46,7 +46,8 @@ from deluge.plugins.pluginbase import WebPluginBase from deluge import component 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): diff --git a/deluge/plugins/label/setup.py b/deluge/plugins/Label/setup.py similarity index 86% rename from deluge/plugins/label/setup.py rename to deluge/plugins/Label/setup.py index 4fc344484..ef710fc25 100644 --- a/deluge/plugins/label/setup.py +++ b/deluge/plugins/Label/setup.py @@ -31,7 +31,7 @@ # -from setuptools import setup +from setuptools import setup, find_packages __plugin_name__ = "Label" __author__ = "Martijn Voncken" @@ -49,7 +49,7 @@ adds a tracker column. future: Real labels. """ -__pkg_data__ = {__plugin_name__.lower(): ["template/*", "data/*"]} +__pkg_data__ = {"deluge.plugins."+__plugin_name__.lower(): ["template/*", "data/*"]} setup( name=__plugin_name__, @@ -61,15 +61,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) ) From c1640137250b228cd42cc395f791fa0700fff6e6 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Fri, 10 Dec 2010 04:31:51 +0000 Subject: [PATCH 10/11] Ported Feeder(although not working on current deluge), Notifications, Scheduler, Stats, Toggle and WebUi to the deluge.plugins namespace. --- deluge/plugins/Feeder/deluge/__init__.py | 3 +++ deluge/plugins/Feeder/deluge/plugins/__init__.py | 3 +++ .../deluge/plugins}/feeder/__init__.py | 0 .../deluge/plugins}/feeder/core.py | 0 .../deluge/plugins}/feeder/template/feeds.html | 0 .../plugins}/feeder/template/filter_settings.html | 0 .../deluge/plugins}/feeder/template/filters.html | 0 .../deluge/plugins}/feeder/webui.py | 0 deluge/plugins/{feeder => Feeder}/setup.py | 13 +++++++------ .../create_dev_link.sh | 0 deluge/plugins/Notifications/deluge/__init__.py | 3 +++ .../Notifications/deluge/plugins/__init__.py | 3 +++ .../deluge/plugins}/notifications/__init__.py | 0 .../deluge/plugins}/notifications/common.py | 2 +- .../deluge/plugins}/notifications/core.py | 2 +- .../plugins}/notifications/data/config.glade | 0 .../plugins}/notifications/data/notifications.js | 0 .../deluge/plugins}/notifications/gtkui.py | 0 .../deluge/plugins}/notifications/test.py | 0 .../deluge/plugins}/notifications/webui.py | 0 .../{notifications => Notifications}/setup.py | 7 ++++--- deluge/plugins/Scheduler/deluge/__init__.py | 3 +++ .../plugins/Scheduler/deluge/plugins/__init__.py | 3 +++ .../deluge/plugins}/scheduler/__init__.py | 0 .../deluge/plugins}/scheduler/common.py | 3 ++- .../deluge/plugins}/scheduler/core.py | 0 .../deluge/plugins}/scheduler/data/green.png | Bin .../deluge/plugins}/scheduler/data/red.png | Bin .../deluge/plugins}/scheduler/data/scheduler.js | 0 .../deluge/plugins}/scheduler/data/yellow.png | Bin .../deluge/plugins}/scheduler/gtkui.py | 0 .../deluge/plugins}/scheduler/webui.py | 4 ++-- deluge/plugins/{scheduler => Scheduler}/setup.py | 13 +++++++------ deluge/plugins/{stats => Stats}/create_dev_link.sh | 0 deluge/plugins/Stats/deluge/__init__.py | 3 +++ deluge/plugins/Stats/deluge/plugins/__init__.py | 3 +++ .../deluge/plugins}/stats/__init__.py | 0 .../deluge/plugins}/stats/common.py | 3 ++- .../{stats => Stats/deluge/plugins}/stats/core.py | 0 .../deluge/plugins}/stats/data/config.glade | 0 .../deluge/plugins}/stats/data/stats.js | 0 .../deluge/plugins}/stats/data/tabs.glade | 0 .../{stats => Stats/deluge/plugins}/stats/graph.py | 0 .../{stats => Stats/deluge/plugins}/stats/gtkui.py | 0 .../deluge/plugins}/stats/test.html | 0 .../{stats => Stats/deluge/plugins}/stats/test.py | 0 .../{stats => Stats/deluge/plugins}/stats/test.sh | 0 .../deluge/plugins}/stats/test_total.py | 0 .../{stats => Stats/deluge/plugins}/stats/webui.py | 0 deluge/plugins/{stats => Stats}/setup.py | 13 +++++++------ deluge/plugins/Toggle/deluge/__init__.py | 3 +++ deluge/plugins/Toggle/deluge/plugins/__init__.py | 3 +++ .../deluge/plugins}/toggle/__init__.py | 0 .../deluge/plugins}/toggle/common.py | 3 ++- .../deluge/plugins}/toggle/core.py | 0 .../deluge/plugins}/toggle/data/toggle.js | 0 .../deluge/plugins}/toggle/gtkui.py | 0 .../deluge/plugins}/toggle/webui.py | 0 deluge/plugins/{toggle => Toggle}/setup.py | 13 +++++++------ deluge/plugins/{webui => WebUi}/create_dev_link.sh | 0 deluge/plugins/WebUi/deluge/__init__.py | 3 +++ deluge/plugins/WebUi/deluge/plugins/__init__.py | 3 +++ .../deluge/plugins}/webui/__init__.py | 0 .../deluge/plugins}/webui/common.py | 3 ++- .../{webui => WebUi/deluge/plugins}/webui/core.py | 0 .../deluge/plugins}/webui/data/config.glade | 0 .../{webui => WebUi/deluge/plugins}/webui/gtkui.py | 0 deluge/plugins/{webui => WebUi}/setup.py | 11 ++++++----- deluge/scripts/create_plugin.py | 1 + 69 files changed, 87 insertions(+), 40 deletions(-) create mode 100644 deluge/plugins/Feeder/deluge/__init__.py create mode 100644 deluge/plugins/Feeder/deluge/plugins/__init__.py rename deluge/plugins/{feeder => Feeder/deluge/plugins}/feeder/__init__.py (100%) rename deluge/plugins/{feeder => Feeder/deluge/plugins}/feeder/core.py (100%) rename deluge/plugins/{feeder => Feeder/deluge/plugins}/feeder/template/feeds.html (100%) rename deluge/plugins/{feeder => Feeder/deluge/plugins}/feeder/template/filter_settings.html (100%) rename deluge/plugins/{feeder => Feeder/deluge/plugins}/feeder/template/filters.html (100%) rename deluge/plugins/{feeder => Feeder/deluge/plugins}/feeder/webui.py (100%) rename deluge/plugins/{feeder => Feeder}/setup.py (86%) rename deluge/plugins/{notifications => Notifications}/create_dev_link.sh (100%) create mode 100644 deluge/plugins/Notifications/deluge/__init__.py create mode 100644 deluge/plugins/Notifications/deluge/plugins/__init__.py rename deluge/plugins/{notifications => Notifications/deluge/plugins}/notifications/__init__.py (100%) rename deluge/plugins/{notifications => Notifications/deluge/plugins}/notifications/common.py (98%) rename deluge/plugins/{notifications => Notifications/deluge/plugins}/notifications/core.py (99%) rename deluge/plugins/{notifications => Notifications/deluge/plugins}/notifications/data/config.glade (100%) rename deluge/plugins/{notifications => Notifications/deluge/plugins}/notifications/data/notifications.js (100%) rename deluge/plugins/{notifications => Notifications/deluge/plugins}/notifications/gtkui.py (100%) rename deluge/plugins/{notifications => Notifications/deluge/plugins}/notifications/test.py (100%) rename deluge/plugins/{notifications => Notifications/deluge/plugins}/notifications/webui.py (100%) rename deluge/plugins/{notifications => Notifications}/setup.py (92%) create mode 100644 deluge/plugins/Scheduler/deluge/__init__.py create mode 100644 deluge/plugins/Scheduler/deluge/plugins/__init__.py rename deluge/plugins/{scheduler => Scheduler/deluge/plugins}/scheduler/__init__.py (100%) rename deluge/plugins/{scheduler => Scheduler/deluge/plugins}/scheduler/common.py (91%) rename deluge/plugins/{scheduler => Scheduler/deluge/plugins}/scheduler/core.py (100%) rename deluge/plugins/{scheduler => Scheduler/deluge/plugins}/scheduler/data/green.png (100%) rename deluge/plugins/{scheduler => Scheduler/deluge/plugins}/scheduler/data/red.png (100%) rename deluge/plugins/{scheduler => Scheduler/deluge/plugins}/scheduler/data/scheduler.js (100%) rename deluge/plugins/{scheduler => Scheduler/deluge/plugins}/scheduler/data/yellow.png (100%) rename deluge/plugins/{scheduler => Scheduler/deluge/plugins}/scheduler/gtkui.py (100%) rename deluge/plugins/{scheduler => Scheduler/deluge/plugins}/scheduler/webui.py (97%) rename deluge/plugins/{scheduler => Scheduler}/setup.py (87%) rename deluge/plugins/{stats => Stats}/create_dev_link.sh (100%) create mode 100644 deluge/plugins/Stats/deluge/__init__.py create mode 100644 deluge/plugins/Stats/deluge/plugins/__init__.py rename deluge/plugins/{stats => Stats/deluge/plugins}/stats/__init__.py (100%) rename deluge/plugins/{stats => Stats/deluge/plugins}/stats/common.py (91%) rename deluge/plugins/{stats => Stats/deluge/plugins}/stats/core.py (100%) rename deluge/plugins/{stats => Stats/deluge/plugins}/stats/data/config.glade (100%) rename deluge/plugins/{stats => Stats/deluge/plugins}/stats/data/stats.js (100%) rename deluge/plugins/{stats => Stats/deluge/plugins}/stats/data/tabs.glade (100%) rename deluge/plugins/{stats => Stats/deluge/plugins}/stats/graph.py (100%) rename deluge/plugins/{stats => Stats/deluge/plugins}/stats/gtkui.py (100%) rename deluge/plugins/{stats => Stats/deluge/plugins}/stats/test.html (100%) rename deluge/plugins/{stats => Stats/deluge/plugins}/stats/test.py (100%) rename deluge/plugins/{stats => Stats/deluge/plugins}/stats/test.sh (100%) rename deluge/plugins/{stats => Stats/deluge/plugins}/stats/test_total.py (100%) rename deluge/plugins/{stats => Stats/deluge/plugins}/stats/webui.py (100%) rename deluge/plugins/{stats => Stats}/setup.py (89%) create mode 100644 deluge/plugins/Toggle/deluge/__init__.py create mode 100644 deluge/plugins/Toggle/deluge/plugins/__init__.py rename deluge/plugins/{toggle => Toggle/deluge/plugins}/toggle/__init__.py (100%) rename deluge/plugins/{toggle => Toggle/deluge/plugins}/toggle/common.py (92%) rename deluge/plugins/{toggle => Toggle/deluge/plugins}/toggle/core.py (100%) rename deluge/plugins/{toggle => Toggle/deluge/plugins}/toggle/data/toggle.js (100%) rename deluge/plugins/{toggle => Toggle/deluge/plugins}/toggle/gtkui.py (100%) rename deluge/plugins/{toggle => Toggle/deluge/plugins}/toggle/webui.py (100%) rename deluge/plugins/{toggle => Toggle}/setup.py (87%) rename deluge/plugins/{webui => WebUi}/create_dev_link.sh (100%) create mode 100644 deluge/plugins/WebUi/deluge/__init__.py create mode 100644 deluge/plugins/WebUi/deluge/plugins/__init__.py rename deluge/plugins/{webui => WebUi/deluge/plugins}/webui/__init__.py (100%) rename deluge/plugins/{webui => WebUi/deluge/plugins}/webui/common.py (91%) rename deluge/plugins/{webui => WebUi/deluge/plugins}/webui/core.py (100%) rename deluge/plugins/{webui => WebUi/deluge/plugins}/webui/data/config.glade (100%) rename deluge/plugins/{webui => WebUi/deluge/plugins}/webui/gtkui.py (100%) rename deluge/plugins/{webui => WebUi}/setup.py (88%) diff --git a/deluge/plugins/Feeder/deluge/__init__.py b/deluge/plugins/Feeder/deluge/__init__.py new file mode 100644 index 000000000..94033e829 --- /dev/null +++ b/deluge/plugins/Feeder/deluge/__init__.py @@ -0,0 +1,3 @@ +# this is a namespace package +import pkg_resources +pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/Feeder/deluge/plugins/__init__.py b/deluge/plugins/Feeder/deluge/plugins/__init__.py new file mode 100644 index 000000000..94033e829 --- /dev/null +++ b/deluge/plugins/Feeder/deluge/plugins/__init__.py @@ -0,0 +1,3 @@ +# this is a namespace package +import pkg_resources +pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/feeder/feeder/__init__.py b/deluge/plugins/Feeder/deluge/plugins/feeder/__init__.py similarity index 100% rename from deluge/plugins/feeder/feeder/__init__.py rename to deluge/plugins/Feeder/deluge/plugins/feeder/__init__.py diff --git a/deluge/plugins/feeder/feeder/core.py b/deluge/plugins/Feeder/deluge/plugins/feeder/core.py similarity index 100% rename from deluge/plugins/feeder/feeder/core.py rename to deluge/plugins/Feeder/deluge/plugins/feeder/core.py diff --git a/deluge/plugins/feeder/feeder/template/feeds.html b/deluge/plugins/Feeder/deluge/plugins/feeder/template/feeds.html similarity index 100% rename from deluge/plugins/feeder/feeder/template/feeds.html rename to deluge/plugins/Feeder/deluge/plugins/feeder/template/feeds.html diff --git a/deluge/plugins/feeder/feeder/template/filter_settings.html b/deluge/plugins/Feeder/deluge/plugins/feeder/template/filter_settings.html similarity index 100% rename from deluge/plugins/feeder/feeder/template/filter_settings.html rename to deluge/plugins/Feeder/deluge/plugins/feeder/template/filter_settings.html diff --git a/deluge/plugins/feeder/feeder/template/filters.html b/deluge/plugins/Feeder/deluge/plugins/feeder/template/filters.html similarity index 100% rename from deluge/plugins/feeder/feeder/template/filters.html rename to deluge/plugins/Feeder/deluge/plugins/feeder/template/filters.html diff --git a/deluge/plugins/feeder/feeder/webui.py b/deluge/plugins/Feeder/deluge/plugins/feeder/webui.py similarity index 100% rename from deluge/plugins/feeder/feeder/webui.py rename to deluge/plugins/Feeder/deluge/plugins/feeder/webui.py diff --git a/deluge/plugins/feeder/setup.py b/deluge/plugins/Feeder/setup.py similarity index 86% rename from deluge/plugins/feeder/setup.py rename to deluge/plugins/Feeder/setup.py index 4c4a09f8e..a2bd9bf80 100644 --- a/deluge/plugins/feeder/setup.py +++ b/deluge/plugins/Feeder/setup.py @@ -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) ) diff --git a/deluge/plugins/notifications/create_dev_link.sh b/deluge/plugins/Notifications/create_dev_link.sh similarity index 100% rename from deluge/plugins/notifications/create_dev_link.sh rename to deluge/plugins/Notifications/create_dev_link.sh diff --git a/deluge/plugins/Notifications/deluge/__init__.py b/deluge/plugins/Notifications/deluge/__init__.py new file mode 100644 index 000000000..94033e829 --- /dev/null +++ b/deluge/plugins/Notifications/deluge/__init__.py @@ -0,0 +1,3 @@ +# this is a namespace package +import pkg_resources +pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/Notifications/deluge/plugins/__init__.py b/deluge/plugins/Notifications/deluge/plugins/__init__.py new file mode 100644 index 000000000..94033e829 --- /dev/null +++ b/deluge/plugins/Notifications/deluge/plugins/__init__.py @@ -0,0 +1,3 @@ +# this is a namespace package +import pkg_resources +pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/notifications/notifications/__init__.py b/deluge/plugins/Notifications/deluge/plugins/notifications/__init__.py similarity index 100% rename from deluge/plugins/notifications/notifications/__init__.py rename to deluge/plugins/Notifications/deluge/plugins/notifications/__init__.py diff --git a/deluge/plugins/notifications/notifications/common.py b/deluge/plugins/Notifications/deluge/plugins/notifications/common.py similarity index 98% rename from deluge/plugins/notifications/notifications/common.py rename to deluge/plugins/Notifications/deluge/plugins/notifications/common.py index 7353e5a8e..337a9a6aa 100644 --- a/deluge/plugins/notifications/notifications/common.py +++ b/deluge/plugins/Notifications/deluge/plugins/notifications/common.py @@ -50,7 +50,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)) diff --git a/deluge/plugins/notifications/notifications/core.py b/deluge/plugins/Notifications/deluge/plugins/notifications/core.py similarity index 99% rename from deluge/plugins/notifications/notifications/core.py rename to deluge/plugins/Notifications/deluge/plugins/notifications/core.py index 9586f7f5f..f4b9075ca 100644 --- a/deluge/plugins/notifications/notifications/core.py +++ b/deluge/plugins/Notifications/deluge/plugins/notifications/core.py @@ -46,7 +46,7 @@ from deluge.plugins.pluginbase import CorePluginBase import deluge.configmanager from deluge.core.rpcserver import export -from notifications.common import CustomNotifications +from common import CustomNotifications DEFAULT_PREFS = { "smtp_enabled": False, diff --git a/deluge/plugins/notifications/notifications/data/config.glade b/deluge/plugins/Notifications/deluge/plugins/notifications/data/config.glade similarity index 100% rename from deluge/plugins/notifications/notifications/data/config.glade rename to deluge/plugins/Notifications/deluge/plugins/notifications/data/config.glade diff --git a/deluge/plugins/notifications/notifications/data/notifications.js b/deluge/plugins/Notifications/deluge/plugins/notifications/data/notifications.js similarity index 100% rename from deluge/plugins/notifications/notifications/data/notifications.js rename to deluge/plugins/Notifications/deluge/plugins/notifications/data/notifications.js diff --git a/deluge/plugins/notifications/notifications/gtkui.py b/deluge/plugins/Notifications/deluge/plugins/notifications/gtkui.py similarity index 100% rename from deluge/plugins/notifications/notifications/gtkui.py rename to deluge/plugins/Notifications/deluge/plugins/notifications/gtkui.py diff --git a/deluge/plugins/notifications/notifications/test.py b/deluge/plugins/Notifications/deluge/plugins/notifications/test.py similarity index 100% rename from deluge/plugins/notifications/notifications/test.py rename to deluge/plugins/Notifications/deluge/plugins/notifications/test.py diff --git a/deluge/plugins/notifications/notifications/webui.py b/deluge/plugins/Notifications/deluge/plugins/notifications/webui.py similarity index 100% rename from deluge/plugins/notifications/notifications/webui.py rename to deluge/plugins/Notifications/deluge/plugins/notifications/webui.py diff --git a/deluge/plugins/notifications/setup.py b/deluge/plugins/Notifications/setup.py similarity index 92% rename from deluge/plugins/notifications/setup.py rename to deluge/plugins/Notifications/setup.py index b7098e22c..e94589e37 100755 --- a/deluge/plugins/notifications/setup.py +++ b/deluge/plugins/Notifications/setup.py @@ -51,7 +51,7 @@ __long_description__ = __description__ + """\ The plugin also allows other plugins to make use of itself for their own custom notifications. """ -__pkg_data__ = {__plugin_name__.lower(): ["template/*", "data/*"]} +__pkg_data__ = {"deluge.plugins."+__plugin_name__.lower(): ["template/*", "data/*"]} setup( name=__plugin_name__, @@ -64,12 +64,13 @@ setup( long_description=__long_description__ if __long_description__ else __description__, packages=find_packages(exclude=['**/test.py']), + 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) ) diff --git a/deluge/plugins/Scheduler/deluge/__init__.py b/deluge/plugins/Scheduler/deluge/__init__.py new file mode 100644 index 000000000..94033e829 --- /dev/null +++ b/deluge/plugins/Scheduler/deluge/__init__.py @@ -0,0 +1,3 @@ +# this is a namespace package +import pkg_resources +pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/Scheduler/deluge/plugins/__init__.py b/deluge/plugins/Scheduler/deluge/plugins/__init__.py new file mode 100644 index 000000000..94033e829 --- /dev/null +++ b/deluge/plugins/Scheduler/deluge/plugins/__init__.py @@ -0,0 +1,3 @@ +# this is a namespace package +import pkg_resources +pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/scheduler/scheduler/__init__.py b/deluge/plugins/Scheduler/deluge/plugins/scheduler/__init__.py similarity index 100% rename from deluge/plugins/scheduler/scheduler/__init__.py rename to deluge/plugins/Scheduler/deluge/plugins/scheduler/__init__.py diff --git a/deluge/plugins/scheduler/scheduler/common.py b/deluge/plugins/Scheduler/deluge/plugins/scheduler/common.py similarity index 91% rename from deluge/plugins/scheduler/scheduler/common.py rename to deluge/plugins/Scheduler/deluge/plugins/scheduler/common.py index b2b184b23..5c495a5eb 100644 --- a/deluge/plugins/scheduler/scheduler/common.py +++ b/deluge/plugins/Scheduler/deluge/plugins/scheduler/common.py @@ -38,4 +38,5 @@ def get_resource(filename): import pkg_resources, os - return pkg_resources.resource_filename("scheduler", os.path.join("data", filename)) + return pkg_resources.resource_filename("deluge.plugins.scheduler", + os.path.join("data", filename)) diff --git a/deluge/plugins/scheduler/scheduler/core.py b/deluge/plugins/Scheduler/deluge/plugins/scheduler/core.py similarity index 100% rename from deluge/plugins/scheduler/scheduler/core.py rename to deluge/plugins/Scheduler/deluge/plugins/scheduler/core.py diff --git a/deluge/plugins/scheduler/scheduler/data/green.png b/deluge/plugins/Scheduler/deluge/plugins/scheduler/data/green.png similarity index 100% rename from deluge/plugins/scheduler/scheduler/data/green.png rename to deluge/plugins/Scheduler/deluge/plugins/scheduler/data/green.png diff --git a/deluge/plugins/scheduler/scheduler/data/red.png b/deluge/plugins/Scheduler/deluge/plugins/scheduler/data/red.png similarity index 100% rename from deluge/plugins/scheduler/scheduler/data/red.png rename to deluge/plugins/Scheduler/deluge/plugins/scheduler/data/red.png diff --git a/deluge/plugins/scheduler/scheduler/data/scheduler.js b/deluge/plugins/Scheduler/deluge/plugins/scheduler/data/scheduler.js similarity index 100% rename from deluge/plugins/scheduler/scheduler/data/scheduler.js rename to deluge/plugins/Scheduler/deluge/plugins/scheduler/data/scheduler.js diff --git a/deluge/plugins/scheduler/scheduler/data/yellow.png b/deluge/plugins/Scheduler/deluge/plugins/scheduler/data/yellow.png similarity index 100% rename from deluge/plugins/scheduler/scheduler/data/yellow.png rename to deluge/plugins/Scheduler/deluge/plugins/scheduler/data/yellow.png diff --git a/deluge/plugins/scheduler/scheduler/gtkui.py b/deluge/plugins/Scheduler/deluge/plugins/scheduler/gtkui.py similarity index 100% rename from deluge/plugins/scheduler/scheduler/gtkui.py rename to deluge/plugins/Scheduler/deluge/plugins/scheduler/gtkui.py diff --git a/deluge/plugins/scheduler/scheduler/webui.py b/deluge/plugins/Scheduler/deluge/plugins/scheduler/webui.py similarity index 97% rename from deluge/plugins/scheduler/scheduler/webui.py rename to deluge/plugins/Scheduler/deluge/plugins/scheduler/webui.py index 71cc8cc9a..f7f82d242 100644 --- a/deluge/plugins/scheduler/scheduler/webui.py +++ b/deluge/plugins/Scheduler/deluge/plugins/scheduler/webui.py @@ -44,5 +44,5 @@ from deluge.plugins.pluginbase import WebPluginBase from common import get_resource class WebUI(WebPluginBase): - - scripts = [get_resource("scheduler.js")] \ No newline at end of file + + scripts = [get_resource("scheduler.js")] diff --git a/deluge/plugins/scheduler/setup.py b/deluge/plugins/Scheduler/setup.py similarity index 87% rename from deluge/plugins/scheduler/setup.py rename to deluge/plugins/Scheduler/setup.py index 28d95d9ce..f113a1c88 100644 --- a/deluge/plugins/scheduler/setup.py +++ b/deluge/plugins/Scheduler/setup.py @@ -36,7 +36,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__ = "Scheduler" __author__ = "Andrew Resch" @@ -46,7 +46,7 @@ __url__ = "http://deluge-torrent.org" __license__ = "GPLv3" __description__ = "Schedule limits on a per-hour per-day basis." __long_description__ = """""" -__pkg_data__ = {__plugin_name__.lower(): ["template/*", "data/*"]} +__pkg_data__ = {"deluge.plugins."+__plugin_name__.lower(): ["template/*", "data/*"]} setup( name=__plugin_name__, @@ -58,15 +58,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 = 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) ) diff --git a/deluge/plugins/stats/create_dev_link.sh b/deluge/plugins/Stats/create_dev_link.sh similarity index 100% rename from deluge/plugins/stats/create_dev_link.sh rename to deluge/plugins/Stats/create_dev_link.sh diff --git a/deluge/plugins/Stats/deluge/__init__.py b/deluge/plugins/Stats/deluge/__init__.py new file mode 100644 index 000000000..94033e829 --- /dev/null +++ b/deluge/plugins/Stats/deluge/__init__.py @@ -0,0 +1,3 @@ +# this is a namespace package +import pkg_resources +pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/Stats/deluge/plugins/__init__.py b/deluge/plugins/Stats/deluge/plugins/__init__.py new file mode 100644 index 000000000..94033e829 --- /dev/null +++ b/deluge/plugins/Stats/deluge/plugins/__init__.py @@ -0,0 +1,3 @@ +# this is a namespace package +import pkg_resources +pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/stats/stats/__init__.py b/deluge/plugins/Stats/deluge/plugins/stats/__init__.py similarity index 100% rename from deluge/plugins/stats/stats/__init__.py rename to deluge/plugins/Stats/deluge/plugins/stats/__init__.py diff --git a/deluge/plugins/stats/stats/common.py b/deluge/plugins/Stats/deluge/plugins/stats/common.py similarity index 91% rename from deluge/plugins/stats/stats/common.py rename to deluge/plugins/Stats/deluge/plugins/stats/common.py index 3a81eaaca..674d6f4b3 100644 --- a/deluge/plugins/stats/stats/common.py +++ b/deluge/plugins/Stats/deluge/plugins/stats/common.py @@ -36,4 +36,5 @@ import pkg_resources import os.path def get_resource(filename): - return pkg_resources.resource_filename("stats", os.path.join("data", filename)) + return pkg_resources.resource_filename("deluge.plugins.stats", + os.path.join("data", filename)) diff --git a/deluge/plugins/stats/stats/core.py b/deluge/plugins/Stats/deluge/plugins/stats/core.py similarity index 100% rename from deluge/plugins/stats/stats/core.py rename to deluge/plugins/Stats/deluge/plugins/stats/core.py diff --git a/deluge/plugins/stats/stats/data/config.glade b/deluge/plugins/Stats/deluge/plugins/stats/data/config.glade similarity index 100% rename from deluge/plugins/stats/stats/data/config.glade rename to deluge/plugins/Stats/deluge/plugins/stats/data/config.glade diff --git a/deluge/plugins/stats/stats/data/stats.js b/deluge/plugins/Stats/deluge/plugins/stats/data/stats.js similarity index 100% rename from deluge/plugins/stats/stats/data/stats.js rename to deluge/plugins/Stats/deluge/plugins/stats/data/stats.js diff --git a/deluge/plugins/stats/stats/data/tabs.glade b/deluge/plugins/Stats/deluge/plugins/stats/data/tabs.glade similarity index 100% rename from deluge/plugins/stats/stats/data/tabs.glade rename to deluge/plugins/Stats/deluge/plugins/stats/data/tabs.glade diff --git a/deluge/plugins/stats/stats/graph.py b/deluge/plugins/Stats/deluge/plugins/stats/graph.py similarity index 100% rename from deluge/plugins/stats/stats/graph.py rename to deluge/plugins/Stats/deluge/plugins/stats/graph.py diff --git a/deluge/plugins/stats/stats/gtkui.py b/deluge/plugins/Stats/deluge/plugins/stats/gtkui.py similarity index 100% rename from deluge/plugins/stats/stats/gtkui.py rename to deluge/plugins/Stats/deluge/plugins/stats/gtkui.py diff --git a/deluge/plugins/stats/stats/test.html b/deluge/plugins/Stats/deluge/plugins/stats/test.html similarity index 100% rename from deluge/plugins/stats/stats/test.html rename to deluge/plugins/Stats/deluge/plugins/stats/test.html diff --git a/deluge/plugins/stats/stats/test.py b/deluge/plugins/Stats/deluge/plugins/stats/test.py similarity index 100% rename from deluge/plugins/stats/stats/test.py rename to deluge/plugins/Stats/deluge/plugins/stats/test.py diff --git a/deluge/plugins/stats/stats/test.sh b/deluge/plugins/Stats/deluge/plugins/stats/test.sh similarity index 100% rename from deluge/plugins/stats/stats/test.sh rename to deluge/plugins/Stats/deluge/plugins/stats/test.sh diff --git a/deluge/plugins/stats/stats/test_total.py b/deluge/plugins/Stats/deluge/plugins/stats/test_total.py similarity index 100% rename from deluge/plugins/stats/stats/test_total.py rename to deluge/plugins/Stats/deluge/plugins/stats/test_total.py diff --git a/deluge/plugins/stats/stats/webui.py b/deluge/plugins/Stats/deluge/plugins/stats/webui.py similarity index 100% rename from deluge/plugins/stats/stats/webui.py rename to deluge/plugins/Stats/deluge/plugins/stats/webui.py diff --git a/deluge/plugins/stats/setup.py b/deluge/plugins/Stats/setup.py similarity index 89% rename from deluge/plugins/stats/setup.py rename to deluge/plugins/Stats/setup.py index e5ff10494..f84f76f8e 100644 --- a/deluge/plugins/stats/setup.py +++ b/deluge/plugins/Stats/setup.py @@ -45,7 +45,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__ = "Stats" __author__ = "Martijn Voncken" @@ -55,7 +55,7 @@ __url__ = "http://deluge-torrent.org" __license__ = "GPLv3" __description__ = "" __long_description__ = """""" -__pkg_data__ = {__plugin_name__.lower(): ["template/*", "data/*"]} +__pkg_data__ = {"deluge.plugins."+__plugin_name__.lower(): ["template/*", "data/*"]} setup( name=__plugin_name__, @@ -67,15 +67,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.web] - %s = %s:WebUIPlugin + %s = deluge.plugins.%s:WebUIPlugin """ % ((__plugin_name__, __plugin_name__.lower())*3) ) diff --git a/deluge/plugins/Toggle/deluge/__init__.py b/deluge/plugins/Toggle/deluge/__init__.py new file mode 100644 index 000000000..94033e829 --- /dev/null +++ b/deluge/plugins/Toggle/deluge/__init__.py @@ -0,0 +1,3 @@ +# this is a namespace package +import pkg_resources +pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/Toggle/deluge/plugins/__init__.py b/deluge/plugins/Toggle/deluge/plugins/__init__.py new file mode 100644 index 000000000..94033e829 --- /dev/null +++ b/deluge/plugins/Toggle/deluge/plugins/__init__.py @@ -0,0 +1,3 @@ +# this is a namespace package +import pkg_resources +pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/toggle/toggle/__init__.py b/deluge/plugins/Toggle/deluge/plugins/toggle/__init__.py similarity index 100% rename from deluge/plugins/toggle/toggle/__init__.py rename to deluge/plugins/Toggle/deluge/plugins/toggle/__init__.py diff --git a/deluge/plugins/toggle/toggle/common.py b/deluge/plugins/Toggle/deluge/plugins/toggle/common.py similarity index 92% rename from deluge/plugins/toggle/toggle/common.py rename to deluge/plugins/Toggle/deluge/plugins/toggle/common.py index 616249a28..de9ce4973 100644 --- a/deluge/plugins/toggle/toggle/common.py +++ b/deluge/plugins/Toggle/deluge/plugins/toggle/common.py @@ -39,4 +39,5 @@ def get_resource(filename): import pkg_resources, os - return pkg_resources.resource_filename("toggle", os.path.join("data", filename)) + return pkg_resources.resource_filename("deluge.plugins.toggle", + os.path.join("data", filename)) diff --git a/deluge/plugins/toggle/toggle/core.py b/deluge/plugins/Toggle/deluge/plugins/toggle/core.py similarity index 100% rename from deluge/plugins/toggle/toggle/core.py rename to deluge/plugins/Toggle/deluge/plugins/toggle/core.py diff --git a/deluge/plugins/toggle/toggle/data/toggle.js b/deluge/plugins/Toggle/deluge/plugins/toggle/data/toggle.js similarity index 100% rename from deluge/plugins/toggle/toggle/data/toggle.js rename to deluge/plugins/Toggle/deluge/plugins/toggle/data/toggle.js diff --git a/deluge/plugins/toggle/toggle/gtkui.py b/deluge/plugins/Toggle/deluge/plugins/toggle/gtkui.py similarity index 100% rename from deluge/plugins/toggle/toggle/gtkui.py rename to deluge/plugins/Toggle/deluge/plugins/toggle/gtkui.py diff --git a/deluge/plugins/toggle/toggle/webui.py b/deluge/plugins/Toggle/deluge/plugins/toggle/webui.py similarity index 100% rename from deluge/plugins/toggle/toggle/webui.py rename to deluge/plugins/Toggle/deluge/plugins/toggle/webui.py diff --git a/deluge/plugins/toggle/setup.py b/deluge/plugins/Toggle/setup.py similarity index 87% rename from deluge/plugins/toggle/setup.py rename to deluge/plugins/Toggle/setup.py index 3da5edd08..c772d22e1 100644 --- a/deluge/plugins/toggle/setup.py +++ b/deluge/plugins/Toggle/setup.py @@ -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__ = "Toggle" __author__ = "John Garland" @@ -47,7 +47,7 @@ __url__ = "http://deluge-torrent.org" __license__ = "GPLv3" __description__ = "Toggles the session" __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 = 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) ) diff --git a/deluge/plugins/webui/create_dev_link.sh b/deluge/plugins/WebUi/create_dev_link.sh similarity index 100% rename from deluge/plugins/webui/create_dev_link.sh rename to deluge/plugins/WebUi/create_dev_link.sh diff --git a/deluge/plugins/WebUi/deluge/__init__.py b/deluge/plugins/WebUi/deluge/__init__.py new file mode 100644 index 000000000..94033e829 --- /dev/null +++ b/deluge/plugins/WebUi/deluge/__init__.py @@ -0,0 +1,3 @@ +# this is a namespace package +import pkg_resources +pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/WebUi/deluge/plugins/__init__.py b/deluge/plugins/WebUi/deluge/plugins/__init__.py new file mode 100644 index 000000000..94033e829 --- /dev/null +++ b/deluge/plugins/WebUi/deluge/plugins/__init__.py @@ -0,0 +1,3 @@ +# this is a namespace package +import pkg_resources +pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/webui/webui/__init__.py b/deluge/plugins/WebUi/deluge/plugins/webui/__init__.py similarity index 100% rename from deluge/plugins/webui/webui/__init__.py rename to deluge/plugins/WebUi/deluge/plugins/webui/__init__.py diff --git a/deluge/plugins/webui/webui/common.py b/deluge/plugins/WebUi/deluge/plugins/webui/common.py similarity index 91% rename from deluge/plugins/webui/webui/common.py rename to deluge/plugins/WebUi/deluge/plugins/webui/common.py index a85371ec6..5f95709fe 100644 --- a/deluge/plugins/webui/webui/common.py +++ b/deluge/plugins/WebUi/deluge/plugins/webui/common.py @@ -38,4 +38,5 @@ def get_resource(filename): import pkg_resources, os - return pkg_resources.resource_filename("webui", os.path.join("data", filename)) + return pkg_resources.resource_filename("deluge.plugins.webui", + os.path.join("data", filename)) diff --git a/deluge/plugins/webui/webui/core.py b/deluge/plugins/WebUi/deluge/plugins/webui/core.py similarity index 100% rename from deluge/plugins/webui/webui/core.py rename to deluge/plugins/WebUi/deluge/plugins/webui/core.py diff --git a/deluge/plugins/webui/webui/data/config.glade b/deluge/plugins/WebUi/deluge/plugins/webui/data/config.glade similarity index 100% rename from deluge/plugins/webui/webui/data/config.glade rename to deluge/plugins/WebUi/deluge/plugins/webui/data/config.glade diff --git a/deluge/plugins/webui/webui/gtkui.py b/deluge/plugins/WebUi/deluge/plugins/webui/gtkui.py similarity index 100% rename from deluge/plugins/webui/webui/gtkui.py rename to deluge/plugins/WebUi/deluge/plugins/webui/gtkui.py diff --git a/deluge/plugins/webui/setup.py b/deluge/plugins/WebUi/setup.py similarity index 88% rename from deluge/plugins/webui/setup.py rename to deluge/plugins/WebUi/setup.py index 25cf05dc2..768263e97 100644 --- a/deluge/plugins/webui/setup.py +++ b/deluge/plugins/WebUi/setup.py @@ -36,7 +36,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__ = "WebUi" __author__ = "Damien Churchill" @@ -46,7 +46,7 @@ __url__ = "http://deluge-torrent.org" __license__ = "GPLv3" __description__ = "Allows starting the web interface within the daemon." __long_description__ = """""" -__pkg_data__ = {__plugin_name__.lower(): ["template/*", "data/*"]} +__pkg_data__ = {"deluge.plugins."+__plugin_name__.lower(): ["template/*", "data/*"]} setup( name=__plugin_name__, @@ -58,13 +58,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) ) diff --git a/deluge/scripts/create_plugin.py b/deluge/scripts/create_plugin.py index 7c6006f93..c35a5c711 100644 --- a/deluge/scripts/create_plugin.py +++ b/deluge/scripts/create_plugin.py @@ -360,6 +360,7 @@ GPL = """# # Copyright (C) 2008 Martijn Voncken # Copyright (C) 2007-2009 Andrew Resch # Copyright (C) 2009 Damien Churchill +# Copyright (C) 2010 Pedro Algarvio # # Deluge is free software. # From 9bd11ab2044be6c967c062ce8b46bd538d109c63 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Fri, 10 Dec 2010 04:35:41 +0000 Subject: [PATCH 11/11] Update ChangeLog. --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 4f48c9d88..dbfbda562 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,6 @@ === Deluge 1.3.0 (In Development) === + * 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 * Implement #457 progress bars for folders