From 47861a6a3b847026bfc677ae896fbcbe171347ae Mon Sep 17 00:00:00 2001 From: Zsolt Dollenstein Date: Wed, 18 Sep 2019 14:00:18 +0100 Subject: [PATCH 1/1] fix doc generation --- Pipfile | 1 + Pipfile.lock | 10 +++++++++- docs/conf.py | 14 ++------------ 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/Pipfile b/Pipfile index 2c1389e..623f603 100644 --- a/Pipfile +++ b/Pipfile @@ -27,3 +27,4 @@ Sphinx = "*" setuptools = ">=39.2.0" twine = ">=1.11.0" wheel = ">=0.31.1" +setuptools-scm = "*" diff --git a/Pipfile.lock b/Pipfile.lock index 5b538a2..c5108b0 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "3d39e479c8bd8423cd8c494348fe70f12f5bbcf154d18cef59b720e2b03db4fb" + "sha256": "1e7537ef8102c7c4b5746b53247645a75fca24db7e0d94721fdcc8a62eb8a090" }, "pipfile-spec": 6, "requires": {}, @@ -539,6 +539,14 @@ ], "version": "==0.9.1" }, + "setuptools-scm": { + "hashes": [ + "sha256:1f11cb2eea431346d46589c2dafcafe2e7dc1c7b2c70bc4c3752d2048ad5c148", + "sha256:bd25e1fb5e4d603dcf490f1fde40fb4c595b357795674c3e5cb7f6217ab39ea5" + ], + "index": "pypi", + "version": "==3.3.3" + }, "six": { "hashes": [ "sha256:3350809f0555b11f552448330d0b52d5f24c91a322ea4a15ef22629740f3761c", diff --git a/docs/conf.py b/docs/conf.py index 6421d53..37a6f84 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -12,28 +12,18 @@ # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # -import ast from pathlib import Path import re import shutil import string +from setuptools_scm import get_version from recommonmark.parser import CommonMarkParser CURRENT_DIR = Path(__file__).parent -def get_version(): - import sys - - sys.path.append(str(CURRENT_DIR.parent)) - from _version import get_versions - - v = get_versions() - return v.get("closest-tag", v["version"]) - - def make_pypi_svg(version): template = CURRENT_DIR / "_static" / "pypi_template.svg" target = CURRENT_DIR / "_static" / "pypi.svg" @@ -94,7 +84,7 @@ author = "Łukasz Langa and contributors to Black" # Autopopulate version # The full version, including alpha/beta/rc tags. -release = get_version() +release = get_version(root=CURRENT_DIR.parent) # The short X.Y version. version = release for sp in "abcfr": -- 2.39.5