File tree 3 files changed +22
-25
lines changed
3 files changed +22
-25
lines changed Original file line number Diff line number Diff line change 8
8
9
9
import datetime
10
10
import pathlib
11
+ import sys
12
+ package_dir = pathlib .Path (__file__ ).parent .parent / 'lxmlh'
13
+ sys .path .insert (0 , str (package_dir .resolve ()))
14
+
15
+ from version import __version__
11
16
12
17
project = 'lxmlh'
13
18
copyright = f'{ datetime .date .today ().year } , Mina Sami'
14
19
author = 'Mina Sami'
15
-
16
- version_file = pathlib .Path (__file__ ).parent .parent / 'lxmlh' / 'VERSION'
17
- # Read the version number from VERSION file
18
- with open (version_file , 'r' , encoding = 'UTF-8' ) as vf :
19
- # The full version, including alpha/beta/rc tags
20
- release_list = vf .read ().strip ().split ('.' )
21
- release = '.' .join (release_list )
20
+ release = __version__
22
21
23
22
# -- General configuration ---------------------------------------------------
24
23
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Original file line number Diff line number Diff line change 1
1
"""lxmlh."""
2
- import importlib .metadata
3
- from typing import Tuple , Union
4
-
5
2
from .config import TIMESTAMP_FORMAT , TYPE_DEFAULTS , TYPE_FUNC_MAP
6
3
from .helpers import (
7
4
create_attribute ,
21
18
validate_file ,
22
19
validate_zip_file ,
23
20
)
21
+ from .version import __version__
24
22
25
23
__all__ = (
26
24
"__version__" ,
42
40
"validate_file" ,
43
41
"validate_zip_file" ,
44
42
)
45
-
46
-
47
- def _get_version_tuple () -> Tuple [Union [int , str ]]:
48
- def as_integer (string : str ) -> Union [int , str ]:
49
- try :
50
- return int (string )
51
- except ValueError : # pragma: no cover
52
- return string # pragma: no cover
53
-
54
- return tuple (
55
- as_integer (v ) for v in importlib .metadata .version ("lxmlh" ).strip ().split ("." )
56
- )
57
-
58
-
59
- __version__ = _get_version_tuple ()
Original file line number Diff line number Diff line change
1
+ """Version information for lxmlh package."""
2
+ import pathlib
3
+
4
+
5
+ def _get_version ():
6
+ """Return the version number."""
7
+ versionFile = pathlib .Path (__file__ ).parent / "VERSION"
8
+ # Read the version number from VERSION file
9
+ with open (versionFile , "r" , encoding = "UTF-8" ) as vf :
10
+ # The full version, including alpha/beta/rc tags
11
+ versionList = vf .read ().strip ().split ("." )
12
+ return "." .join (versionList )
13
+
14
+
15
+ __version__ = _get_version ()
You can’t perform that action at this time.
0 commit comments