Rename arguments and make a few more optional, for convenience.

This commit is contained in:
Georg Brandl 2010-02-21 15:36:26 +01:00
parent 7b86a2f3c2
commit a497d65658
2 changed files with 10 additions and 9 deletions

View File

@ -61,8 +61,8 @@ ENV_PICKLE_FILENAME = 'environment.pickle'
class Sphinx(object): class Sphinx(object):
def __init__(self, srcdir, confdir, outdir, doctreedir, buildername, def __init__(self, srcdir, confdir, outdir, doctreedir, buildername,
confoverrides, status, warning=sys.stderr, freshenv=False, confoverrides=None, status=sys.stdout, warning=sys.stderr,
warningiserror=False, tags=None): freshenv=False, warningiserror=False, tags=None):
self.next_listener_id = 0 self.next_listener_id = 0
self._extensions = {} self._extensions = {}
self._listeners = {} self._listeners = {}
@ -100,7 +100,8 @@ class Sphinx(object):
# read config # read config
self.tags = Tags(tags) self.tags = Tags(tags)
self.config = Config(confdir, CONFIG_FILENAME, confoverrides, self.tags) self.config = Config(confdir, CONFIG_FILENAME,
confoverrides or {}, self.tags)
self.config.check_unicode(self.warn) self.config.check_unicode(self.warn)
# load all extension modules # load all extension modules
@ -189,9 +190,9 @@ class Sphinx(object):
self.builder = builderclass(self) self.builder = builderclass(self)
self.emit('builder-inited') self.emit('builder-inited')
def build(self, all_files, filenames): def build(self, force_all=False, filenames=None):
try: try:
if all_files: if force_all:
self.builder.build_all() self.builder.build_all()
elif filenames: elif filenames:
self.builder.build_specific(filenames) self.builder.build_specific(filenames)

View File

@ -89,8 +89,8 @@ def main(argv):
if err: if err:
return 1 return 1
buildername = all_files = None buildername = None
freshenv = warningiserror = use_pdb = False force_all = freshenv = warningiserror = use_pdb = False
status = sys.stdout status = sys.stdout
warning = sys.stderr warning = sys.stderr
error = sys.stderr error = sys.stderr
@ -105,7 +105,7 @@ def main(argv):
if filenames: if filenames:
usage(argv, 'Cannot combine -a option and filenames.') usage(argv, 'Cannot combine -a option and filenames.')
return 1 return 1
all_files = True force_all = True
elif opt == '-t': elif opt == '-t':
tags.append(val) tags.append(val)
elif opt == '-d': elif opt == '-d':
@ -167,7 +167,7 @@ def main(argv):
app = Sphinx(srcdir, confdir, outdir, doctreedir, buildername, app = Sphinx(srcdir, confdir, outdir, doctreedir, buildername,
confoverrides, status, warning, freshenv, confoverrides, status, warning, freshenv,
warningiserror, tags) warningiserror, tags)
app.build(all_files, filenames) app.build(force_all, filenames)
return app.statuscode return app.statuscode
except KeyboardInterrupt: except KeyboardInterrupt:
if use_pdb: if use_pdb: