appstr = args[0]
dir = os.path.abspath(args[1])
+ web_stub_path = old_options.web_stub_path
if not old_options.retry and not old_options.help and os.path.exists(dir) and os.listdir(dir):
raise DirectoryExistsError
appname, _, version = appstr.partition('-')
application = app.getApplication(appname)
+ if application.needs_web_stub and web_stub_path is None:
+ raise NeedsWebStubError
+
# get configuration
schema = application.install_schema
- schema.commit(application, dir)
+ schema.commit(application, dir, web_stub_path)
options = None
opthandler = installopt.Controller(dir, schema)
parser = command.WizardOptionParser("""usage: %%prog install %s DIR [ -- SETUPARGS ]
if not old_options.retry and version and version != "head-scripts": # for ease in testing
shell.call("git", "reset", "-q", "--hard", appstr)
input.infobox("Installing...")
- application.install(distutils.version.LooseVersion(version), options)
+ v = distutils.version.LooseVersion(version)
+ if application.needs_web_stub:
+ application.install(v, options, web_stub_path)
+ else:
+ application.install(v, options)
if not old_options.no_commit:
git.commit_configure()
if not hasattr(options, "web_inferred"):
depending on what directory you are installing to.)"""
parser = command.WizardOptionParser(usage, store_help=True)
configure_parser(parser, baton)
+ parser.add_option("--web-stub-path", dest="web_stub_path",
+ default=None, help="Used on certain installations for indicating"
+ "where to place stub files for a web path.")
options, args = parser.parse_all(argv)
if options.help:
if len(args) == 0:
class DirectoryExistsError(wizard.Error):
def __str__(self):
return "Directory already exists and is not empty"
+
+class NeedsWebStubError(wizard.Error):
+ def __str__(self):
+ return "You need to specify a web stub directory for this application"
self.dir = dir
def prepare(self):
"""Uses :func:`wizard.scripts.get_web_host_and_path`."""
+ if self.dir is None:
+ raise StrategyFailed
self._url = scripts.fill_url(self.dir, None)
if not self._url:
raise StrategyFailed
Arg("web_path", type="PATH", help="Relative path to your application root"),
]
-class WebStubArgSet(ArgSet):
- """
- Common arguments for any application that has an extra folder
- necessary to place "stub" code for an application, i.e. a
- FastCGI script. Most Python applications will require this.
- """
- def __init__(self):
- self.args = [
- Arg("web_stub_path", type="PATH", help="Absolute path to the directory containing the web stub"),
- ]
-
class DbArgSet(ArgSet):
"""Common arguments for applications that use a database."""
def __init__(self):
"""
return {
'web': WebArgSet(),
- 'webstub': WebStubArgSet(),
'db': DbArgSet(),
'admin': AdminArgSet(),
'email': EmailArgSet(),
Valid identifiers for subclasses of :class:`ArgSet` are:
- * ``webstub``, which populates ``web_stub_path``.
* ``db``, which populates the option ``dsn``, which is a SQLAlchemy
database source name, with properties for ``drivername``,
``username``, ``password``, ``host``, ``port``, ``database`` and
def add(self, arg):
"""Adds an argument to our schema."""
self.args[arg.name] = arg
- def commit(self, application, dir):
+ def commit(self, application, dir, web_stub_path):
"""Populates :attr:`strategies` and :attr:`provides`"""
self.strategies = []
self.provides = set()
raw_strategies = [
EnvironmentStrategy(self),
ScriptsWebStrategy(dir),
+ ScriptsWebStrategy(web_stub_path),
ScriptsMysqlStrategy(application, dir),
ScriptsEmailStrategy(),
]