Skip to content

Commit 2084bb1

Browse files
committed
refactor: Use shared get_platform_info from build_ddbc.compiler
- Removed duplicate get_platform_info() from setup.py - Import directly from build_ddbc.compiler instead - Single source of truth for platform detection logic
1 parent c42f819 commit 2084bb1

2 files changed

Lines changed: 2 additions & 34 deletions

File tree

build_ddbc/compiler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def get_platform_info() -> Tuple[str, str]:
3535
return "x64", "win_amd64"
3636

3737
elif sys.platform.startswith("darwin"):
38-
return "universal2", "macosx_11_0_universal2"
38+
return "universal2", "macosx_15_0_universal2"
3939

4040
elif sys.platform.startswith("linux"):
4141
target_arch = os.environ.get("targetArch", platform.machine())

setup.py

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -14,45 +14,13 @@
1414
pip install -e . # Editable install with auto-compile
1515
"""
1616

17-
import os
18-
import platform
1917
import sys
2018

2119
from setuptools import setup, find_packages
2220
from setuptools.dist import Distribution
2321
from wheel.bdist_wheel import bdist_wheel
2422

25-
26-
def get_platform_info():
27-
"""
28-
Get platform-specific architecture and platform tag information.
29-
30-
Note: This is duplicated from build_ddbc.compiler to avoid circular imports
31-
during fresh installs where build_ddbc isn't available yet.
32-
"""
33-
if sys.platform.startswith("win"):
34-
arch = os.environ.get("ARCHITECTURE", "x64")
35-
if isinstance(arch, str):
36-
arch = arch.strip("\"'")
37-
if arch in ["x86", "win32"]:
38-
return "x86", "win32"
39-
elif arch == "arm64":
40-
return "arm64", "win_arm64"
41-
else:
42-
return "x64", "win_amd64"
43-
elif sys.platform.startswith("darwin"):
44-
return "universal2", "macosx_11_0_universal2"
45-
elif sys.platform.startswith("linux"):
46-
target_arch = os.environ.get("targetArch", platform.machine())
47-
libc_name, _ = platform.libc_ver()
48-
is_musl = libc_name and "musl" in libc_name.lower()
49-
if target_arch == "x86_64":
50-
return "x86_64", "musllinux_1_2_x86_64" if is_musl else "manylinux_2_28_x86_64"
51-
elif target_arch in ["aarch64", "arm64"]:
52-
return "aarch64", "musllinux_1_2_aarch64" if is_musl else "manylinux_2_28_aarch64"
53-
else:
54-
raise OSError(f"Unsupported architecture '{target_arch}' for Linux")
55-
raise OSError(f"Unsupported platform: {sys.platform}")
23+
from build_ddbc.compiler import get_platform_info
5624

5725

5826
# =============================================================================

0 commit comments

Comments
 (0)