Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1046d5c

Browse files
committed
Issue #22359: Disable running cross-compiled _freeze_importlib and pgen
Patch by Xavier de Gaye.
1 parent 19620c5 commit 1046d5c

4 files changed

Lines changed: 27 additions & 7 deletions

File tree

Makefile.pre.in

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ LIBOBJS= @LIBOBJS@
221221
PYTHON= python$(EXE)
222222
BUILDPYTHON= python$(BUILDEXE)
223223

224+
cross_compiling=@cross_compiling@
224225
PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@
225226
_PYTHON_HOST_PLATFORM=@_PYTHON_HOST_PLATFORM@
226227
BUILD_GNU_TYPE= @build@
@@ -718,12 +719,16 @@ Programs/_freeze_importlib: Programs/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FRO
718719
$(LINKCC) $(PY_LDFLAGS) -o $@ Programs/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FROZEN) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
719720

720721
Python/importlib_external.h: $(srcdir)/Lib/importlib/_bootstrap_external.py Programs/_freeze_importlib
721-
./Programs/_freeze_importlib \
722-
$(srcdir)/Lib/importlib/_bootstrap_external.py Python/importlib_external.h
722+
if test "$(cross_compiling)" != "yes"; then \
723+
./Programs/_freeze_importlib \
724+
$(srcdir)/Lib/importlib/_bootstrap_external.py Python/importlib_external.h; \
725+
fi
723726

724727
Python/importlib.h: $(srcdir)/Lib/importlib/_bootstrap.py Programs/_freeze_importlib
725-
./Programs/_freeze_importlib \
726-
$(srcdir)/Lib/importlib/_bootstrap.py Python/importlib.h
728+
if test "$(cross_compiling)" != "yes"; then \
729+
./Programs/_freeze_importlib \
730+
$(srcdir)/Lib/importlib/_bootstrap.py Python/importlib.h; \
731+
fi
727732

728733

729734
############################################################################
@@ -784,10 +789,18 @@ Python/sysmodule.o: $(srcdir)/Python/sysmodule.c Makefile
784789
$(IO_OBJS): $(IO_H)
785790

786791
$(GRAMMAR_H): $(GRAMMAR_INPUT) $(PGEN)
787-
@$(MKDIR_P) Include
788-
$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
792+
@$(MKDIR_P) Include
793+
if test "$(cross_compiling)" != "yes"; then \
794+
$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C); \
795+
else \
796+
cp $(srcdir)/Include/graminit.h $(GRAMMAR_H); \
797+
fi
789798
$(GRAMMAR_C): $(GRAMMAR_H)
790-
touch $(GRAMMAR_C)
799+
if test "$(cross_compiling)" != "yes"; then \
800+
touch $(GRAMMAR_C); \
801+
else \
802+
cp $(srcdir)/Python/graminit.c $(GRAMMAR_C); \
803+
fi
791804

792805
$(PGEN): $(PGENOBJS)
793806
$(CC) $(OPT) $(PY_LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)

Misc/NEWS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,11 @@ Tests
404404
Build
405405
-----
406406

407+
- Issue #22359: Disable the rules for running _freeze_importlib and pgen when
408+
cross-compiling. The output of these programs is normally saved with the
409+
source code anyway, and is still regenerated when doing a native build.
410+
Patch by Xavier de Gaye.
411+
407412
- Issue #21668: Link audioop, _datetime, _ctypes_test modules to libm,
408413
except on Mac OS X. Patch written by Xavier de Gaye.
409414

configure

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,7 @@ build_os
751751
build_vendor
752752
build_cpu
753753
build
754+
cross_compiling
754755
HAS_HG
755756
HGBRANCH
756757
HGTAG

configure.ac

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ fi
4949
AC_CONFIG_SRCDIR([Include/object.h])
5050
AC_CONFIG_HEADER(pyconfig.h)
5151

52+
AC_SUBST(cross_compiling)
5253
AC_CANONICAL_HOST
5354
AC_SUBST(build)
5455
AC_SUBST(host)

0 commit comments

Comments
 (0)