Skip to content

Commit

Permalink
Ignore extension suffixes if the interpreter is Python 2
Browse files Browse the repository at this point in the history
  • Loading branch information
ian-hurst authored and ianh-edico committed Oct 31, 2024
1 parent 1ef19df commit ff35059
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions rpm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,20 @@ def get_system_sitepackages_and_suffixes() -> List[Dict[str, List[str]]]:
def get_sitepackages_and_suffixes(interpreter):
script = textwrap.dedent(
"""
import importlib
import importlib.machinery
import json
import site
try:
import importlib.machinery
except ImportError:
suffixes = []
else:
suffixes = importlib.machinery.EXTENSION_SUFFIXES
print(
json.dumps(
{
"sitepackages": site.getsitepackages(),
"suffixes": importlib.machinery.EXTENSION_SUFFIXES,
"suffixes": suffixes,
}
)
)
Expand Down

0 comments on commit ff35059

Please sign in to comment.