Skip to content

Commit

Permalink
Change internal function name
Browse files Browse the repository at this point in the history
  • Loading branch information
uranusjr committed May 1, 2021
1 parent 818715e commit 3836079
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions packaging/_musllinux.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def _read_unpacked(f: IO[bytes], fmt: str) -> Tuple[int, ...]:
return struct.unpack(fmt, f.read(struct.calcsize(fmt)))


def _get_ld_musl_ctypes(f: IO[bytes]) -> Optional[str]:
def _get_ld_musl_elf(f: IO[bytes]) -> Optional[str]:
"""Detect musl libc location by parsing the Python executable.
Based on https://gist.github.com/lyssdod/f51579ae8d93c8657a5564aefc2ffbca
Expand Down Expand Up @@ -87,7 +87,7 @@ def _get_ld_musl_ldd(executable: str) -> Optional[str]:
def _get_ld_musl(executable: str) -> Optional[str]:
try:
with open(executable, "rb") as f:
return _get_ld_musl_ctypes(f)
return _get_ld_musl_elf(f)
except IOError:
return _get_ld_musl_ldd(executable)

Expand Down Expand Up @@ -139,3 +139,16 @@ def platform_tags(arch: str) -> Iterator[str]:
return
for minor in range(sys_musl.minor, -1, -1):
yield f"musllinux_{sys_musl.major}_{minor}_{arch}"


if __name__ == "__main__":
import sysconfig

plat = sysconfig.get_platform()
assert plat.startswith("linux-"), "not linux"

print("plat:", plat)
print("musl:", _get_musl_version(sys.executable))
print("tags:", end=" ")
for t in platform_tags(re.sub(r"[.-]", "_", plat.split("-", 1)[-1])):
print(t, end="\n ")

0 comments on commit 3836079

Please sign in to comment.