Skip to content

Commit

Permalink
Replace deprecated pkg_resources usage with importlib.metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
ushkarev committed Jan 11, 2024
1 parent 77ffcc8 commit 798a920
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,13 @@
import mtp_common

# NB: this version does not need to be updated unless mtp_common changes significantly
if mtp_common.VERSION < (10,):
if mtp_common.VERSION < (16,):
raise ImportError
except ImportError:
try:
import pkg_resources
except ImportError:
raise SystemExit('setuptools and pip are required')
try:
pip = pkg_resources.load_entry_point('pip', 'console_scripts', 'pip')
except pkg_resources.ResolutionError:
raise SystemExit('setuptools and pip are required')
import importlib.metadata

(entry_point,) = importlib.metadata.entry_points(name='pip', group='console_scripts')
pip = entry_point.load()

print('Pre-installing MTP-common and base requirements')
pip(['install', '--requirement', f'{root_path}/requirements/base.txt'])
Expand Down

0 comments on commit 798a920

Please sign in to comment.