Skip to content

Commit 14f85b7

Browse files
committed
Fix urwid compatibility
1 parent 8122ea1 commit 14f85b7

File tree

3 files changed

+16
-29
lines changed

3 files changed

+16
-29
lines changed

requirements.txt

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1 @@
1-
# =============================================================================
2-
# DEPRECATION WARNING:
3-
#
4-
# The file `requirements.txt` does not influence the package dependencies and
5-
# will not be automatically created in the next version of PyScaffold (v4.x).
6-
#
7-
# Please have look at the docs for better alternatives
8-
# (`Dependency Management` section).
9-
# =============================================================================
10-
#
11-
# Add your pinned requirements so that they can be easily installed with:
12-
# pip install -r requirements.txt
13-
# Remember to also add them in setup.cfg but unpinned.
14-
# Example:
15-
# numpy==1.13.3
16-
# scipy==1.0
17-
18-
urwid==2.0.1
1+
urwid==2.1.2

setup.cfg

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ package_dir =
2828
=src
2929
# DON'T CHANGE THE FOLLOWING LINE! IT WILL BE UPDATED BY PYSCAFFOLD!
3030
setup_requires = pyscaffold>=3.1a0,<3.2a0
31-
# Add here dependencies of your project (semicolon/line-separated), e.g.
32-
install_requires = urwid
31+
# Add here dependencies of your project (semicolon/line-separated)
32+
install_requires =
33+
urwid==2.1.2
3334
# The usage of test_requires is discouraged, see `Dependency Management` docs
3435
# tests_require = pytest; pytest-cov
3536
# Require a specific Python version, e.g. Python 2.7 or >= 3.4

src/redial/__init__.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
# -*- coding: utf-8 -*-
2-
from pkg_resources import get_distribution, DistributionNotFound
3-
42
try:
5-
# Change here if project is renamed and does not equal the package name
6-
dist_name = __name__
7-
__version__ = get_distribution(dist_name).version
8-
except DistributionNotFound:
9-
__version__ = 'unknown'
10-
finally:
11-
del get_distribution, DistributionNotFound
3+
from importlib.metadata import version, PackageNotFoundError
4+
try:
5+
__version__ = version("redial")
6+
except PackageNotFoundError:
7+
__version__ = 'unknown'
8+
except ImportError:
9+
# Fallback for Python < 3.8
10+
from pkg_resources import get_distribution, DistributionNotFound
11+
try:
12+
__version__ = get_distribution("redial").version
13+
except DistributionNotFound:
14+
__version__ = 'unknown'

0 commit comments

Comments
 (0)