Skip to content

Commit

Permalink
Change from pkg_resources to importlib-metadata
Browse files Browse the repository at this point in the history
In a backwards compatible way for 3.6 for now

FIxes #253
  • Loading branch information
tfoote committed Jan 26, 2024
1 parent cd919bf commit 1fe5ede
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
import os
from setuptools import setup

# importlib-metadata dependency can be removed when RHEL8 and other 3.6 based systems are not in support cycles

install_requires = [
'empy',
'importlib-metadata; python_version < "3.8"',
'pexpect',
'packaging',
'urllib3',
Expand Down
12 changes: 9 additions & 3 deletions src/rocker/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@
import re
import sys

import pkg_resources
# importlib-metadata dependency can be removed when RHEL8 and other 3.6 based systems are not in support cycles
if sys.version_info >= (3, 8):
import importlib.metadata as importlib_metadata
else:
import importlib_metadata


import pkgutil
from requests.exceptions import ConnectionError
import shlex
Expand Down Expand Up @@ -459,7 +465,7 @@ def list_plugins(extension_point='rocker.extensions'):
unordered_plugins = {
entry_point.name: entry_point.load()
for entry_point
in pkg_resources.iter_entry_points(extension_point)
in importlib_metadata.entry_points().select(group=extension_point)
}
# Order plugins by extension point name for consistent ordering below
plugin_names = list(unordered_plugins.keys())
Expand All @@ -468,4 +474,4 @@ def list_plugins(extension_point='rocker.extensions'):


def get_rocker_version():
return pkg_resources.require('rocker')[0].version
return importlib_metadata.version('rocker')

0 comments on commit 1fe5ede

Please sign in to comment.