Permalink
Fetching contributors…
Cannot retrieve contributors at this time
executable file 50 lines (40 sloc) 1.33 KB
#! /usr/bin/env python
from optparse import OptionParser
import os
parser = OptionParser()
parser.add_option("-e", "--environment", dest="environment",
help="What kind of deployment", default="dev")
parser.add_option("-x", "--extraconfig", dest="extraconfig",
help="A cfg file to add to the buildout \"extends\".",
default="")
parser.add_option("-c", "--use-checkout", dest="checkout", action="store_true",
help="Don't fetch eggs for any packages where code is " \
"available locally", default=False)
options, args = parser.parse_args()
template = "[buildout]\n" \
"extends =\n" \
"%(extends)s\n" \
"cwd = %(cwd)s\n" \
"\n%(autodevelop)s"
extends = [
"crane/base.cfg"
]
if options.environment != "dev":
extends.extend([
"crane/fullstack.cfg",
"crane/environment/%s/environment.cfg" % options.environment,
])
if options.extraconfig:
extends.append(options.extraconfig)
if options.checkout:
autodevelop = "[autodevelop]\n" \
"mode = checkout"
else:
autodevelop = ""
open("buildout.cfg", "w").write(
template % {
"extends": "\n".join(" %s" % e for e in extends),
"cwd": os.getcwd(),
"autodevelop": autodevelop,
}
)