Edgewall Software
Modify

Opened 17 years ago

Closed 7 years ago

Last modified 7 years ago

#6695 closed enhancement (wontfix)

trac-admin should alter completion binding on Mac OS X Leopard

Reported by: mirko-trac@… Owned by:
Priority: normal Milestone:
Component: admin/console Version: 0.11b1
Severity: normal Keywords: readline, libedit, macosx, patch
Cc: Thijs Triemstra Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Python-2.5.1 on Mac OS X Leopard does not use the standard readline library, but libedit. In ipython the following solution is used:

# Test to see if libedit is being used instead of GNU readline.
# Thanks to Boyd Waters for this patch.
import readline as _rl
uses_libedit = False
if sys.platform == 'darwin' and have_readline:
    import commands
    (status, result) = commands.getstatusoutput( "otool -L %s | grep libedit" % _rl.__file__ )
    if status == 0 and len(result) > 0:
        # we are bound to libedit - new in Leopard
        _rl.parse_and_bind("bind ^I rl_complete")
        print "Leopard libedit detected."
        uses_libedit = True

Attachments (2)

libedit.patch (1.2 KB ) - added by mirko-trac@… 17 years ago.
pythonstartup.patch (833 bytes ) - added by mirko-trac@… 17 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 by sid, 17 years ago

Keywords: macosx added; mac os x removed

If possible, it would be useful to have this in the form of a patch (using svn diff or the like). That would make it much easier for people to evaluate the patch, and then apply it to trunk.

comment:2 by mirko-trac@…, 17 years ago

Hello,

I attach a patch against source:sandbox/multirepos as svn-diff. As console.py has not changed this should be appliable against the trunk as well.

Regards Mirko

by mirko-trac@…, 17 years ago

Attachment: libedit.patch added

comment:4 by Christian Boos, 17 years ago

Isn't that rather a bug from the readline package on that platform? You'd certainly prefer a fix that will work for each of your shell-like applications, rather than having to patch each one. Have you tried doing that in your PYTHONSTARTUP file, like described in this blog entry?

On a somewhat related note, thanks to the links you've posted, I found out that IPython's PyReadline works quite well with TracAdmin on Windows (no history support, though).

in reply to:  4 comment:5 by mirko-trac@…, 17 years ago

Replying to cboos:

Isn't that rather a bug from the readline package on that platform? You'd certainly prefer a fix that will work for each of your shell-like applications, rather than having to patch each one. Have you tried doing that in your PYTHONSTARTUP file, like described in this blog entry?

OK, then I propose to use a fix suggested in http://docs.python.org/tut/node4.html#SECTION004240000000000000000, see attachment:pythonstartup.patch

by mirko-trac@…, 17 years ago

Attachment: pythonstartup.patch added

comment:6 by Remy Blank, 16 years ago

Keywords: patch added
Milestone: 2.0
Owner: Christopher Lenz removed

comment:7 by Christian Boos, 15 years ago

Milestone: 2.0unscheduled

Milestone 2.0 deleted

comment:8 by Thijs Triemstra, 14 years ago

Cc: Thijs Triemstra added

comment:9 by Ryan J Ollos, 10 years ago

Keywords: readline libedit macosx patch → readline, libedit, macosx, patch

comment:10 by Ryan J Ollos, 7 years ago

Milestone: unscheduled
Resolution: wontfix
Status: newclosed

Command completion works fine on OSX 10.12.6 with Python 2.7. I have Python and readline installed via Brew. The readline package is recommended in Brew:

$brew info python
python: stable 2.7.13 (bottled), HEAD
Interpreted, interactive, object-oriented programming language
https://www.python.org
/usr/local/Cellar/python/2.7.13_1 (3,767 files, 52.3MB) *
  Poured from bottle on 2017-07-18 at 09:24:23
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/python.rb
==> Dependencies
Build: sphinx-doc ✘, pkg-config ✔
Required: openssl ✔
Recommended: readline ✔, sqlite ✔, gdbm ✔
Optional: sphinx-doc ✘, tcl-tk ✘, berkeley-db@4 ✘
==> Options
[...]
--without-readline
    Build without readline support
[...]

As best I can tell, the issue reported in this ticket only occurs with Python 2.5. There's no documented support for libedit on Python 2.5, but support appears to be documented for Python 2.6 and Python 2.7. However, see also comments in trac-dev:wBiEpCNH654/gU33rJTOAwAJ.

If there are any issue encountered on OSX with Python 2.7, please open a new ticket. We can at least document what is needed to get command completion, whether that be installing readline, pypi:pyreadline or pypi:gnureadline.

Last edited 7 years ago by Ryan J Ollos (previous) (diff)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The ticket will remain with no owner.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from (none) to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.