Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure noarch dir is added to path when abi3 c extensions are used. #11905

Merged
merged 1 commit into from
Feb 20, 2024
Merged
Changes from all commits
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
17 changes: 11 additions & 6 deletions kolibri/utils/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,20 @@ def prepend_cext_path(dist_path):
else:
dirname = os.path.join(dirname, python_version + "mu")

dirname = os.path.join(dirname, machine_name)
arch_dirname = os.path.join(dirname, machine_name)
noarch_dir = os.path.join(dist_path, "cext")
if sys.version_info >= (3, 6) and os.path.exists(abi3_dirname):
abi3_dir_exists = sys.version_info >= (3, 6) and os.path.exists(abi3_dirname)
arch_dir_exists = os.path.exists(arch_dirname)
# If either the abi3 or arch directory exists, add the noarch directory to sys.path
if abi3_dir_exists or arch_dir_exists:
# Add the noarch (OpenSSL) modules to sys.path
sys.path = [str(noarch_dir)] + sys.path

if abi3_dir_exists:
sys.path = [str(abi3_dirname)] + sys.path

if os.path.exists(dirname):
if arch_dir_exists:
# If the directory of platform-specific cextensions (cryptography) exists,
# add it + the matching noarch (OpenSSL) modules to sys.path
sys.path = [str(dirname), str(noarch_dir)] + sys.path
sys.path = [str(arch_dirname)] + sys.path
else:
logging.basicConfig(format="%(levelname)s: %(message)s", level=logging.INFO)
logging.StreamHandler(sys.stdout)
Expand Down
Loading