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

Use "/sbin/ldconfig" if ldconfig is not found #7068

Merged
merged 1 commit into from May 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions setup.py
Expand Up @@ -10,6 +10,7 @@

import os
import re
import shutil
import struct
import subprocess
import sys
Expand Down Expand Up @@ -150,6 +151,7 @@ def _dbg(s, tp=None):
def _find_library_dirs_ldconfig():
# Based on ctypes.util from Python 2

ldconfig = "ldconfig" if shutil.which("ldconfig") else "/sbin/ldconfig"
if sys.platform.startswith("linux") or sys.platform.startswith("gnu"):
if struct.calcsize("l") == 4:
machine = os.uname()[4] + "-32"
Expand All @@ -166,14 +168,14 @@ def _find_library_dirs_ldconfig():

# Assuming GLIBC's ldconfig (with option -p)
# Alpine Linux uses musl that can't print cache
args = ["ldconfig", "-p"]
args = [ldconfig, "-p"]
expr = rf".*\({abi_type}.*\) => (.*)"
env = dict(os.environ)
env["LC_ALL"] = "C"
env["LANG"] = "C"

elif sys.platform.startswith("freebsd"):
args = ["ldconfig", "-r"]
args = [ldconfig, "-r"]
expr = r".* => (.*)"
env = {}

Expand Down