Ticket #48807: patch-libedit.diff

File patch-libedit.diff, 7.3 KB (added by mohd-akram (Mohamed Akram), 8 years ago)

Updated libedit patch

  • configure

    old new  
    1499514995$as_echo_n "checking how to link readline libs... " >&6; }
    1499614996for py_libtermcap in "" tinfo ncursesw ncurses curses termcap; do
    1499714997  if test -z "$py_libtermcap"; then
    14998     READLINE_LIBS="-lreadline"
     14998    READLINE_LIBS="-ledit"
    1499914999  else
    15000     READLINE_LIBS="-lreadline -l$py_libtermcap"
     15000    READLINE_LIBS="-ledit -l$py_libtermcap"
    1500115001  fi
    1500215002  LIBS="$READLINE_LIBS $LIBS_no_readline"
    1500315003  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     
    1504115041fi
    1504215042
    1504315043# check for readline 2.1
    15044 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_callback_handler_install in -lreadline" >&5
    15045 $as_echo_n "checking for rl_callback_handler_install in -lreadline... " >&6; }
     15044{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_callback_handler_install in -ledit" >&5
     15045$as_echo_n "checking for rl_callback_handler_install in -ledit... " >&6; }
    1504615046if ${ac_cv_lib_readline_rl_callback_handler_install+:} false; then :
    1504715047  $as_echo_n "(cached) " >&6
    1504815048else
    1504915049  ac_check_lib_save_LIBS=$LIBS
    15050 LIBS="-lreadline $READLINE_LIBS $LIBS"
     15050LIBS="-ledit $READLINE_LIBS $LIBS"
    1505115051cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    1505215052/* end confdefs.h.  */
    1505315053
     
    1508715087# check for readline 2.2
    1508815088cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    1508915089/* end confdefs.h.  */
    15090 #include <readline/readline.h>
     15090#include <editline/readline.h>
    1509115091_ACEOF
    1509215092if ac_fn_c_try_cpp "$LINENO"; then :
    1509315093  have_readline=yes
     
    1510015100then
    1510115101  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    1510215102/* end confdefs.h.  */
    15103 #include <readline/readline.h>
     15103#include <editline/readline.h>
    1510415104
    1510515105_ACEOF
    1510615106if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
     
    1511315113
    1511415114  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    1511515115/* end confdefs.h.  */
    15116 #include <readline/readline.h>
     15116#include <editline/readline.h>
    1511715117
    1511815118_ACEOF
    1511915119if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
     
    1512715127fi
    1512815128
    1512915129# check for readline 4.0
    15130 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_pre_input_hook in -lreadline" >&5
    15131 $as_echo_n "checking for rl_pre_input_hook in -lreadline... " >&6; }
     15130{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_pre_input_hook in -ledit" >&5
     15131$as_echo_n "checking for rl_pre_input_hook in -ledit... " >&6; }
    1513215132if ${ac_cv_lib_readline_rl_pre_input_hook+:} false; then :
    1513315133  $as_echo_n "(cached) " >&6
    1513415134else
    1513515135  ac_check_lib_save_LIBS=$LIBS
    15136 LIBS="-lreadline $READLINE_LIBS $LIBS"
     15136LIBS="-ledit $READLINE_LIBS $LIBS"
    1513715137cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    1513815138/* end confdefs.h.  */
    1513915139
     
    1517115171
    1517215172
    1517315173# also in 4.0
    15174 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_display_matches_hook in -lreadline" >&5
    15175 $as_echo_n "checking for rl_completion_display_matches_hook in -lreadline... " >&6; }
     15174{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_display_matches_hook in -ledit" >&5
     15175$as_echo_n "checking for rl_completion_display_matches_hook in -ledit... " >&6; }
    1517615176if ${ac_cv_lib_readline_rl_completion_display_matches_hook+:} false; then :
    1517715177  $as_echo_n "(cached) " >&6
    1517815178else
    1517915179  ac_check_lib_save_LIBS=$LIBS
    15180 LIBS="-lreadline $READLINE_LIBS $LIBS"
     15180LIBS="-ledit $READLINE_LIBS $LIBS"
    1518115181cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    1518215182/* end confdefs.h.  */
    1518315183
     
    1525915259
    1526015260
    1526115261# check for readline 4.2
    15262 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_matches in -lreadline" >&5
    15263 $as_echo_n "checking for rl_completion_matches in -lreadline... " >&6; }
     15262{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_matches in -ledit" >&5
     15263$as_echo_n "checking for rl_completion_matches in -ledit... " >&6; }
    1526415264if ${ac_cv_lib_readline_rl_completion_matches+:} false; then :
    1526515265  $as_echo_n "(cached) " >&6
    1526615266else
    1526715267  ac_check_lib_save_LIBS=$LIBS
    15268 LIBS="-lreadline $READLINE_LIBS $LIBS"
     15268LIBS="-ledit $READLINE_LIBS $LIBS"
    1526915269cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    1527015270/* end confdefs.h.  */
    1527115271
     
    1530515305# also in readline 4.2
    1530615306cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    1530715307/* end confdefs.h.  */
    15308 #include <readline/readline.h>
     15308#include <editline/readline.h>
    1530915309_ACEOF
    1531015310if ac_fn_c_try_cpp "$LINENO"; then :
    1531115311  have_readline=yes
     
    1531815318then
    1531915319  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    1532015320/* end confdefs.h.  */
    15321 #include <readline/readline.h>
     15321#include <editline/readline.h>
    1532215322
    1532315323_ACEOF
    1532415324if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  • setup.py

    old new  
    710710                               libraries=math_libs) )
    711711
    712712        # readline
    713         do_readline = self.compiler.find_library_file(lib_dirs, 'readline')
     713        do_readline = self.compiler.find_library_file(lib_dirs, 'edit')
    714714        readline_termcap_library = ""
    715715        curses_library = ""
    716716        # Cannot use os.popen here in py3k.
     
    776776            else:
    777777                readline_extra_link_args = ()
    778778
    779             readline_libs = ['readline']
     779            readline_libs = ['edit']
    780780            if readline_termcap_library:
    781781                pass # Issue 7384: Already linked against curses or tinfo.
    782782            elif curses_library:
  • Modules/readline.c

    old new  
    2929
    3030/* GNU readline definitions */
    3131#undef HAVE_CONFIG_H /* Else readline/chardefs.h includes strings.h */
    32 #include <readline/readline.h>
    33 #include <readline/history.h>
     32#include <editline/readline.h>
    3433
    3534#ifdef HAVE_RL_COMPLETION_MATCHES
    3635#define completion_matches(x, y) \
     
    4645#endif
    4746#endif
    4847
    49 #ifdef __APPLE__
     48#ifndef __APPLE__
    5049/*
    5150 * It is possible to link the readline module to the readline
    5251 * emulation library of editline/libedit.
     
    10991098        Py_FatalError("not enough memory to save locale");
    11001099#endif
    11011100
    1102 #ifdef __APPLE__
     1101#ifndef __APPLE__
    11031102    /* the libedit readline emulation resets key bindings etc
    11041103     * when calling rl_initialize.  So call it upfront
    11051104     */
     
    11461145    mod_state->begidx = PyLong_FromLong(0L);
    11471146    mod_state->endidx = PyLong_FromLong(0L);
    11481147
    1149 #ifdef __APPLE__
     1148#ifndef __APPLE__
    11501149    if (!using_libedit_emulation)
    11511150#endif
    11521151    {
     
    11681167     * XXX: A bug in the readline-2.2 library causes a memory leak
    11691168     * inside this function.  Nothing we can do about it.
    11701169     */
    1171 #ifdef __APPLE__
     1170#ifndef __APPLE__
    11721171    if (using_libedit_emulation)
    11731172        rl_read_init_file(NULL);
    11741173    else
     
    13481347        const char *line;
    13491348        int length = _py_get_history_length();
    13501349        if (length > 0)
    1351 #ifdef __APPLE__
     1350#ifndef __APPLE__
    13521351            if (using_libedit_emulation) {
    13531352                /* handle older 0-based or newer 1-based indexing */
    13541353                line = (const char *)history_get(length + libedit_history_start - 1)->line;
     
    13801379PyDoc_STRVAR(doc_module,
    13811380"Importing this module enables command line editing using GNU readline.");
    13821381
    1383 #ifdef __APPLE__
     1382#ifndef __APPLE__
    13841383PyDoc_STRVAR(doc_module_le,
    13851384"Importing this module enables command line editing using libedit readline.");
    13861385#endif /* __APPLE__ */
     
    14041403    PyObject *m;
    14051404    readlinestate *mod_state;
    14061405
    1407 #ifdef __APPLE__
     1406#ifndef __APPLE__
    14081407    if (strncmp(rl_library_version, libedit_version_tag, strlen(libedit_version_tag)) == 0) {
    14091408        using_libedit_emulation = 1;
    14101409    }