Step6: add python and snake.

Now we have a programming environment and
we have a small game for amusement :).

Signed-off-by: Chen Wang <wangchen20@iscas.ac.cn>
This commit is contained in:
Chen Wang
2025-12-05 16:24:46 +08:00
committed by Chen Wang
parent 083402650e
commit 28320bba62
22 changed files with 1128 additions and 2 deletions

View File

@@ -0,0 +1,63 @@
From 52bb6f2a3ef352cda16d95a588a0356da562de8e Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Date: Wed, 22 Feb 2017 16:21:31 -0800
Subject: [PATCH] Make the build of pyc files conditional
This commit adds a new configure option --disable-pyc-build to disable
the compilation of pyc.
Upstream: N/A
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
[ Andrey Smrinov: ported to Python 3.6 ]
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
[ Adam Duskett: ported to Python 3.12.0 ]
Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com>
[ Vincent Fazio: ported to Python 3.13.2 ]
Signed-off-by: Vincent Fazio <vfazio@gmail.com>
---
Makefile.pre.in | 2 ++
configure.ac | 7 +++++++
2 files changed, 9 insertions(+)
diff --git a/Makefile.pre.in b/Makefile.pre.in
index a7dc9709d62..a1d460b36f4 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -2570,6 +2570,7 @@ libinstall: all $(srcdir)/Modules/xxmodule.c
patch --force --reject-file "$(abs_builddir)/app-store-compliance.rej" --strip 2 --directory "$(DESTDIR)$(LIBDEST)" --input "$(abs_srcdir)/$(APP_STORE_COMPLIANCE_PATCH)" || true ; \
fi
@ # Build PYC files for the 3 optimization levels (0, 1, 2)
+ifeq (@PYC_BUILD@,yes)
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
$(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
-o 0 -o 1 -o 2 $(COMPILEALL_OPTS) -d $(LIBDEST) -f \
@@ -2579,6 +2580,7 @@ libinstall: all $(srcdir)/Modules/xxmodule.c
$(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
-o 0 -o 1 -o 2 $(COMPILEALL_OPTS) -d $(LIBDEST)/site-packages -f \
-x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
+endif
# bpo-21536: Misc/python-config.sh is generated in the build directory
# from $(srcdir)Misc/python-config.sh.in.
diff --git a/configure.ac b/configure.ac
index 597a44b331a..edac73ec5d3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1513,6 +1513,13 @@ fi
AC_MSG_CHECKING([LDLIBRARY])
+AC_SUBST(PYC_BUILD)
+
+AC_ARG_ENABLE(pyc-build,
+ AS_HELP_STRING([--disable-pyc-build], [disable build of pyc files]),
+ [ PYC_BUILD="${enableval}" ], [ PYC_BUILD=yes ])
+
+
# Apple framework builds need more magic. LDLIBRARY is the dynamic
# library that we build, but we do not want to link against it (we
# will find it with a -framework option). For this reason there is an
--
2.50.1

View File

@@ -0,0 +1,88 @@
From 8ba9dc9a12687d37454dd949409599f108f1ce44 Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Date: Wed, 22 Feb 2017 17:07:56 -0800
Subject: [PATCH] Add an option to disable pydoc
It removes 0.5 MB of data from the target plus the pydoc script
itself.
Upstream: N/A
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
[ Andrey Smirnov: ported to Python 3.6 ]
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
[ Adam Duskett: ported to Python 3.10.0 ]
Signed-off-by: Adam Duskett <aduskett@gmail.com>
[ Adam Duskett: ported to Python 3.12.1 ]
Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com>
[ Vincent Fazio: ported to Python 3.13.2 ]
Signed-off-by: Vincent Fazio <vfazio@gmail.com>
---
Makefile.pre.in | 9 ++++++++-
configure.ac | 6 ++++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/Makefile.pre.in b/Makefile.pre.in
index a1d460b36f4..81f3fd54ee4 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -2281,7 +2281,9 @@ bininstall: commoninstall altbininstall
-rm -f $(DESTDIR)$(BINDIR)/idle3
(cd $(DESTDIR)$(BINDIR); $(LN) -s idle$(VERSION) idle3)
-rm -f $(DESTDIR)$(BINDIR)/pydoc3
+ifeq (@PYDOC@,yes)
(cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3)
+endif
if test "x$(LIPO_32BIT_FLAGS)" != "x" ; then \
rm -f $(DESTDIR)$(BINDIR)/python3-32$(EXE); \
(cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-32$(EXE) python3-32$(EXE)) \
@@ -2331,7 +2333,6 @@ LIBSUBDIRS= asyncio \
logging \
multiprocessing multiprocessing/dummy \
pathlib \
- pydoc_data \
re \
site-packages \
sqlite3 \
@@ -2490,6 +2491,10 @@ TESTSUBDIRS= idlelib/idle_test \
COMPILEALL_OPTS=-j0
+ifeq (@PYDOC@,yes)
+LIBSUBDIRS += pydoc_data
+endif
+
TEST_MODULES=@TEST_MODULES@
.PHONY: libinstall
@@ -2717,7 +2722,9 @@ libainstall: all scripts
$(INSTALL_SCRIPT) python-config.py $(DESTDIR)$(LIBPL)/python-config.py
$(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(LDVERSION)-config
$(INSTALL_SCRIPT) $(SCRIPT_IDLE) $(DESTDIR)$(BINDIR)/idle$(VERSION)
+ifeq (@PYDOC@,yes)
$(INSTALL_SCRIPT) $(SCRIPT_PYDOC) $(DESTDIR)$(BINDIR)/pydoc$(VERSION)
+endif
@if [ -s Modules/python.exp -a \
"`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
echo; echo "Installing support files for building shared extension modules on AIX:"; \
diff --git a/configure.ac b/configure.ac
index edac73ec5d3..7ed4fa578f3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4749,6 +4749,12 @@ AS_VAR_IF([posix_threads], [stub], [
AC_DEFINE([HAVE_PTHREAD_STUBS], [1], [Define if platform requires stubbed pthreads support])
])
+AC_SUBST(PYDOC)
+
+AC_ARG_ENABLE(pydoc,
+ AS_HELP_STRING([--disable-pydoc], [disable pydoc]),
+ [ PYDOC="${enableval}" ], [ PYDOC=yes ])
+
# Check for enable-ipv6
AH_TEMPLATE([ENABLE_IPV6], [Define if --enable-ipv6 is specified])
AC_MSG_CHECKING([if --enable-ipv6 is specified])
--
2.50.1

View File

@@ -0,0 +1,87 @@
From 463c64020b288b8ddfd32a63c4a23ab7369b9669 Mon Sep 17 00:00:00 2001
From: Maxime Ripard <maxime.ripard@free-electrons.com>
Date: Wed, 22 Feb 2017 17:45:14 -0800
Subject: [PATCH] Add an option to disable IDLE
IDLE is an IDE embedded into python, written using Tk, so it doesn't make
much sense to have it into our build.
Upstream: N/A
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
[ Andrey Smirnov: ported to Python 3.6 ]
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
[ Adam Duskett: ported to Python 3.10.0 ]
Signed-off-by: Adam Duskett <aduskett@gmail.com>
[ Adam Duskett: ported to Python 3.12.1 ]
Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com>
[ Vincent Fazio: ported to Python 3.13.2 ]
Signed-off-by: Vincent Fazio <vfazio@gmail.com>
---
Makefile.pre.in | 9 ++++++++-
configure.ac | 6 ++++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/Makefile.pre.in b/Makefile.pre.in
index 81f3fd54ee4..2d067730633 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -2279,7 +2279,9 @@ bininstall: commoninstall altbininstall
-rm -f $(DESTDIR)$(LIBPC)/python3-embed.pc
(cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION)-embed.pc python3-embed.pc)
-rm -f $(DESTDIR)$(BINDIR)/idle3
+ifeq (@IDLE@,yes)
(cd $(DESTDIR)$(BINDIR); $(LN) -s idle$(VERSION) idle3)
+endif
-rm -f $(DESTDIR)$(BINDIR)/pydoc3
ifeq (@PYDOC@,yes)
(cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3)
@@ -2327,7 +2329,6 @@ LIBSUBDIRS= asyncio \
ensurepip ensurepip/_bundled \
html \
http \
- idlelib idlelib/Icons \
importlib importlib/resources importlib/metadata \
json \
logging \
@@ -2495,6 +2496,10 @@ ifeq (@PYDOC@,yes)
LIBSUBDIRS += pydoc_data
endif
+ifeq (@IDLE@,yes)
+LIBSUBDIRS += idlelib idlelib/Icons
+endif
+
TEST_MODULES=@TEST_MODULES@
.PHONY: libinstall
@@ -2721,7 +2726,9 @@ libainstall: all scripts
$(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
$(INSTALL_SCRIPT) python-config.py $(DESTDIR)$(LIBPL)/python-config.py
$(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(LDVERSION)-config
+ifeq (@IDLE@,yes)
$(INSTALL_SCRIPT) $(SCRIPT_IDLE) $(DESTDIR)$(BINDIR)/idle$(VERSION)
+endif
ifeq (@PYDOC@,yes)
$(INSTALL_SCRIPT) $(SCRIPT_PYDOC) $(DESTDIR)$(BINDIR)/pydoc$(VERSION)
endif
diff --git a/configure.ac b/configure.ac
index 7ed4fa578f3..d5dac4bf8bc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7927,6 +7927,12 @@ PY_STDLIB_MOD([xxlimited_35], [test "$TEST_MODULES" = yes], [test "$ac_cv_func_d
# substitute multiline block, must come after last PY_STDLIB_MOD()
AC_SUBST([MODULE_BLOCK])
+AC_SUBST(IDLE)
+
+AC_ARG_ENABLE(idle3,
+ AS_HELP_STRING([--disable-idle3], [disable idle3 IDE]),
+ [ IDLE="${enableval}" ], [ IDLE=yes ])
+
# generate output files
AC_CONFIG_FILES(m4_normalize([
Makefile.pre
--
2.50.1

View File

@@ -0,0 +1,51 @@
From 930c4763ac46d180880615eceeb68698e9b35e85 Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Date: Tue, 6 Feb 2024 22:46:59 +0100
Subject: [PATCH] configure.ac: move PY_STDLIB_MOD_SET_NA further up
We will need PY_STDLIB_MOD_SET_NA in next patches further up in the
configure.ac script.
Upstream: N/A
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
[ Vincent Fazio: ported to Python 3.13.2 ]
Signed-off-by: Vincent Fazio <vfazio@gmail.com>
---
configure.ac | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/configure.ac b/configure.ac
index d5dac4bf8bc..6635aaa134d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -95,6 +95,12 @@ AC_DEFUN([PY_CHECK_EMSCRIPTEN_PORT], [
AS_VAR_POPDEF([py_libs])
])
+# stdlib
+AC_DEFUN([PY_STDLIB_MOD_SET_NA], [
+ m4_foreach([mod], [$@], [
+ AS_VAR_SET([py_cv_module_]mod, [n/a])])
+])
+
AC_SUBST([BASECPPFLAGS])
if test "$srcdir" != . -a "$srcdir" != "$(pwd)"; then
# If we're building out-of-tree, we need to make sure the following
@@ -7595,13 +7601,6 @@ AS_VAR_IF([ac_cv_libatomic_needed], [yes],
LIBATOMIC=${LIBATOMIC-"-latomic"}])
_RESTORE_VAR([CPPFLAGS])
-
-# stdlib
-AC_DEFUN([PY_STDLIB_MOD_SET_NA], [
- m4_foreach([mod], [$@], [
- AS_VAR_SET([py_cv_module_]mod, [n/a])])
-])
-
# stdlib not available
dnl Modules that are not available on some platforms
AS_CASE([$ac_sys_system],
--
2.50.1

View File

@@ -0,0 +1,65 @@
From 8f6beca556599479705444af7cc7c49b2b964af8 Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Date: Tue, 6 Feb 2024 22:12:20 +0100
Subject: [PATCH] Add option to disable the sqlite3 module
Upstream: N/A
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
[ Andrey Smirnov: ported to Python 3.6 ]
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
[ Adam Duskett: ported to Python 3.10.0 ]
Signed-off-by: Adam Duskett <aduskett@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
[ Vincent Fazio: ported to Python 3.13.2 ]
Signed-off-by: Vincent Fazio <vfazio@gmail.com>
---
Makefile.pre.in | 5 ++++-
configure.ac | 7 +++++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/Makefile.pre.in b/Makefile.pre.in
index 2d067730633..a45a76cce45 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -2336,7 +2336,6 @@ LIBSUBDIRS= asyncio \
pathlib \
re \
site-packages \
- sqlite3 \
sysconfig \
tkinter \
tomllib \
@@ -2500,6 +2499,10 @@ ifeq (@IDLE@,yes)
LIBSUBDIRS += idlelib idlelib/Icons
endif
+ifeq (@SQLITE3@,yes)
+LIBSUBDIRS += sqlite3
+endif
+
TEST_MODULES=@TEST_MODULES@
.PHONY: libinstall
diff --git a/configure.ac b/configure.ac
index 6635aaa134d..8153b738b2f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4755,6 +4755,13 @@ AS_VAR_IF([posix_threads], [stub], [
AC_DEFINE([HAVE_PTHREAD_STUBS], [1], [Define if platform requires stubbed pthreads support])
])
+AC_SUBST(SQLITE3)
+AC_ARG_ENABLE(sqlite3,
+ AS_HELP_STRING([--disable-sqlite3], [disable sqlite3]),
+ [ SQLITE3="${enableval}" ], [ SQLITE3=yes ])
+AS_IF([test "$SQLITE3" = "no"],
+ [PY_STDLIB_MOD_SET_NA([_sqlite3])])
+
AC_SUBST(PYDOC)
AC_ARG_ENABLE(pydoc,
--
2.50.1

View File

@@ -0,0 +1,87 @@
From b53a2758ac431bc2493a460e6c886561e2397518 Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Date: Wed, 22 Feb 2017 17:23:42 -0800
Subject: [PATCH] Add an option to disable the tk module
Upstream: N/A
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
[ Andrey Smirnov: ported to Python 3.6 ]
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
[ Adam Duskett: ported to Python 3.10.0 ]
Signed-off-by: Adam Duskett <aduskett@gmail.com>
[ Bernd Kuhls: ported to Python 3.11.4]
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
[ Adam Duskett: ported to Python 3.12.1 ]
Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com>
[ Vincent Fazio: ported to Python 3.13.2 ]
Signed-off-by: Vincent Fazio <vfazio@gmail.com>
[ Vincent Fazio: fix Python 3.13.3 conflict ]
Signed-off-by: Vincent Fazio <vfazio@xes-inc.com>
---
Makefile.pre.in | 8 +++++---
configure.ac | 7 +++++++
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/Makefile.pre.in b/Makefile.pre.in
index a45a76cce45..76d67ce7185 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -2337,7 +2337,6 @@ LIBSUBDIRS= asyncio \
re \
site-packages \
sysconfig \
- tkinter \
tomllib \
turtledemo \
unittest \
@@ -2445,7 +2444,6 @@ TESTSUBDIRS= idlelib/idle_test \
test/test_pydoc \
test/test_pyrepl \
test/test_sqlite3 \
- test/test_tkinter \
test/test_tomllib \
test/test_tomllib/data \
test/test_tomllib/data/invalid \
@@ -2467,7 +2465,6 @@ TESTSUBDIRS= idlelib/idle_test \
test/test_tools \
test/test_tools/i18n_data \
test/test_tools/msgfmt_data \
- test/test_ttk \
test/test_unittest \
test/test_unittest/testmock \
test/test_warnings \
@@ -2489,6 +2486,11 @@ TESTSUBDIRS= idlelib/idle_test \
test/xmltestdata/c14n-20 \
test/zipimport_data
+ifeq (@TK@,yes)
+LIBSUBDIRS += tkinter
+TESTSUBDIRS += test/test_tkinter test/test_ttk
+endif
+
COMPILEALL_OPTS=-j0
ifeq (@PYDOC@,yes)
diff --git a/configure.ac b/configure.ac
index 8153b738b2f..0cf06a50c71 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4768,6 +4768,13 @@ AC_ARG_ENABLE(pydoc,
AS_HELP_STRING([--disable-pydoc], [disable pydoc]),
[ PYDOC="${enableval}" ], [ PYDOC=yes ])
+AC_SUBST(TK)
+AC_ARG_ENABLE(tk,
+ AS_HELP_STRING([--disable-tk], [disable tk]),
+ [ TK="${enableval}" ], [ TK=yes ])
+AS_IF([test "$TK" = "no"],
+ [PY_STDLIB_MOD_SET_NA([_tkinter])])
+
# Check for enable-ipv6
AH_TEMPLATE([ENABLE_IPV6], [Define if --enable-ipv6 is specified])
AC_MSG_CHECKING([if --enable-ipv6 is specified])
--
2.50.1

View File

@@ -0,0 +1,64 @@
From baef276faa676d1b0faf64a91fa627b5f8fcc5e0 Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Date: Wed, 22 Feb 2017 17:31:51 -0800
Subject: [PATCH] Add an option to disable the curses module
Upstream: N/A
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
[ Andrey Smirnov: ported to Python 3.6 ]
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
[ Adam Duskett: ported to Python 3.10.0 ]
Signed-off-by: Adam Duskett <aduskett@gmail.com>
[ Vincent Fazio: ported to Python 3.13.2 ]
Signed-off-by: Vincent Fazio <vfazio@gmail.com>
---
Makefile.pre.in | 5 ++++-
configure.ac | 7 +++++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/Makefile.pre.in b/Makefile.pre.in
index 76d67ce7185..bfb6cb65354 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -2322,7 +2322,6 @@ LIBSUBDIRS= asyncio \
concurrent concurrent/futures \
csv \
ctypes ctypes/macholib \
- curses \
dbm \
email email/mime \
encodings \
@@ -2491,6 +2490,10 @@ LIBSUBDIRS += tkinter
TESTSUBDIRS += test/test_tkinter test/test_ttk
endif
+ifeq (@CURSES@,yes)
+LIBSUBDIRS += curses
+endif
+
COMPILEALL_OPTS=-j0
ifeq (@PYDOC@,yes)
diff --git a/configure.ac b/configure.ac
index 0cf06a50c71..0895dc57808 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4762,6 +4762,13 @@ AC_ARG_ENABLE(sqlite3,
AS_IF([test "$SQLITE3" = "no"],
[PY_STDLIB_MOD_SET_NA([_sqlite3])])
+AC_SUBST(CURSES)
+AC_ARG_ENABLE(curses,
+ AS_HELP_STRING([--disable-curses], [disable curses]),
+ [ CURSES="${enableval}" ], [ CURSES=yes ])
+AS_IF([test "$CURSES" = "no"],
+ [PY_STDLIB_MOD_SET_NA([_curses], [_curses_panel])])
+
AC_SUBST(PYDOC)
AC_ARG_ENABLE(pydoc,
--
2.50.1

View File

@@ -0,0 +1,87 @@
From 2a7412e43554830ffbc831454de8df903e765b73 Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Date: Wed, 22 Feb 2017 17:40:45 -0800
Subject: [PATCH] Add an option to disable expat
This patch replaces the existing --with-system-expat option with a
--with-expat={system,builtin,none} option, which allows to tell Python
whether we want to use the system expat (already installed), the expat
builtin the Python sources, or no expat at all (which disables the
installation of XML modules).
Upstream: N/A
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
[ Andrey Smirnov: ported to Python 3.6 ]
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
[ Adam Duskett: ported to Python 3.10.0 ]
Signed-off-by: Adam Duskett <aduskett@gmail.com>
[ Vincent Fazio: ported to Python 3.13.2 ]
Signed-off-by: Vincent Fazio <vfazio@gmail.com>
---
Makefile.pre.in | 5 ++++-
configure.ac | 24 +++++++++++++-----------
2 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/Makefile.pre.in b/Makefile.pre.in
index bfb6cb65354..7a662ea4b32 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -2342,7 +2342,6 @@ LIBSUBDIRS= asyncio \
urllib \
venv venv/scripts venv/scripts/common venv/scripts/posix \
wsgiref \
- $(XMLLIBSUBDIRS) \
xmlrpc \
zipfile zipfile/_path \
zoneinfo \
@@ -2508,6 +2507,10 @@ ifeq (@SQLITE3@,yes)
LIBSUBDIRS += sqlite3
endif
+ifeq (@EXPAT@,yes)
+LIBSUBDIRS += $(XMLLIBSUBDIRS)
+endif
+
TEST_MODULES=@TEST_MODULES@
.PHONY: libinstall
diff --git a/configure.ac b/configure.ac
index 0895dc57808..34e4d5dd244 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4058,17 +4058,19 @@ LIBS="$withval $LIBS"
[AC_MSG_RESULT([no])])
# Check for use of the system expat library
-AC_MSG_CHECKING([for --with-system-expat])
-AC_ARG_WITH(
- [system_expat],
- [AS_HELP_STRING(
- [--with-system-expat],
- [build pyexpat module using an installed expat library, see Doc/library/pyexpat.rst (default is no)]
- )], [], [with_system_expat="no"])
-
-AC_MSG_RESULT([$with_system_expat])
-
-AS_VAR_IF([with_system_expat], [yes], [
+AC_MSG_CHECKING(for --with-expat)
+AC_ARG_WITH(expat,
+ AS_HELP_STRING([--with-expat], [select which expat version to use: system, builtin, none]),
+ [],
+ [with_expat="builtin"])
+AC_MSG_RESULT($with_expat)
+AS_IF([test "$with_expat" != "none"],
+ [EXPAT=yes],
+ [PY_STDLIB_MOD_SET_NA([pyexpat])
+ EXPAT=no])
+AC_SUBST(EXPAT)
+
+AS_VAR_IF([with_expat], [system], [
LIBEXPAT_CFLAGS=${LIBEXPAT_CFLAGS-""}
LIBEXPAT_LDFLAGS=${LIBEXPAT_LDFLAGS-"-lexpat"}
LIBEXPAT_INTERNAL=
--
2.50.1

46
package/python3/make-host.sh Executable file
View File

@@ -0,0 +1,46 @@
#!/usr/bin/bash
source $(dirname "$0")/../common.sh
PKGNAME=python3
PKGVERSION=3.13.7
PKGSOURCE_DIR=python3
PKGSOURCE=Python-3.13.7.tar.xz
PKGURL=https://python.org/ftp/python/3.13.7/Python-3.13.7.tar.xz
PKGBUILDNAME=host-${PKGNAME}
PKGBUILD_DIR=${BUILD_DIR}/${PKGBUILDNAME}-${PKGVERSION}
echo "----> Building ${PKGBUILDNAME} ..."
stamp_downloaded
step_start extract
mkdir -p ${PKGBUILD_DIR}
xzcat ${DL_DIR}/${PKGSOURCE_DIR}/${PKGSOURCE} | tar --strip-components=1 -C ${PKGBUILD_DIR} -xf -
chmod -R +rw ${PKGBUILD_DIR}
step_end extract
step_start patch
TAR="tar" PATH=${HOST_DIR}/bin:$PATH ${PROJECT_DIR}/support/scripts/apply-patches.sh ${PKGBUILD_DIR} ${PROJECT_DIR}/package/${PKGNAME} \*.patch
step_end patch autotools ignore_libtool_patch
step_start configure
echo ">>> ${PKGBUILDNAME} ${PKGVERSION} Autoreconfiguring"
cd ${PKGBUILD_DIR} && eval "AUTOPOINT=/bin/true ${AUTORECONF_OPTS} ${HOST_DIR}/bin/autoreconf -f -i --include=${HOST_DIR}/share/autoconf-archive"
patch_libtool ${PKGBUILD_DIR}
(cd ${PKGBUILD_DIR} && rm -rf config.cache; eval "${HOST_CONFIGURE_OPTS} LDFLAGS=\"-L${HOST_DIR}/lib -Wl,-rpath,${HOST_DIR}/lib -Wl,--enable-new-dtags\" py_cv_module_unicodedata=yes py_cv_module__codecs_cn=n/a py_cv_module__codecs_hk=n/a py_cv_module__codecs_iso2022=n/a py_cv_module__codecs_jp=n/a py_cv_module__codecs_kr=n/a py_cv_module__codecs_tw=n/a py_cv_module__uuid=n/a py_cv_module_nis=n/a py_cv_module_ossaudiodev=n/a py_cv_module__bz2=n/a py_cv_module__lzma=n/a py_cv_module__hashlib=n/a py_cv_module__ssl=n/a CONFIG_SITE=/dev/null ./configure --prefix=\"${HOST_DIR}\" --sysconfdir=\"${HOST_DIR}/etc\" --localstatedir=\"${HOST_DIR}/var\" --enable-shared --disable-static --disable-gtk-doc --disable-gtk-doc-html --disable-doc --disable-docs --disable-documentation --disable-debug --with-xmlto=no --with-fop=no --disable-nls --disable-dependency-tracking --without-ensurepip --without-cxx-main --disable-sqlite3 --disable-tk --with-expat=system --disable-test-modules --disable-idle3 --disable-curses")
step_end configure
step_start build
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} -C ${PKGBUILD_DIR}"
step_end build
step_start install-host
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} install -C ${PKGBUILD_DIR}"
ln -fs python3 ${HOST_DIR}/bin/python
ln -fs python3-config ${HOST_DIR}/bin/python-config
step_end install-host
stamp_installed
echo "<---- ${PKGBUILDNAME} build complete."

54
package/python3/make.sh Executable file
View File

@@ -0,0 +1,54 @@
#!/usr/bin/bash
source $(dirname "$0")/../common.sh
PKGNAME=python3
PKGVERSION=3.13.7
PKGSOURCE_DIR=python3
PKGSOURCE=Python-3.13.7.tar.xz
PKGURL=https://python.org/ftp/python/3.13.7/Python-3.13.7.tar.xz
PKGBUILDNAME=${PKGNAME}
PKGBUILD_DIR=${BUILD_DIR}/${PKGBUILDNAME}-${PKGVERSION}
echo "----> Building ${PKGBUILDNAME} ..."
stamp_downloaded
step_start extract
mkdir -p ${PKGBUILD_DIR}
xzcat ${DL_DIR}/${PKGSOURCE_DIR}/${PKGSOURCE} | tar --strip-components=1 -C ${PKGBUILD_DIR} -xf -
chmod -R +rw ${PKGBUILD_DIR}
step_end extract
step_start patch
TAR="tar" PATH=${HOST_DIR}/bin:$PATH ${PROJECT_DIR}/support/scripts/apply-patches.sh ${PKGBUILD_DIR} ${PROJECT_DIR}/package/${PKGNAME} \*.patch
step_end patch autotools ignore_libtool_patch
step_start configure
echo ">>> ${PKGBUILDNAME} ${PKGVERSION} Autoreconfiguring"
cd ${PKGBUILD_DIR} && eval "AUTOPOINT=/bin/true ${AUTORECONF_OPTS} ${HOST_DIR}/bin/autoreconf -f -i --include=${HOST_DIR}/share/autoconf-archive"
patch_libtool ${PKGBUILD_DIR}
(cd ${PKGBUILD_DIR} && rm -rf config.cache && eval "${TARGET_CONFIGURE_OPTS} CXX=no ac_cv_lbl_unaligned_fail=yes ac_cv_func_mmap_fixed_mapped=yes ac_cv_func_memcmp_working=yes ac_cv_have_decl_malloc=yes gl_cv_func_malloc_0_nonnull=yes ac_cv_func_malloc_0_nonnull=yes ac_cv_func_calloc_0_nonnull=yes ac_cv_func_realloc_0_nonnull=yes lt_cv_sys_lib_search_path_spec=\"\" ac_cv_c_bigendian=no py_cv_module__dbm=n/a py_cv_module__decimal=n/a py_cv_module__hashlib=n/a py_cv_module__ssl=n/a py_cv_module__codecs_cn=n/a py_cv_module__codecs_hk=n/a py_cv_module__codecs_iso2022=n/a py_cv_module__codecs_jp=n/a py_cv_module__codecs_kr=n/a py_cv_module__codecs_tw=n/a py_cv_module__uuid=n/a py_cv_module__bz2=n/a py_cv_module__lzma=n/a py_cv_module_zlib=n/a py_cv_module_ossaudiodev=n/a ac_cv_have_long_long_format=yes ac_cv_buggy_getaddrinfo=no ac_cv_file__dev_ptmx=yes ac_cv_file__dev_ptc=yes ac_cv_working_tzset=yes py_cv_module_nis=n/a ac_cv_little_endian_double=yes CFLAGS=\"-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g0 -D_FORTIFY_SOURCE=1\" CONFIG_SITE=/dev/null ./configure --target=${GNU_TARGET_NAME} --host=${GNU_TARGET_NAME} --build=x86_64-pc-linux-gnu --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --localstatedir=/var --program-prefix=\"\" --disable-gtk-doc --disable-gtk-doc-html --disable-doc --disable-docs --disable-documentation --with-xmlto=no --with-fop=no --disable-dependency-tracking --enable-ipv6 --disable-nls --disable-static --enable-shared --disable-lib2to3 --without-readline --with-expat=none --disable-sqlite3 --without-ensurepip --without-cxx-main --with-build-python=${HOST_DIR}/bin/python3 --with-system-ffi --disable-pydoc --disable-test-modules --disable-tk --disable-idle3 --disable-pyc-build")
step_end configure
step_start build
eval "${TARGET_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} -C ${PKGBUILD_DIR}"
step_end build
step_start install-staging
eval "${TARGET_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} DESTDIR=${STAGING_DIR} install -C ${PKGBUILD_DIR}"
step_end install-staging
step_start install-target
eval "${TARGET_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} DESTDIR=${TARGET_DIR} install -C ${PKGBUILD_DIR}"
rm -f ${TARGET_DIR}/usr/bin/python3.13-config
rm -f ${TARGET_DIR}/usr/bin/python3-config
find ${TARGET_DIR}/usr/lib/python3.13/config-3.13*/ -depth -type f -not -name Makefile -exec rm -rf {} \;
find ${TARGET_DIR}/usr/lib/python3.13/ -depth -type d -name __pycache__ -exec rm -rf {} \;
chmod u+w ${TARGET_DIR}/usr/lib/libpython3.13*.so
ln -fs python3 ${TARGET_DIR}/usr/bin/python
step_end install-target
stamp_installed
echo "<---- ${PKGBUILDNAME} build complete."