Skip to content

Commit a5f19aa

Browse files
committed
Fix version finding in docs/source/conf.
1 parent 21b9ff9 commit a5f19aa

File tree

1 file changed

+6
-19
lines changed

1 file changed

+6
-19
lines changed

docs/source/conf.py

+6-19
Original file line numberDiff line numberDiff line change
@@ -15,39 +15,26 @@
1515
# sys.path.insert(0, os.path.abspath('.'))
1616

1717
import os
18-
import io
19-
import re
2018
import sys
2119
import warnings
2220
import sphinx_rtd_theme # noqa
2321
from typing import ForwardRef
2422

2523

26-
def read(*names, **kwargs):
27-
with io.open(
28-
os.path.join(os.path.dirname(__file__), "..", "..", *names), encoding=kwargs.get("encoding", "utf8")
29-
) as fp:
30-
return fp.read()
31-
32-
33-
def find_version(*file_paths):
34-
version_file = read(*file_paths)
35-
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M)
36-
if version_match:
37-
return version_match.group(1)
38-
raise RuntimeError("Unable to find version string.")
39-
40-
4124
sys.path.append(os.path.abspath(os.path.join(__file__, "..", "..", "..")))
4225

4326
# -- Project information -----------------------------------------------------
4427

4528
project = "linear_operator"
46-
copyright = "2020, Cornellius GP"
29+
copyright = "2022, Cornellius GP"
4730
author = "Cornellius GP"
4831

4932
# The full version, including alpha/beta/rc tags
50-
version = find_version("linear_operator", "__init__.py")
33+
try:
34+
from linear_operator.version import version
35+
except Exception: # pragma: no cover
36+
version = "Unknown" # pragma: no cover
37+
5138
release = version
5239

5340

0 commit comments

Comments
 (0)