mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Add the hg revision ID to __version__ when running a non-released version.
This commit is contained in:
parent
ee9221d52d
commit
8e9682819a
@ -13,10 +13,25 @@ import sys
|
|||||||
from os import path
|
from os import path
|
||||||
|
|
||||||
__version__ = '0.6.2+'
|
__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__))
|
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 setup.py, 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):
|
def main(argv=sys.argv):
|
||||||
if sys.version_info[:3] < (2, 4, 0):
|
if sys.version_info[:3] < (2, 4, 0):
|
||||||
|
@ -84,7 +84,7 @@ class Sphinx(object):
|
|||||||
self._events = events.copy()
|
self._events = events.copy()
|
||||||
|
|
||||||
# say hello to the world
|
# say hello to the world
|
||||||
self.info(bold('Running Sphinx v%s' % sphinx.__released__))
|
self.info(bold('Running Sphinx v%s' % sphinx.__version__))
|
||||||
|
|
||||||
# status code for command-line application
|
# status code for command-line application
|
||||||
self.statuscode = 0
|
self.statuscode = 0
|
||||||
|
Loading…
Reference in New Issue
Block a user