Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6c8eb95

Browse files
gh-84461: Fix pydebug Emscripten browser builds (GH-93982)
wasm_assets script did not take the ABIFLAG flag of sysconfigdata intoaccount.(cherry picked from commit7a2cc35)Co-authored-by: Christian Heimes <christian@python.org>
1 parent753fe41 commit6c8eb95

File tree

2 files changed

+28
-16
lines changed

2 files changed

+28
-16
lines changed

‎Makefile.pre.in‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,8 @@ SRCDIRS= @SRCDIRS@
247247
SUBDIRSTOO=Include Lib Misc
248248

249249
# assets for Emscripten browser builds
250-
WASM_ASSETS_DIR=".$(prefix)"
251-
WASM_STDLIB="$(WASM_ASSETS_DIR)/local/lib/python$(VERSION)/os.py"
250+
WASM_ASSETS_DIR=.$(prefix)
251+
WASM_STDLIB=$(WASM_ASSETS_DIR)/lib/python$(VERSION)/os.py
252252

253253
# Files and directories to be distributed
254254
CONFIGFILES=configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in
@@ -821,7 +821,7 @@ $(WASM_STDLIB): $(srcdir)/Lib/*.py $(srcdir)/Lib/*/*.py \
821821
Makefile pybuilddir.txt Modules/Setup.local \
822822
python.html python.worker.js
823823
$(PYTHON_FOR_BUILD) $(srcdir)/Tools/wasm/wasm_assets.py \
824-
--builddir . --prefix $(prefix)
824+
--buildroot . --prefix $(prefix)
825825

826826
python.html: $(srcdir)/Tools/wasm/python.html python.worker.js
827827
@cp $(srcdir)/Tools/wasm/python.html $@
@@ -2398,7 +2398,7 @@ clean-retain-profile: pycremoval
23982398
-rm -f Lib/lib2to3/*Grammar*.pickle
23992399
-rm -f _bootstrap_python
24002400
-rm -f python.html python*.js python.data python*.symbols python*.map
2401-
-rm -rf $(WASM_STDLIB)
2401+
-rm -f $(WASM_STDLIB)
24022402
-rm -f Programs/_testembed Programs/_freeze_module
24032403
-rm -f Python/deepfreeze/*.[co]
24042404
-rm -f Python/frozen_modules/*.h

‎Tools/wasm/wasm_assets.py‎

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,13 @@
1313
importpathlib
1414
importshutil
1515
importsys
16+
importsysconfig
1617
importzipfile
1718

1819
# source directory
1920
SRCDIR=pathlib.Path(__file__).parent.parent.parent.absolute()
2021
SRCDIR_LIB=SRCDIR/"Lib"
2122

22-
# sysconfig data relative to build dir.
23-
SYSCONFIGDATA=pathlib.PurePath(
24-
"build",
25-
f"lib.emscripten-wasm32-{sys.version_info.major}.{sys.version_info.minor}",
26-
"_sysconfigdata__emscripten_wasm32-emscripten.py",
27-
)
2823

2924
# Library directory relative to $(prefix).
3025
WASM_LIB=pathlib.PurePath("lib")
@@ -121,6 +116,22 @@
121116
"unittest/test/",
122117
)
123118

119+
defget_builddir(args:argparse.Namespace)->pathlib.Path:
120+
"""Get builddir path from pybuilddir.txt
121+
"""
122+
withopen("pybuilddir.txt",encoding="utf-8")asf:
123+
builddir=f.read()
124+
returnpathlib.Path(builddir)
125+
126+
127+
defget_sysconfigdata(args:argparse.Namespace)->pathlib.Path:
128+
"""Get path to sysconfigdata relative to build root
129+
"""
130+
data_name=sysconfig._get_sysconfigdata_name()
131+
assert"emscripten_wasm32"indata_name
132+
filename=data_name+".py"
133+
returnargs.builddir/filename
134+
124135

125136
defcreate_stdlib_zip(
126137
args:argparse.Namespace,
@@ -150,7 +161,7 @@ def detect_extension_modules(args: argparse.Namespace):
150161
modules= {}
151162

152163
# disabled by Modules/Setup.local ?
153-
withopen(args.builddir/"Makefile")asf:
164+
withopen(args.buildroot/"Makefile")asf:
154165
forlineinf:
155166
ifline.startswith("MODDISABLED_NAMES="):
156167
disabled=line.split("=",1)[1].strip().split()
@@ -183,8 +194,8 @@ def path(val: str) -> pathlib.Path:
183194

184195
parser=argparse.ArgumentParser()
185196
parser.add_argument(
186-
"--builddir",
187-
help="absolute builddirectory",
197+
"--buildroot",
198+
help="absolutepath tobuildroot",
188199
default=pathlib.Path(".").absolute(),
189200
type=path,
190201
)
@@ -202,7 +213,7 @@ def main():
202213
relative_prefix=args.prefix.relative_to(pathlib.Path("/"))
203214
args.srcdir=SRCDIR
204215
args.srcdir_lib=SRCDIR_LIB
205-
args.wasm_root=args.builddir/relative_prefix
216+
args.wasm_root=args.buildroot/relative_prefix
206217
args.wasm_stdlib_zip=args.wasm_root/WASM_STDLIB_ZIP
207218
args.wasm_stdlib=args.wasm_root/WASM_STDLIB
208219
args.wasm_dynload=args.wasm_root/WASM_DYNLOAD
@@ -212,9 +223,10 @@ def main():
212223
args.compression=zipfile.ZIP_DEFLATED
213224
args.compresslevel=9
214225

215-
args.sysconfig_data=args.builddir/SYSCONFIGDATA
226+
args.builddir=get_builddir(args)
227+
args.sysconfig_data=get_sysconfigdata(args)
216228
ifnotargs.sysconfig_data.is_file():
217-
raiseValueError(f"sysconfigdata file{SYSCONFIGDATA} missing.")
229+
raiseValueError(f"sysconfigdata file{args.sysconfig_data} missing.")
218230

219231
extmods=detect_extension_modules(args)
220232
omit_files=list(OMIT_FILES)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp