diff options
| author | Jeff Epler <jeff@adafruit.com> | 2020-08-07 10:08:17 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-07 10:08:17 -0500 |
| commit | 8f6950eb3c2bb5b756a86fa4ba4692de480f08d9 (patch) | |
| tree | a5da4a2c4c42f459b91c5179e47329361b967c9b /conf.py | |
| parent | d8cc4795be4d327be980f02f3be5f90d625bd286 (diff) | |
| parent | 3a954801788d052ed15bca2ec4d5e6aed7d09583 (diff) | |
Merge pull request #3246 from sommersoft/doc_title_tag
RTD: Set Version/Release For Sphinx
Diffstat (limited to 'conf.py')
| -rw-r--r-- | conf.py | 21 |
1 files changed, 20 insertions, 1 deletions
@@ -20,6 +20,7 @@ import json import logging import os +import re import subprocess import sys import urllib.parse @@ -106,7 +107,25 @@ copyright = '2014-2020, MicroPython & CircuitPython contributors (https://github # # We don't follow "The short X.Y version" vs "The full version, including alpha/beta/rc tags" # breakdown, so use the same version identifier for both to avoid confusion. -version = release = '0.0.0' + +final_version = "" +git_describe = subprocess.run( + ["git", "describe", "--dirty", "--tags"], + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + encoding="utf-8" +) +if git_describe.returncode == 0: + git_version = re.search( + r"^\d(?:\.\d){0,2}(?:\-(?:alpha|beta|rc)\.\d+){0,1}", + str(git_describe.stdout) + ) + if git_version: + final_version = git_version[0] +else: + print("Failed to retrieve git version:", git_describe.stdout) + +version = release = final_version # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. |
