Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion abs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,11 @@ build_parameters:
- "--suppress-variables"
#- "--skip-existing"
- "--error-overlinking"
- "--error-overdepending"
- "--error-overdepending"

aggregate_check: false

channels:
- norl

upload_without_merge: true
10 changes: 6 additions & 4 deletions recipe/build_base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,13 @@ _common_configure_args+=(--with-tcltk-includes="-I${PREFIX}/include")
_common_configure_args+=("--with-tcltk-libs=-L${PREFIX}/lib -ltcl8.6 -ltk8.6")
_common_configure_args+=(--with-platlibdir=lib)

if [ "$READLINE_MODE" = editline ]; then
if [[ "${READLINE_MODE}" = readline ]]; then
_common_configure_args+=(--with-readline=readline)
elif [[ "${READLINE_MODE}" = editline ]]; then
_common_configure_args+=(--with-readline=editline)
elif [ "$READLINE_MODE" = none ]; then
elif [[ "${READLINE_MODE}" = none ]]; then
_common_configure_args+=(--without-readline)
fi
fi

# Add more optimization flags for the static Python interpreter:
declare -a PROFILE_TASK=()
Expand Down Expand Up @@ -459,7 +461,7 @@ pushd "${PREFIX}"/lib/python${VER}
# Remove osx sysroot as it depends on the build machine
sed -i.bak "s@-isysroot @@g" sysconfigfile
# make sure $CONDA_BUILD_SYSROOT is not empty ...
if [[ ${HOST} =~ .*darwin.* ]] && [[ -n ${CONDA_BUILD_SYSROOT} ]]; then
if [[ ${HOST} =~ .*darwin.* ]] && [[ -n ${CONDA_BUILD_SYSROOT} ]]; then
sed -i.bak "s@$CONDA_BUILD_SYSROOT @@g" sysconfigfile
fi
# Remove unfilled config option
Expand Down
26 changes: 18 additions & 8 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{% set ver2 = '.'.join(version.split('.')[0:2]) %}
{% set ver2nd = ''.join(version.split('.')[0:2]) %}
{% set ver3nd = ''.join(version.split('.')[0:3]) %}
{% set build_number = "0" %}
{% set build_number = 2 %}
{% set channel_targets = ('abc', 'def') %}
# this is just for the initial build, to break dependencies with python -> pip -> libpython-static
{% set bootstrap = "false" %}
Expand Down Expand Up @@ -39,6 +39,10 @@
{% set py_interp_debug = "no" %}
{% endif %}

{% set rl_string = "" %} # [win or readline_mode == 'readline']
{% set rl_string = "el_" %} # [not win and readline_mode == 'editline']
{% set rl_string = "norl_" %} # [not win and readline_mode == 'none']

package:
name: python-split
version: {{ version }}{{ dev }}
Expand Down Expand Up @@ -79,9 +83,11 @@ source:
- patches/0018-Unvendor-expat.patch
- patches/0019-Remove-unused-readelf.patch
- patches/0021-Override-configure-LIBFFI.patch
- patches/0022-Fix-build-with-newer-editline.patch

build:
number: {{ build_number }}
number: {{ build_number + 100 }} # [win or readline_mode == 'readline']
number: {{ build_number }} # [not(win or readline_mode == 'readline')]

requirements:
build:
Expand All @@ -98,7 +104,9 @@ outputs:
script: build_base.sh # [unix]
script: build_base.bat # [win]
build:
number: {{ build_number }}
number: {{ build_number + 200 }} # [win or readline_mode == 'readline']
number: {{ build_number + 100 }} # [not win and readline_mode == 'editline']
number: {{ build_number }} # [not win and readline_mode == 'none']
activate_in_script: true
# Windows has issues updating python if conda is using files itself.
# Copy rather than link.
Expand All @@ -124,8 +132,8 @@ outputs:
skip_compile_pyc:
- '*.py' # [build_platform != target_platform]
{% endif %}
string: {{ dev_ }}h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}{{ linkage_nature }}{{ debug }}_cpython # ["conda-forge" in (channel_targets or "")]
string: h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}{{ linkage_nature }}{{ debug }} # ["conda-forge" not in (channel_targets or "")]
string: {{ dev_ }}h{{ PKG_HASH }}_{{ rl_string }}{{ PKG_BUILDNUM }}{{ linkage_nature }}{{ debug }}_cpython # ["conda-forge" in (channel_targets or "")]
string: h{{ PKG_HASH }}_{{ rl_string }}{{ PKG_BUILDNUM }}{{ linkage_nature }}{{ debug }} # ["conda-forge" not in (channel_targets or "")]
{% if 'conda-forge' in channel_targets %}
run_exports:
noarch:
Expand Down Expand Up @@ -280,15 +288,17 @@ outputs:
script: build_static.sh # [unix]
script: build_static.bat # [win]
build:
number: {{ build_number }}
number: {{ build_number + 100 }} # [win or readline_mode == 'readline']
number: {{ build_number }} # [not(win or readline_mode == 'readline')]
activate_in_script: true
{% if 'conda-forge' in channel_targets %}
ignore_run_exports:
- python_abi
string: h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}{{ linkage_nature }}{{ debug }}_cpython
string: h{{ PKG_HASH }}_{{ rl_string }}{{ PKG_BUILDNUM }}{{ linkage_nature }}{{ debug }}_cpython
{% else %}
string: h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}{{ linkage_nature }}{{ debug }}
string: h{{ PKG_HASH }}_{{ rl_string }}{{ PKG_BUILDNUM }}{{ linkage_nature }}{{ debug }}
{% endif %}
skip: true # [win and readline_mode != 'none']
requirements:
build:
- {{ compiler('c') }}
Expand Down
102 changes: 102 additions & 0 deletions recipe/patches/0022-Fix-build-with-newer-editline.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
From 53122bcf825681487226c041d47763e82e081530 Mon Sep 17 00:00:00 2001
From: "Miss Islington (bot)"
<31488909+miss-islington@users.noreply.github.com>
Date: Mon, 9 Oct 2023 16:01:00 +0200
Subject: [PATCH] [3.12] gh-109191: Fix build with newer editline (gh-110239)
(gh-110562)

gh-109191: Fix build with newer editline (gh-110239)
(cherry picked from commit f4cb0d27cc08f490c42a22e646eb73cc7072d54a)

Co-authored-by: Bo Anderson <mail@boanderson.me>
---
...-10-05-11-46-20.gh-issue-109191.imUkVN.rst | 1 +
Modules/readline.c | 2 +-
configure | 19 +++++++++++++++++++
configure.ac | 7 +++++++
pyconfig.h.in | 3 +++
5 files changed, 31 insertions(+), 1 deletion(-)
create mode 100644 Misc/NEWS.d/next/Build/2023-10-05-11-46-20.gh-issue-109191.imUkVN.rst

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
new file mode 100644
index 00000000000000..27e5df790bc0c6
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2023-10-05-11-46-20.gh-issue-109191.imUkVN.rst
@@ -0,0 +1 @@
+Fix compile error when building with recent versions of libedit.
diff --git a/Modules/readline.c b/Modules/readline.c
index 2824105a187586..9823ebe71da3a5 100644
--- a/Modules/readline.c
+++ b/Modules/readline.c
@@ -442,7 +442,7 @@ readline_set_completion_display_matches_hook_impl(PyObject *module,
default completion display. */
rl_completion_display_matches_hook =
readlinestate_global->completion_display_matches_hook ?
-#if defined(_RL_FUNCTION_TYPEDEF)
+#if defined(HAVE_RL_COMPDISP_FUNC_T)
(rl_compdisp_func_t *)on_completion_display_matches_hook : 0;
#else
(VFunction *)on_completion_display_matches_hook : 0;
diff --git a/configure b/configure
index b6f90bcd8c7300..985b3741349e8e 100755
--- a/configure
+++ b/configure
@@ -25345,6 +25345,25 @@ printf "%s\n" "#define HAVE_RL_APPEND_HISTORY 1" >>confdefs.h

fi

+ # in readline as well as newer editline (April 2023)
+ ac_fn_c_check_type "$LINENO" "rl_compdisp_func_t" "ac_cv_type_rl_compdisp_func_t" "
+ #include <stdio.h> /* Must be first for Gnu Readline */
+ #ifdef WITH_EDITLINE
+ # include <editline/readline.h>
+ #else
+ # include <readline/readline.h>
+ # include <readline/history.h>
+ #endif
+
+"
+if test "x$ac_cv_type_rl_compdisp_func_t" = xyes
+then :
+
+printf "%s\n" "#define HAVE_RL_COMPDISP_FUNC_T 1" >>confdefs.h
+
+fi
+
+


CFLAGS=$save_CFLAGS
diff --git a/configure.ac b/configure.ac
index ba768aea930714..2a7a91882640fd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6213,6 +6213,13 @@ AS_VAR_IF([with_readline], [no], [
AC_DEFINE([HAVE_RL_APPEND_HISTORY], [1], [Define if readline supports append_history])
])

+ # in readline as well as newer editline (April 2023)
+ AC_CHECK_TYPE([rl_compdisp_func_t],
+ [AC_DEFINE([HAVE_RL_COMPDISP_FUNC_T], [1],
+ [Define if readline supports rl_compdisp_func_t])],
+ [],
+ [readline_includes])
+
m4_undefine([readline_includes])
])dnl WITH_SAVE_ENV()
])
diff --git a/pyconfig.h.in b/pyconfig.h.in
index ada9dccfef1084..9f858b2d3541d0 100644
--- a/pyconfig.h.in
+++ b/pyconfig.h.in
@@ -989,6 +989,9 @@
/* Define if you can turn off readline's signal handling. */
#undef HAVE_RL_CATCH_SIGNAL

+/* Define if readline supports rl_compdisp_func_t */
+#undef HAVE_RL_COMPDISP_FUNC_T
+
/* Define if you have readline 2.2 */
#undef HAVE_RL_COMPLETION_APPEND_CHARACTER

3 changes: 2 additions & 1 deletion recipe/run_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,12 @@
import fcntl
import grp
import nis
import readline
import resource
import syslog
import termios

if os.environ["READLINE_MODE"] != 'none':
import readline

if not (armv6l or armv7l or ppc64le or osx105 or arm64):
import tkinter
Expand Down