1. Georg Brandl
  2. sphinx


georg.brandl  committed 1b2ec2a

Fix a case where nothing is built if the environment is fresh.

  • Participants
  • Parent commits ed30050
  • Branches default

Comments (0)

Files changed (2)

File sphinx/builder.py

View file
     def build_all(self):
         """Build all source files."""
-        self.build(None, summary='all source files')
+        self.build(None, summary='all source files', method='all')
     def build_specific(self, filenames):
         """Only rebuild as much as needed for changes in the source_filenames."""
             filename = path.abspath(filename)[dirlen:]
             if filename.endswith(suffix):
                 filename = filename[:-len(suffix)]
+            filename = filename.replace(os.path.sep, SEP)
-        self.build(to_write,
-                   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))
     def build_update(self):
         """Only rebuild files changed or added since last build."""
         to_build = self.get_outdated_docs()
-        if not to_build:
+        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, method='update'):
         if summary:
             self.info(bold('building [%s]: ' % self.name), nonl=1)
         # another indirection to support methods which don't build files
         # individually
-        self.write(docnames, updated_docnames)
+        self.write(docnames, updated_docnames, method)
         # finish (write static files etc.)
         self.info(bold('finishing... '))
             self.info(bold('build succeeded.'))
-    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_all
             build_docnames = self.env.all_docs
-        docnames = set(build_docnames) | set(updated_docnames)
+        if method == 'update':
+            # 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):

File sphinx/ext/doctest.py

View file
         sys.path[0:0] = self.config.doctest_path
-    def write(self, build_docnames, updated_docnames):
+    def write(self, build_docnames, updated_docnames, method='update'):
         if build_docnames is None:
             build_docnames = self.env.all_docs