Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions selinux/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,7 @@ def add_location(location):

def get_system_sitepackages():
"""Get sitepackage locations from system python"""
# Do not ever use sys.executable here
# See https://github.com/pycontribs/selinux/issues/17 for details
system_python = "/usr/bin/python%s" % ".".join(
[str(item) for item in platform.python_version_tuple()[0:2]]
)
system_python = sys.executable

@ssbarnea ssbarnea Mar 14, 2023

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will break badly as it will pick a local python when run from within a virtualenv, and it fail to discover the system python, which is likely the only one that might have the _selinux binary extension installed.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wrote a more elaborate fix, is this one acceptable?


system_sitepackages = json.loads(
subprocess.check_output(
Expand Down