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 33# flake8: noqa F401
44"""This simply imports certain things for backwards compatibility."""
55
6- from pkg_resources import get_distribution , DistributionNotFound
76try :
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 :
1015 # package is not installed
1116 pass
1217
Original file line number Diff line number Diff line change 1919"""
2020# Import for custom theme from Read the Docs
2121import sphinx_rtd_theme
22- from pkg_resources import get_distribution
22+ import cmd2
2323
2424# -- General configuration -----------------------------------------------------
2525
5757# built documents.
5858#
5959# version will look like x.y.z
60- version = get_distribution ( ' cmd2' ). version
60+ version = cmd2 . __version__
6161# release will look like x.y
6262release = '.' .join (version .split ('.' )[:2 ])
6363
Original file line number Diff line number Diff line change 55An overview of what myplugin does.
66"""
77
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'
919
1020from .cmd2_ext_test import ExternalTestMixin
1121
1222__all__ = [
1323 'ExternalTestMixin'
1424]
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 3636INSTALL_REQUIRES = [
3737 'attrs >= 16.3.0' ,
3838 'colorama >= 0.3.7' ,
39+ 'importlib_metadata>=1.7.0;python_version<"3.8"' ,
3940 'pyperclip >= 1.6' ,
4041 'setuptools >= 34.4' ,
4142 'wcwidth >= 0.1.7' ,
You can’t perform that action at this time.
0 commit comments