Mercurial > p > roundup > code
comparison doc/conf.py @ 4837:bf786562ba7f
doc/conf.py: Clear sys.path before importing Roundup __version__
This ensures that 'unkown version' is inserted when
`roundup` is importable from other location in sys.path
| author | anatoly techtonik <techtonik@gmail.com> |
|---|---|
| date | Wed, 25 Sep 2013 15:35:11 +0300 |
| parents | 76460d14be91 |
| children | b26176334c88 |
comparison
equal
deleted
inserted
replaced
| 4836:fdcd7ef5bacf | 4837:bf786562ba7f |
|---|---|
| 11 # All configuration values have a default; values that are commented out | 11 # All configuration values have a default; values that are commented out |
| 12 # serve to show the default. | 12 # serve to show the default. |
| 13 | 13 |
| 14 import sys, os | 14 import sys, os |
| 15 | 15 |
| 16 | |
| 17 # Read Roundup version by importing it from parent directory, | |
| 18 # this ensures that 'unkown version' is inserted even if | |
| 19 # `roundup` is importable from other location in sys.path | |
| 20 SYSSAVE = sys.path | |
| 21 DOCROOT = os.path.abspath(os.path.dirname(__file__)) | |
| 22 sys.path = [os.path.dirname(DOCROOT)] | |
| 16 try: | 23 try: |
| 17 sys.path.insert(0, os.pardir) | 24 from roundup import __version__ as VERSION |
| 18 from roundup import __version__ as roundupversion | 25 SHORTVER = '.'.join(VERSION.split('.', 2)[:2]) |
| 19 sys.path.pop(0) | |
| 20 except ImportError: | 26 except ImportError: |
| 21 roundupversion = '(unknown version)' | 27 VERSION = SHORTVER = '(unknown version)' |
| 28 finally: | |
| 29 sys.path = SYSSAVE | |
| 30 | |
| 22 | 31 |
| 23 # If your extensions are in another directory, add it here. If the directory | 32 # If your extensions are in another directory, add it here. If the directory |
| 24 # is relative to the documentation root, use os.path.abspath to make it | 33 # is relative to the documentation root, use os.path.abspath to make it |
| 25 # absolute, like shown here. | 34 # absolute, like shown here. |
| 26 #sys.path.append(os.path.abspath('.')) | 35 #sys.path.append(os.path.abspath('.')) |
| 51 # The version info for the project you're documenting, acts as replacement for | 60 # The version info for the project you're documenting, acts as replacement for |
| 52 # |version| and |release|, also used in various other places throughout the | 61 # |version| and |release|, also used in various other places throughout the |
| 53 # built documents. | 62 # built documents. |
| 54 # | 63 # |
| 55 # The short X.Y version. | 64 # The short X.Y version. |
| 56 version = '.'.join(roundupversion.split('.', 2)[:2]) | 65 version = SHORTVER |
| 57 # The full version, including alpha/beta/rc tags. | 66 # The full version, including alpha/beta/rc tags. |
| 58 release = roundupversion | 67 release = VERSION |
| 59 | 68 |
| 60 # The language for content autogenerated by Sphinx. Refer to documentation | 69 # The language for content autogenerated by Sphinx. Refer to documentation |
| 61 # for a list of supported languages. | 70 # for a list of supported languages. |
| 62 #language = None | 71 #language = None |
| 63 | 72 |
