and use some of the functions in this module in order to specify
new applications.
+To specify custom applications as plugins, add the following ``entry_points``
+configuration::
+
+ [wizard.app]
+ yourappname = your.module:Application
+ otherappname = your.other.module:Application
+
+.. note::
+
+ Wizard will complain loudly if ``yourappname`` conflicts with an
+ application name defined by someone else.
+
There are some submodules for programming languages that define common
functions and data that may be used by applications in that language. See:
import string
import urlparse
import tempfile
+import pkg_resources
import wizard
from wizard import resolve, scripts, shell, util
-_application_list = [
+# SCRIPTS SPECIFIC
+_scripts_application_list = [
"mediawiki", "wordpress", "joomla", "e107", "gallery2",
"phpBB", "advancedbook", "phpical", "trac", "turbogears", "django",
# these are technically deprecated
"advancedpoll", "gallery",
]
-_applications = None
+def _scripts_make(name):
+ """Makes an application, but uses the correct subtype if available."""
+ try:
+ __import__("wizard.app." + name)
+ return getattr(wizard.app, name).Application(name)
+ except ImportError as error:
+ # XXX ugly hack to check if the import error is from the top level
+ # module we care about or a submodule. should be an archetectural change.
+ if error.args[0].split()[-1]==name:
+ return Application(name)
+ else:
+ raise
+_applications = None
def applications():
"""Hash table for looking up string application name to instance"""
global _applications
if not _applications:
- _applications = dict([(n,Application.make(n)) for n in _application_list ])
+ # SCRIPTS SPECIFIC
+ _applications = dict([(n,_scripts_make(n)) for n in _scripts_application_list ])
+ # setup plugins
+ for dist in pkg_resources.working_set:
+ for appname, appclass in dist.get_entry_map("wizard.app").items():
+ if appname in _applications:
+ newname = dist.key + ":" + appname
+ if newname in _applications:
+ raise Exception("Unrecoverable application name conflict for %s from %s", appname, dist.key)
+ logging.warning("Could not overwrite %s, used %s instead", appname, newname)
+ appname = newname
+ _applications[appname] = appclass(appname)
return _applications
def getApplication(appname):
shell.call("git", "rm", file)
continue
# manual resolutions
+ # XXX: this functionality is mostly subsumed by the rerere
+ # tricks we do
if file in self.resolutions:
contents = open(file, "r").read()
for spec, result in self.resolutions[file]:
be displayed in verbose mode.
"""
return filename in self.parametrized_files
- @staticmethod
- def make(name):
- """Makes an application, but uses the correct subtype if available."""
- try:
- __import__("wizard.app." + name)
- return getattr(wizard.app, name).Application(name)
- except ImportError as error:
- # XXX ugly hack to check if the import error is from the top level
- # module we care about or a submodule. should be an archetectural change.
- if error.args[0].split()[-1]==name:
- return Application(name)
- else:
- raise
class ApplicationVersion(object):
"""Represents an abstract notion of a version for an application, where