diff --git a/abs.yaml b/abs.yaml new file mode 100644 index 000000000..420fde0b0 --- /dev/null +++ b/abs.yaml @@ -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 diff --git a/recipe/build_base.sh b/recipe/build_base.sh index 49e549f59..7d64ae777 100644 --- a/recipe/build_base.sh +++ b/recipe/build_base.sh @@ -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 @@ -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 diff --git a/recipe/conda_build_config.yaml b/recipe/conda_build_config.yaml index 9b2219de7..30a0e800a 100644 --- a/recipe/conda_build_config.yaml +++ b/recipe/conda_build_config.yaml @@ -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] diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 40fff4f69..ce2017da6 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -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 @@ -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 }} @@ -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: @@ -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. @@ -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: @@ -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. @@ -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 @@ -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') }} diff --git a/recipe/patches/0027-Fix-build-with-newer-editline.patch b/recipe/patches/0027-Fix-build-with-newer-editline.patch new file mode 100644 index 000000000..69b74bed0 --- /dev/null +++ b/recipe/patches/0027-Fix-build-with-newer-editline.patch @@ -0,0 +1,95 @@ +From a2fccb5e07017f32e116678ab0bf310abb494fdb Mon Sep 17 00:00:00 2001 +From: Rafael Martins +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 /* Must be first for Gnu Readline */ ++#ifdef WITH_EDITLINE ++# include ++#else ++# include ++#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 /* Must be first for Gnu Readline */ ++#ifdef WITH_EDITLINE ++# include ++#else ++# include ++#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) + diff --git a/recipe/run_test.py b/recipe/run_test.py index f5d7f7cfa..b9d9c24f5 100644 --- a/recipe/run_test.py +++ b/recipe/run_test.py @@ -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