Anonymous avatar Anonymous committed 1b2ec2a

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

Comments (0)

Files changed (2)

sphinx/builder.py

 
     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)
             to_write.append(filename)
-        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.'))
             return
         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)
             self.info(summary)
 
         # 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... '))
         else:
             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):

sphinx/ext/doctest.py

 
         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
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.