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
13 changes: 13 additions & 0 deletions abs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# the conda-build parameters to use for disabling --skip-existing
build_parameters:
- "--suppress-variables"
#- "--skip-existing"
- "--error-overlinking"
- "--error-overdepending"

aggregate_check: false

channels:
- norl

upload_without_merge: true
10 changes: 9 additions & 1 deletion recipe/build_base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,14 @@ _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}" = readline ]]; then
_common_configure_args+=(--with-readline=readline)
elif [[ "${READLINE_MODE}" = editline ]]; then
_common_configure_args+=(--with-readline=editline)
elif [[ "${READLINE_MODE}" = none ]]; then
_common_configure_args+=(--without-readline)
fi

# Add more optimization flags for the static Python interpreter:
declare -a PROFILE_TASK=()
if [[ ${_OPTIMIZED} == yes ]]; then
Expand Down Expand Up @@ -455,7 +463,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
6 changes: 5 additions & 1 deletion recipe/conda_build_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ python:
python_impl:
- cpython
libffi: # [win]
- 3.4 # [win]
- 3.4 # [win]
numpy:
- 1.16
readline_mode:
- readline
- editline
- none
MACOSX_SDK_VERSION: # [osx and x86_64]
- 11.0 # [osx and x86_64]
32 changes: 22 additions & 10 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 = 1 %}
{% set channel_targets = ('abc', 'def') %}

# this makes the linter happy
Expand Down Expand Up @@ -37,6 +37,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 @@ -87,9 +91,11 @@ source:
{% if (openssl | string).startswith('3.0') %}
- patches/0026-Use-OpenSSL-3-instead-of-1_1.patch
{% endif %}
- patches/0027-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 @@ -106,7 +112,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 @@ -127,13 +135,13 @@ outputs:
# - lib/python{{ ver2 }}/lib-dynload/_hashlib.cpython-{{ ver2nd }}-x86_64-linux-gnu.so # [linux]
# - lib/libpython3.dylib # [osx]
# match python.org compiler standard
skip: true # [win and int(float(vc)) < 14]
skip: true # [win and (int(float(vc)) < 14 or readline_mode != 'none')]
{% if 'conda-forge' in channel_targets %}
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 All @@ -144,6 +152,7 @@ outputs:
script_env:
- PY_INTERP_LINKAGE_NATURE={{ linkage_nature_env }}
- PY_INTERP_DEBUG={{ py_interp_debug }}
- READLINE_MODE={{ readline_mode }}
# Putting these here means they get emitted to build_env_setup.{sh,bat} meaning we can launch IDEs
# after sourcing or calling that script without examine the contents of conda_build.{sh,bat} for
# important env. vars.
Expand Down Expand Up @@ -193,7 +202,8 @@ outputs:
- xz
- zlib
- openssl
- readline # [not win]
- readline {{ readline }} # [readline_mode == 'readline']
- libedit # [readline_mode == 'editline']
- tk
- ncurses # [unix]
- libffi 3.4
Expand Down Expand Up @@ -290,15 +300,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
95 changes: 95 additions & 0 deletions recipe/patches/0027-Fix-build-with-newer-editline.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
From a2fccb5e07017f32e116678ab0bf310abb494fdb Mon Sep 17 00:00:00 2001
From: Rafael Martins <[email protected]>
Date: Thu, 1 Feb 2024 23:09:15 +0100
Subject: [PATCH] Fix build with newer editline

---
Modules/readline.c | 2 +-
configure | 17 +++++++++++++++++
configure.ac | 14 ++++++++++++++
pyconfig.h.in | 3 +++
4 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/Modules/readline.c b/Modules/readline.c
index 1d50672..236b11c 100644
--- a/Modules/readline.c
+++ b/Modules/readline.c
@@ -438,7 +438,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 4b71c4e..d5c0e1c 100755
--- a/configure
+++ b/configure
@@ -16158,6 +16158,23 @@ if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :

$as_echo "#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>
+#endif
+
+"
+if test "x$ac_cv_type_rl_compdisp_func_t" = xyes; then :
+
+$as_echo "#define HAVE_RL_COMPDISP_FUNC_T 1" >>confdefs.h
+
fi

fi
diff --git a/configure.ac b/configure.ac
index ac3be38..87af1e4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5060,6 +5060,20 @@ if test "$py_cv_lib_readline" = yes; then
AC_CHECK_LIB($LIBREADLINE, append_history,
AC_DEFINE(HAVE_RL_APPEND_HISTORY, 1,
[Define if readline supports append_history]),,$READLINE_LIBS)
+
+ # 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])],
+ [],
+ [
+#include <stdio.h> /* Must be first for Gnu Readline */
+#ifdef WITH_EDITLINE
+# include <editline/readline.h>
+#else
+# include <readline/readline.h>
+#endif
+ ])
fi

# End of readline checks: restore LIBS
diff --git a/pyconfig.h.in b/pyconfig.h.in
index 57c84e5..6d4f5fc 100644
--- a/pyconfig.h.in
+++ b/pyconfig.h.in
@@ -866,6 +866,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

--
2.39.2 (Apple Git-143)

3 changes: 2 additions & 1 deletion recipe/run_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,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):
import tkinter
Expand Down