Skip to content

Commit d9ab1f4

Browse files
linesightclaude
andcommitted
build_distrib: fix Linux/macOS support
- Use sysconfig.get_platform() for the wheel platform tag instead of hardcoding win_amd64; correctly handles Linux, macOS x86_64/arm64 - Accept .so extension on non-Windows when checking for compiled module - Read cef_version_linux.h / cef_version_mac.h on the respective platforms instead of always reading cef_version_win.h Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 774d6f1 commit d9ab1f4

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

tools/build_distrib.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import os
2323
import re
2424
import sys
25+
import sysconfig
2526
import zipfile
2627

2728

@@ -37,7 +38,7 @@ def main():
3738
version = _read_version()
3839
vi = sys.version_info
3940
cp = "cp{0}{1}".format(vi.major, vi.minor)
40-
platform = "win_amd64"
41+
platform = sysconfig.get_platform().replace("-", "_").replace(".", "_")
4142

4243
wheel_name = "cefpython3-{v}-{cp}-{cp}-{p}.whl".format(
4344
v=version, cp=cp, p=platform)
@@ -49,9 +50,10 @@ def main():
4950
print("[build_distrib.py] ERROR: {pkg_dir}/ not found".format(
5051
pkg_dir=pkg_dir))
5152
sys.exit(1)
52-
if not glob.glob(os.path.join(pkg_dir, "cefpython_py*.pyd")):
53-
print("[build_distrib.py] ERROR: no cefpython_py*.pyd in {pkg_dir}/,"
54-
" run compile step first".format(pkg_dir=pkg_dir))
53+
ext = ".pyd" if sys.platform == "win32" else ".so"
54+
if not glob.glob(os.path.join(pkg_dir, "cefpython_py*" + ext)):
55+
print("[build_distrib.py] ERROR: no cefpython_py*{ext} in {pkg_dir}/,"
56+
" run compile step first".format(ext=ext, pkg_dir=pkg_dir))
5557
sys.exit(1)
5658

5759
records = []
@@ -111,7 +113,13 @@ def _add_bytes(arcname, data):
111113

112114

113115
def _read_version():
114-
header = os.path.join("src", "version", "cef_version_win.h")
116+
if sys.platform == "win32":
117+
name = "cef_version_win.h"
118+
elif sys.platform == "darwin":
119+
name = "cef_version_mac.h"
120+
else:
121+
name = "cef_version_linux.h"
122+
header = os.path.join("src", "version", name)
115123
with open(header) as f:
116124
for line in f:
117125
m = re.match(r"#define CHROME_VERSION_MAJOR\s+(\d+)", line)

0 commit comments

Comments
 (0)