Georg Brandl avatar Georg Brandl committed 2a7cd94

Add the hg revision ID to __version__ when running a non-released version.

Comments (0)

Files changed (2)


 from os import path
 __version__ = '0.6.2+'
-__released__ = '0.6.2'
+__released__ = '0.6.2'  # used when Sphinx builds its own docs
 package_dir = path.abspath(path.dirname(__file__))
+if '+' in __version__ or 'pre' in __version__:
+    # try to find out the changeset hash if checked out from hg, and append
+    # it to __version__ (since we use this value from, it gets
+    # automatically propagated to an installed copy as well)
+    try:
+        import subprocess
+        p = subprocess.Popen(['hg', 'id', '-i', '-R',
+                              path.join(package_dir, '..')],
+                             stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+        out, err = p.communicate()
+        if out:
+            __version__ += '/' + out.strip()
+    except Exception:
+        pass
 def main(argv=sys.argv):
     if sys.version_info[:3] < (2, 4, 0):


         self._events = events.copy()
         # say hello to the world
-'Running Sphinx v%s' % sphinx.__released__))
+'Running Sphinx v%s' % sphinx.__version__))
         # status code for command-line application
         self.statuscode = 0
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
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.