Internal change

PiperOrigin-RevId: 480942674
pull/13171/head
Mike Kruskal 2 years ago committed by Copybara-Service
parent 72f7799d12
commit fc73215f86
  1. 21
      python/dist/dist.bzl

@ -5,29 +5,24 @@ load("@system_python//:version.bzl", "SYSTEM_PYTHON_VERSION")
def _get_suffix(limited_api, python_version, cpu):
"""Computes an ABI version tag for an extension module per PEP 3149."""
suffix = "pyd" if ("win" in cpu) else "so"
if limited_api == True:
if "win" not in cpu:
suffix = "abi3." + suffix
return "." + suffix
if "win32" in cpu or "win64" in cpu:
if limited_api:
return ".pyd"
if "win32" in cpu:
abi = "win32"
elif "win64" in cpu:
abi = "win_amd64"
else:
fail("Unsupported CPU: " + cpu)
return ".cp{}-{}.{}".format(python_version, abi, suffix)
return ".cp{}-{}.{}".format(python_version, abi, "pyd")
if python_version == "system":
python_version = SYSTEM_PYTHON_VERSION
if int(python_version) < 38:
python_version += "m"
abis = {
"darwin": "darwin",
"darwin_arm64": "darwin",
"darwin": "darwin",
"osx-x86_64": "darwin",
"osx-aarch_64": "darwin",
"linux-aarch_64": "aarch64-linux-gnu",
@ -35,7 +30,13 @@ def _get_suffix(limited_api, python_version, cpu):
"k8": "x86_64-linux-gnu",
}
return ".cpython-{}-{}.{}".format(python_version, abis[cpu], suffix)
return ".cpython-{}-{}.{}".format(
python_version,
abis[cpu],
"so" if limited_api else "abi3.so",
)
elif limited_api:
return ".abi3.so"
fail("Unsupported combination of flags")

Loading…
Cancel
Save