Initial commit to implement the "deluge.plugins" namespace package support.

This commit is contained in:
Pedro Algarvio 2010-12-09 22:05:34 +00:00
parent 1c7676bfe5
commit 16f617d240
14 changed files with 39 additions and 8 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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