"""Build all source files."""
- self.build(None, summary='all source files')
+ self.build(None, summary='all source files')
def build_specific(self, filenames):
"""Only rebuild as much as needed for changes in the source_filenames."""
filename = path.abspath(filename)[dirlen:]
filename = filename[:-len(suffix)]
+ filename = filename.replace(os.path.sep, SEP)
- summary='%d source files given on command line' % len(to_write))
+ self.build(to_write, method='specific',
+ summary='%d source files given on command '
+ 'line' % len(to_write))
"""Only rebuild files changed or added since last build."""
to_build = self.get_outdated_docs()
+ if not to_build and self.env.all_docs:
+ # if there is nothing in all_docs, it's a fresh env
self.info(bold('no target files are out of date, exiting.'))
if isinstance(to_build, str):
summary='targets for %d source files that are '
'out of date' % len(to_build))
- def build(self, docnames, summary=None):
+ def build(self, docnames, summary=None):
self.info(bold('building [%s]: ' % self.name), nonl=1)
# another indirection to support methods which don't build files
- self.write(docnames, updated_docnames)
+ self.write(docnames, updated_docnames)
# finish (write static files etc.)
- def write(self, build_docnames, updated_docnames):
- if build_docnames is None: # build_all
+ def write(self, build_docnames, updated_docnames, method='update'):
+ if build_docnames is None:
build_docnames = self.env.all_docs
- docnames = set(build_docnames) | set(updated_docnames)
+ # build updated ones as well
+ docnames = set(build_docnames) | set(updated_docnames)
# add all toctree-containing files that may have changed
for docname in list(docnames):