File tree Expand file tree Collapse file tree 4 files changed +22
-12
lines changed
plugins/ext_test/cmd2_ext_test Expand file tree Collapse file tree 4 files changed +22
-12
lines changed Original file line number Diff line number Diff line change 3
3
# flake8: noqa F401
4
4
"""This simply imports certain things for backwards compatibility."""
5
5
6
- from pkg_resources import get_distribution , DistributionNotFound
7
6
try :
8
- __version__ = get_distribution (__name__ ).version
9
- except DistributionNotFound :
7
+ # For python 3.8 and later
8
+ import importlib .metadata as importlib_metadata
9
+ except ImportError :
10
+ # For everyone else
11
+ import importlib_metadata
12
+ try :
13
+ __version__ = importlib_metadata .version (__name__ )
14
+ except importlib_metadata .PackageNotFoundError :
10
15
# package is not installed
11
16
pass
12
17
Original file line number Diff line number Diff line change 19
19
"""
20
20
# Import for custom theme from Read the Docs
21
21
import sphinx_rtd_theme
22
- from pkg_resources import get_distribution
22
+ import cmd2
23
23
24
24
# -- General configuration -----------------------------------------------------
25
25
57
57
# built documents.
58
58
#
59
59
# version will look like x.y.z
60
- version = get_distribution ( ' cmd2' ). version
60
+ version = cmd2 . __version__
61
61
# release will look like x.y
62
62
release = '.' .join (version .split ('.' )[:2 ])
63
63
Original file line number Diff line number Diff line change 5
5
An overview of what myplugin does.
6
6
"""
7
7
8
- from pkg_resources import DistributionNotFound , get_distribution
8
+ try :
9
+ # For python 3.8 and later
10
+ import importlib .metadata as importlib_metadata
11
+ except ImportError :
12
+ # For everyone else
13
+ import importlib_metadata
14
+ try :
15
+ __version__ = importlib_metadata .version (__name__ )
16
+ except importlib_metadata .PackageNotFoundError :
17
+ # package is not installed
18
+ __version__ = 'unknown'
9
19
10
20
from .cmd2_ext_test import ExternalTestMixin
11
21
12
22
__all__ = [
13
23
'ExternalTestMixin'
14
24
]
15
-
16
-
17
- try :
18
- __version__ = get_distribution (__name__ ).version
19
- except DistributionNotFound :
20
- __version__ = 'unknown'
Original file line number Diff line number Diff line change 36
36
INSTALL_REQUIRES = [
37
37
'attrs >= 16.3.0' ,
38
38
'colorama >= 0.3.7' ,
39
+ 'importlib_metadata>=1.7.0;python_version<"3.8"' ,
39
40
'pyperclip >= 1.6' ,
40
41
'setuptools >= 34.4' ,
41
42
'wcwidth >= 0.1.7' ,
You can’t perform that action at this time.
0 commit comments