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

Commit

Permalink
update sphinx configuration
Browse files Browse the repository at this point in the history
should appease deployment
  • Loading branch information
ShineyDev committed Apr 1, 2021
1 parent bd649fe commit 55f441d
Showing 1 changed file with 26 additions and 6 deletions.
32 changes: 26 additions & 6 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,33 @@
import re

project = "discord-ext-ipc"
copyright = "2021, Ext-Creators"
copyright = "2020-present, Ext-Creators"
author = "Ext-Creators"

_version_regex = r"^version = ('|\")((?:[0-9]+\.)*[0-9]+(?:\.?([a-z]+)(?:\.?[0-9])?)?)\1$"

with open("../discord/ext/ipc/__init__.py") as stream:
release = version = re.search(
r"^__version__\s*=\s*[\'\"]([^\'\"]*)[\'\"]", stream.read(), re.MULTILINE
).group(1)
match = re.search(_version_regex, stream.read(), re.MULTILINE)

version = match.group(2)

if match.group(3) is not None:
try:
import subprocess

process = subprocess.Popen(["git", "rev-list", "--count", "HEAD"], stdout=subprocess.PIPE)
out, _ = process.communicate()
if out:
version += out.decode("utf-8").strip()

process = subprocess.Popen(["git", "rev-parse", "--short", "HEAD"], stdout=subprocess.PIPE)
out, _ = process.communicate()
if out:
version += "+g" + out.decode("utf-8").strip()
except (Exception) as e:
pass

release = version


extensions = [
Expand All @@ -19,16 +39,16 @@
]


html_theme = "sphinx_rtd_theme"

autodoc_typehints = "none"

intersphinx_mapping = {
"aiohttp": ("https://docs.aiohttp.org/en/stable/", None),
"python": ("https://docs.python.org/3", None),
"discord": ("https://discordpy.readthedocs.io/en/latest", None),
}

highlight_language = "python3"
html_theme = "sphinx_rtd_theme"
master_doc = "index"
pygments_style = "friendly"
source_suffix = ".rst"

0 comments on commit 55f441d

Please sign in to comment.