File tree 1 file changed +16
-4
lines changed
1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change 1
1
import pathlib
2
2
import sys
3
3
4
- basedir = pathlib .Path (__file__ ).parent .parent
4
+ src_directory = (pathlib .Path (__file__ ).parent .parent / "src" ).resolve ()
5
+ sys .path .insert (0 , str (src_directory ))
6
+
7
+
8
+ # Extract the current version from the source.
9
+ def get_version ():
10
+ """Get the version and release from the source code."""
11
+
12
+ text = (src_directory / "cachetools/__init__.py" ).read_text ()
13
+ for line in text .splitlines ():
14
+ if not line .strip ().startswith ("__version__" ):
15
+ continue
16
+ full_version = line .partition ("=" )[2 ].strip ().strip ("\" '" )
17
+ partial_version = "." .join (full_version .split ("." )[:2 ])
18
+ return full_version , partial_version
5
19
6
- sys .path .insert (0 , str ((basedir / "src" ).resolve ()))
7
20
8
21
project = "cachetools"
9
22
copyright = "2014-2023 Thomas Kemmer"
10
- version = "5.3"
11
- release = "5.3.1"
23
+ release , version = get_version ()
12
24
13
25
extensions = [
14
26
"sphinx.ext.autodoc" ,
You can’t perform that action at this time.
0 commit comments