From ac9959a92b3cd9df87a127f4d3c1eafce8d61bf6 Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Mon, 27 Oct 2008 03:53:21 +0000 Subject: [PATCH] Convert plugins setup.py to new format Update create_plugin script to use new setup.py format --- deluge/plugins/blocklist/setup.py | 2 +- deluge/plugins/label/setup.py | 42 ++++++++++++++++++----------- deluge/plugins/stats/setup.py | 36 +++++++++++++++++-------- deluge/scripts/create_plugin.py | 45 ++++++++++++++++++++----------- 4 files changed, 83 insertions(+), 42 deletions(-) diff --git a/deluge/plugins/blocklist/setup.py b/deluge/plugins/blocklist/setup.py index 3a0473e33..9475cf43e 100644 --- a/deluge/plugins/blocklist/setup.py +++ b/deluge/plugins/blocklist/setup.py @@ -35,7 +35,7 @@ __author__ = "Andrew Resch" __author_email__ = "andrew.resch@gmail.com" __version__ = "1.0" __url__ = "http://deluge-torrent.org" -__license__ = "GPL3" +__license__ = "GPLv3" __description__ = "Download and import IP blocklists" __long_description__ = __description__ __pkg_data__ = {__plugin_name__.lower(): ["data/*"]} diff --git a/deluge/plugins/label/setup.py b/deluge/plugins/label/setup.py index 6a8040609..b890cb18b 100644 --- a/deluge/plugins/label/setup.py +++ b/deluge/plugins/label/setup.py @@ -28,7 +28,16 @@ # this exception statement from your version. If you delete this exception # statement from all source files in the program, then also delete it here. -""" +from setuptools import setup + +__plugin_name__ = "Label" +__author__ = "Martijn Voncken" +__author_email__ = "mvoncken@gmail.com" +__version__ = "0.1" +__url__ = "http://deluge-torrent.org" +__license__ = "GPLv3" +__description__ = "Label plugin." +__long_description__ = """ Label plugin. Offers filters on state,tracker and keyword. @@ -37,24 +46,27 @@ adds a tracker column. future: Real labels. """ - -from setuptools import setup - -__author__ = "Martijn Voncken " +__pkg_data__ = {__plugin_name__.lower(): ["template/*", "data/*"]} setup( - name="Label", - version="0.1", - description=__doc__, + name=__plugin_name__, + version=__version__, + description=__description__, author=__author__, - packages=["label","label.gtkui","label.webui"], - package_data = {"label": ["template/*","data/*"]}, + author_email=__author_email__, + url=__url__, + license=__license__, + long_description=__long_description__, + + packages=[__plugin_name__.lower()], + package_data = __pkg_data__, + entry_points=""" [deluge.plugin.core] - Label = label:CorePlugin - [deluge.plugin.webui] - Label = label:WebUIPlugin + %s = %s:CorePlugin [deluge.plugin.gtkui] - Label = label:GtkUIPlugin - """ + %s = %s:GtkUIPlugin + [deluge.plugin.webui] + %s = %s:WebUIPlugin + """ % ((__plugin_name__, __plugin_name__.lower())*3) ) diff --git a/deluge/plugins/stats/setup.py b/deluge/plugins/stats/setup.py index 682a1fd63..b025a5c8e 100644 --- a/deluge/plugins/stats/setup.py +++ b/deluge/plugins/stats/setup.py @@ -36,21 +36,35 @@ from setuptools import setup -__author__ = "Martijn Voncken " +__plugin_name__ = "Stats" +__author__ = "Martijn Voncken" +__author_email__ = "mvoncken@gmail.com" +__version__ = "0.1" +__url__ = "http://deluge-torrent.org" +__license__ = "GPLv3" +__description__ = "" +__long_description__ = """""" +__pkg_data__ = {__plugin_name__.lower(): ["template/*", "data/*"]} setup( - name="Stats", - version="0.1", - description=__doc__, + name=__plugin_name__, + version=__version__, + description=__description__, author=__author__, - packages=["stats"], - package_data = {"stats": ["template/*","data/*"]}, + author_email=__author_email__, + url=__url__, + license=__license__, + long_description=__long_description__, + + packages=[__plugin_name__.lower()], + package_data = __pkg_data__, + entry_points=""" [deluge.plugin.core] - Stats = stats:CorePlugin - [deluge.plugin.webui] - Stats = stats:WebUIPlugin + %s = %s:CorePlugin [deluge.plugin.gtkui] - Stats = stats:GtkUIPlugin - """ + %s = %s:GtkUIPlugin + [deluge.plugin.webui] + %s = %s:WebUIPlugin + """ % ((__plugin_name__, __plugin_name__.lower())*3) ) diff --git a/deluge/scripts/create_plugin.py b/deluge/scripts/create_plugin.py index 8ce21fe29..c4204221f 100644 --- a/deluge/scripts/create_plugin.py +++ b/deluge/scripts/create_plugin.py @@ -14,6 +14,7 @@ parser.add_option("-n", "--name", dest="name",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") +parser.add_option("-u", "--url", dest="url", help="Homepage URL") (options, args) = parser.parse_args() @@ -33,6 +34,9 @@ def create_plugin(): print "--author-name is mandatory , use -h for more info" return + if not options.url: + options.url = "" + if not os.path.exists(options.path): print "basepath does not exist" return @@ -54,6 +58,7 @@ def create_plugin(): "safe_name":safe_name, "filename":filename, "plugin_base":plugin_base, + "url": options.url } filename = os.path.join(path, filename) @@ -153,23 +158,37 @@ class GtkUIPlugin(PluginBase): SETUP = """ from setuptools import setup -__author__ = "%(author_name)s <%(author_email)s>" +__plugin_name__ = "%(name)s" +__author__ = "%(author_name)s" +__author_email__ = "%(author_email)s" +__version__ = "0.1" +__url__ = "%(url)s" +__license__ = "GPLv3" +__description__ = "" +__long_description__ = \"\"\"\"\"\" +__pkg_data__ = {__plugin_name__.lower(): ["template/*", "data/*"]} setup( - name="%(name)s", - version="0.1", - description=__doc__, + name=__plugin_name__, + version=__version__, + description=__description__, author=__author__, - packages=["%(safe_name)s"], - package_data = {"%(safe_name)s": ["template/*","data/*"]}, + author_email=__author_email__, + url=__url__, + license=__license__, + long_description=__long_description__, + + packages=[__plugin_name__.lower()], + package_data = __pkg_data__, + entry_points=\"\"\" [deluge.plugin.core] - %(name)s = %(safe_name)s:CorePlugin - [deluge.plugin.webui] - %(name)s = %(safe_name)s:WebUIPlugin + %%s = %%s:CorePlugin [deluge.plugin.gtkui] - %(name)s = %(safe_name)s:GtkUIPlugin - \"\"\" + %%s = %%s:GtkUIPlugin + [deluge.plugin.webui] + %%s = %%s:WebUIPlugin + \"\"\" %% ((__plugin_name__, __plugin_name__.lower())*3) ) """ @@ -344,7 +363,3 @@ rm -fr ./temp """ create_plugin() - - - -