Change the docs to not require library installation

This commit is contained in:
Jason Paryani
2013-08-18 22:20:37 -07:00
parent 3c74c5d244
commit fdb427fb5c
2 changed files with 15 additions and 42 deletions

View File

@@ -48,18 +48,22 @@ copyright = u'2013, Author'
# built documents.
#
# The short X.Y version.
import pkg_resources
try:
release = pkg_resources.get_distribution('capnp').version
except pkg_resources.DistributionNotFound:
print 'To build the documentation, The distribution information of sandman'
print 'Has to be available. Either install the package into your'
print 'development environment or run "setup.py develop" to setup the'
print 'metadata. A virtualenv is recommended!'
sys.exit(1)
del pkg_resources
def extract_version():
"""extract version from version.py, so it's not multiply defined"""
with open(os.path.join('..', 'capnp', 'version.py')) as f:
line = f.readline()
while not line.startswith("version"):
line = f.readline()
print line
exec(line)
return version
version = '.'.join(release.split('.')[:2])
vs = extract_version()
# The short X.Y version.
import string
version = vs.rstrip(string.letters)
# The full version, including alpha/beta/rc tags.
release = vs
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.