Skip to content

Commit

Permalink
Consider also majorver.minorver variant of Python interpreter
Browse files Browse the repository at this point in the history
Signed-off-by: Nikola Forró <[email protected]>
  • Loading branch information
nforro committed Aug 12, 2024
1 parent 4e32b62 commit 4542abb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions rpm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,13 @@ def get_sitepackages(interpreter):
output = subprocess.check_output(command)
return json.loads(output.decode())

majorver, *_ = platform.python_version_tuple()
majorver, minorver, _ = platform.python_version_tuple()
# try platform-python first (it could be the only interpreter present on the system)
interpreters = ["/usr/libexec/platform-python", f"/usr/bin/python{majorver}"]
interpreters = [
"/usr/libexec/platform-python",
f"/usr/bin/python{majorver}",
f"/usr/bin/python{majorver}.{minorver}",
]
result = []
for interpreter in interpreters:
if not Path(interpreter).is_file():
Expand Down

0 comments on commit 4542abb

Please sign in to comment.