Skip to content
This repository was archived by the owner on Aug 28, 2021. It is now read-only.

Commit 55f441d

Browse files
committed
update sphinx configuration
should appease deployment
1 parent bd649fe commit 55f441d

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

docs/conf.py

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,33 @@
11
import re
22

33
project = "discord-ext-ipc"
4-
copyright = "2021, Ext-Creators"
4+
copyright = "2020-present, Ext-Creators"
55
author = "Ext-Creators"
66

7+
_version_regex = r"^version = ('|\")((?:[0-9]+\.)*[0-9]+(?:\.?([a-z]+)(?:\.?[0-9])?)?)\1$"
8+
79
with open("../discord/ext/ipc/__init__.py") as stream:
8-
release = version = re.search(
9-
r"^__version__\s*=\s*[\'\"]([^\'\"]*)[\'\"]", stream.read(), re.MULTILINE
10-
).group(1)
10+
match = re.search(_version_regex, stream.read(), re.MULTILINE)
11+
12+
version = match.group(2)
13+
14+
if match.group(3) is not None:
15+
try:
16+
import subprocess
17+
18+
process = subprocess.Popen(["git", "rev-list", "--count", "HEAD"], stdout=subprocess.PIPE)
19+
out, _ = process.communicate()
20+
if out:
21+
version += out.decode("utf-8").strip()
22+
23+
process = subprocess.Popen(["git", "rev-parse", "--short", "HEAD"], stdout=subprocess.PIPE)
24+
out, _ = process.communicate()
25+
if out:
26+
version += "+g" + out.decode("utf-8").strip()
27+
except (Exception) as e:
28+
pass
29+
30+
release = version
1131

1232

1333
extensions = [
@@ -19,16 +39,16 @@
1939
]
2040

2141

22-
html_theme = "sphinx_rtd_theme"
23-
2442
autodoc_typehints = "none"
43+
2544
intersphinx_mapping = {
2645
"aiohttp": ("https://docs.aiohttp.org/en/stable/", None),
2746
"python": ("https://docs.python.org/3", None),
2847
"discord": ("https://discordpy.readthedocs.io/en/latest", None),
2948
}
3049

3150
highlight_language = "python3"
51+
html_theme = "sphinx_rtd_theme"
3252
master_doc = "index"
3353
pygments_style = "friendly"
3454
source_suffix = ".rst"

0 commit comments

Comments
 (0)