Skip to content

Commit 39c939f

Browse files
author
Rafael Martins
committed
fix build with editline. other minor fixes
1 parent 47d24e0 commit 39c939f

File tree

3 files changed

+117
-8
lines changed

3 files changed

+117
-8
lines changed

recipe/build_base.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,13 @@ _common_configure_args+=(--with-tcltk-includes="-I${PREFIX}/include")
248248
_common_configure_args+=("--with-tcltk-libs=-L${PREFIX}/lib -ltcl8.6 -ltk8.6")
249249
_common_configure_args+=(--with-platlibdir=lib)
250250

251-
if [ "$READLINE_MODE" = editline ]; then
251+
if [[ "${READLINE_MODE}" = readline ]]; then
252+
_common_configure_args+=(--with-readline=readline)
253+
elif [[ "${READLINE_MODE}" = editline ]]; then
252254
_common_configure_args+=(--with-readline=editline)
253-
elif [ "$READLINE_MODE" = none ]; then
255+
elif [[ "${READLINE_MODE}" = none ]]; then
254256
_common_configure_args+=(--without-readline)
255-
fi
257+
fi
256258

257259
# Add more optimization flags for the static Python interpreter:
258260
declare -a PROFILE_TASK=()
@@ -459,7 +461,7 @@ pushd "${PREFIX}"/lib/python${VER}
459461
# Remove osx sysroot as it depends on the build machine
460462
sed -i.bak "s@-isysroot @@g" sysconfigfile
461463
# make sure $CONDA_BUILD_SYSROOT is not empty ...
462-
if [[ ${HOST} =~ .*darwin.* ]] && [[ -n ${CONDA_BUILD_SYSROOT} ]]; then
464+
if [[ ${HOST} =~ .*darwin.* ]] && [[ -n ${CONDA_BUILD_SYSROOT} ]]; then
463465
sed -i.bak "s@$CONDA_BUILD_SYSROOT @@g" sysconfigfile
464466
fi
465467
# Remove unfilled config option

recipe/meta.yaml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
{% set py_interp_debug = "no" %}
4040
{% endif %}
4141

42+
{% set rl_string = "" %} # [win or readline_mode == 'readline']
43+
{% set rl_string = "el_" %} # [readline_mode == 'editline']
44+
{% set rl_string = "norl_" %} # [readline_mode == 'none']
45+
4246
package:
4347
name: python-split
4448
version: {{ version }}{{ dev }}
@@ -79,6 +83,7 @@ source:
7983
- patches/0018-Unvendor-expat.patch
8084
- patches/0019-Remove-unused-readelf.patch
8185
- patches/0021-Override-configure-LIBFFI.patch
86+
- patches/0022-Fix-build-with-newer-editline.patch
8287

8388
build:
8489
number: {{ build_number }}
@@ -124,8 +129,8 @@ outputs:
124129
skip_compile_pyc:
125130
- '*.py' # [build_platform != target_platform]
126131
{% endif %}
127-
string: {{ dev_ }}h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}{{ linkage_nature }}{{ debug }}_cpython # ["conda-forge" in (channel_targets or "")]
128-
string: h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}{{ linkage_nature }}{{ debug }} # ["conda-forge" not in (channel_targets or "")]
132+
string: {{ dev_ }}h{{ PKG_HASH }}_{{ rl_string }}{{ PKG_BUILDNUM }}{{ linkage_nature }}{{ debug }}_cpython # ["conda-forge" in (channel_targets or "")]
133+
string: h{{ PKG_HASH }}_{{ rl_string }}{{ PKG_BUILDNUM }}{{ linkage_nature }}{{ debug }} # ["conda-forge" not in (channel_targets or "")]
129134
{% if 'conda-forge' in channel_targets %}
130135
run_exports:
131136
noarch:
@@ -285,9 +290,9 @@ outputs:
285290
{% if 'conda-forge' in channel_targets %}
286291
ignore_run_exports:
287292
- python_abi
288-
string: h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}{{ linkage_nature }}{{ debug }}_cpython
293+
string: h{{ PKG_HASH }}_{{ rl_string }}{{ PKG_BUILDNUM }}{{ linkage_nature }}{{ debug }}_cpython
289294
{% else %}
290-
string: h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}{{ linkage_nature }}{{ debug }}
295+
string: h{{ PKG_HASH }}_{{ rl_string }}{{ PKG_BUILDNUM }}{{ linkage_nature }}{{ debug }}
291296
{% endif %}
292297
requirements:
293298
build:
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
From 53122bcf825681487226c041d47763e82e081530 Mon Sep 17 00:00:00 2001
2+
From: "Miss Islington (bot)"
3+
4+
Date: Mon, 9 Oct 2023 16:01:00 +0200
5+
Subject: [PATCH] [3.12] gh-109191: Fix build with newer editline (gh-110239)
6+
(gh-110562)
7+
8+
gh-109191: Fix build with newer editline (gh-110239)
9+
(cherry picked from commit f4cb0d27cc08f490c42a22e646eb73cc7072d54a)
10+
11+
Co-authored-by: Bo Anderson <[email protected]>
12+
---
13+
...-10-05-11-46-20.gh-issue-109191.imUkVN.rst | 1 +
14+
Modules/readline.c | 2 +-
15+
configure | 19 +++++++++++++++++++
16+
configure.ac | 7 +++++++
17+
pyconfig.h.in | 3 +++
18+
5 files changed, 31 insertions(+), 1 deletion(-)
19+
create mode 100644 Misc/NEWS.d/next/Build/2023-10-05-11-46-20.gh-issue-109191.imUkVN.rst
20+
21+
diff --git a/Misc/NEWS.d/next/Build/2023-10-05-11-46-20.gh-issue-109191.imUkVN.rst b/Misc/NEWS.d/next/Build/2023-10-05-11-46-20.gh-issue-109191.imUkVN.rst
22+
new file mode 100644
23+
index 00000000000000..27e5df790bc0c6
24+
--- /dev/null
25+
+++ b/Misc/NEWS.d/next/Build/2023-10-05-11-46-20.gh-issue-109191.imUkVN.rst
26+
@@ -0,0 +1 @@
27+
+Fix compile error when building with recent versions of libedit.
28+
diff --git a/Modules/readline.c b/Modules/readline.c
29+
index 2824105a187586..9823ebe71da3a5 100644
30+
--- a/Modules/readline.c
31+
+++ b/Modules/readline.c
32+
@@ -442,7 +442,7 @@ readline_set_completion_display_matches_hook_impl(PyObject *module,
33+
default completion display. */
34+
rl_completion_display_matches_hook =
35+
readlinestate_global->completion_display_matches_hook ?
36+
-#if defined(_RL_FUNCTION_TYPEDEF)
37+
+#if defined(HAVE_RL_COMPDISP_FUNC_T)
38+
(rl_compdisp_func_t *)on_completion_display_matches_hook : 0;
39+
#else
40+
(VFunction *)on_completion_display_matches_hook : 0;
41+
diff --git a/configure b/configure
42+
index b6f90bcd8c7300..985b3741349e8e 100755
43+
--- a/configure
44+
+++ b/configure
45+
@@ -25345,6 +25345,25 @@ printf "%s\n" "#define HAVE_RL_APPEND_HISTORY 1" >>confdefs.h
46+
47+
fi
48+
49+
+ # in readline as well as newer editline (April 2023)
50+
+ ac_fn_c_check_type "$LINENO" "rl_compdisp_func_t" "ac_cv_type_rl_compdisp_func_t" "
51+
+ #include <stdio.h> /* Must be first for Gnu Readline */
52+
+ #ifdef WITH_EDITLINE
53+
+ # include <editline/readline.h>
54+
+ #else
55+
+ # include <readline/readline.h>
56+
+ # include <readline/history.h>
57+
+ #endif
58+
+
59+
+"
60+
+if test "x$ac_cv_type_rl_compdisp_func_t" = xyes
61+
+then :
62+
+
63+
+printf "%s\n" "#define HAVE_RL_COMPDISP_FUNC_T 1" >>confdefs.h
64+
+
65+
+fi
66+
+
67+
+
68+
69+
70+
CFLAGS=$save_CFLAGS
71+
diff --git a/configure.ac b/configure.ac
72+
index ba768aea930714..2a7a91882640fd 100644
73+
--- a/configure.ac
74+
+++ b/configure.ac
75+
@@ -6213,6 +6213,13 @@ AS_VAR_IF([with_readline], [no], [
76+
AC_DEFINE([HAVE_RL_APPEND_HISTORY], [1], [Define if readline supports append_history])
77+
])
78+
79+
+ # in readline as well as newer editline (April 2023)
80+
+ AC_CHECK_TYPE([rl_compdisp_func_t],
81+
+ [AC_DEFINE([HAVE_RL_COMPDISP_FUNC_T], [1],
82+
+ [Define if readline supports rl_compdisp_func_t])],
83+
+ [],
84+
+ [readline_includes])
85+
+
86+
m4_undefine([readline_includes])
87+
])dnl WITH_SAVE_ENV()
88+
])
89+
diff --git a/pyconfig.h.in b/pyconfig.h.in
90+
index ada9dccfef1084..9f858b2d3541d0 100644
91+
--- a/pyconfig.h.in
92+
+++ b/pyconfig.h.in
93+
@@ -989,6 +989,9 @@
94+
/* Define if you can turn off readline's signal handling. */
95+
#undef HAVE_RL_CATCH_SIGNAL
96+
97+
+/* Define if readline supports rl_compdisp_func_t */
98+
+#undef HAVE_RL_COMPDISP_FUNC_T
99+
+
100+
/* Define if you have readline 2.2 */
101+
#undef HAVE_RL_COMPLETION_APPEND_CHARACTER
102+

0 commit comments

Comments
 (0)