Skip to content

Commit e7d5e9f

Browse files
committed
Update the version check
Recent versions of setuptools, which includes the pkg_resources module, return the module name in lowercase. Make the check compatible with both older and newer versions by comparing the lowercase name. Also, remove the hardcoded uppercase module name and use `__name__` instead.
1 parent 30f4c1e commit e7d5e9f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lnt/lnttool/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,15 +471,15 @@ def _version_check():
471471

472472
# Get the current distribution.
473473
installed_dist = pkg_resources.get_distribution("LNT")
474-
if installed_dist.project_name != "LNT" or \
474+
if installed_dist.project_name.lower() != lnt.__name__ or \
475475
pkg_resources.parse_version(installed_dist.version) != \
476476
pkg_resources.parse_version(lnt.__version__):
477477
raise SystemExit("""\
478478
error: installed distribution %s %s is not current (%s %s), you may need to reinstall
479479
LNT or rerun 'setup.py develop' if using development mode.""" % (
480480
installed_dist.project_name,
481481
installed_dist.version,
482-
"LNT", lnt.__version__))
482+
lnt.__name__, lnt.__version__))
483483

484484

485485
def show_version(ctx, param, value):

0 commit comments

Comments
 (0)