[Python-checkins] r45825 - in python/trunk: Doc/lib/librlcompleter.tex Lib/rlcompleter.py Lib/test/test_sundry.py Misc/NEWS

georg.brandl python-checkins at python.org
Sun Apr 30 20:14:55 CEST 2006


Author: georg.brandl
Date: Sun Apr 30 20:14:54 2006
New Revision: 45825

Modified:
   python/trunk/Doc/lib/librlcompleter.tex
   python/trunk/Lib/rlcompleter.py
   python/trunk/Lib/test/test_sundry.py
   python/trunk/Misc/NEWS
Log:
Patch #1472854: make the rlcompleter.Completer class usable on non-
UNIX platforms.


Modified: python/trunk/Doc/lib/librlcompleter.tex
==============================================================================
--- python/trunk/Doc/lib/librlcompleter.tex	(original)
+++ python/trunk/Doc/lib/librlcompleter.tex	Sun Apr 30 20:14:54 2006
@@ -2,18 +2,17 @@
          Completion function for GNU readline}
 
 \declaremodule{standard}{rlcompleter}
-  \platform{Unix}
 \sectionauthor{Moshe Zadka}{moshez at zadka.site.co.il}
-\modulesynopsis{Python identifier completion for the GNU readline library.}
+\modulesynopsis{Python identifier completion, suitable for the GNU readline library.}
 
-The \module{rlcompleter} module defines a completion function for
+The \module{rlcompleter} module defines a completion function suitable for
 the \refmodule{readline} module by completing valid Python identifiers
 and keywords.
 
-This module is \UNIX-specific due to its dependence on the
-\refmodule{readline} module.
-
-The \module{rlcompleter} module defines the \class{Completer} class.
+When this module is imported on a \UNIX\ platform with the \module{readline}
+module available, an instance of the \class{Completer} class is automatically
+created and its \method{complete} method is set as the \module{readline}
+completer.
 
 Example:
 
@@ -44,6 +43,9 @@
 \end{verbatim}
 
 
+On platforms without \module{readline}, the \class{Completer} class defined
+by this module can still be used for custom purposes.
+
 \subsection{Completer Objects \label{completer-objects}}
 
 Completer objects have the following method:

Modified: python/trunk/Lib/rlcompleter.py
==============================================================================
--- python/trunk/Lib/rlcompleter.py	(original)
+++ python/trunk/Lib/rlcompleter.py	Sun Apr 30 20:14:54 2006
@@ -39,7 +39,6 @@
 
 """
 
-import readline
 import __builtin__
 import __main__
 
@@ -147,4 +146,9 @@
             ret = ret + get_class_members(base)
     return ret
 
-readline.set_completer(Completer().complete)
+try:
+    import readline
+except ImportError:
+    pass
+else:
+    readline.set_completer(Completer().complete)

Modified: python/trunk/Lib/test/test_sundry.py
==============================================================================
--- python/trunk/Lib/test/test_sundry.py	(original)
+++ python/trunk/Lib/test/test_sundry.py	Sun Apr 30 20:14:54 2006
@@ -50,11 +50,7 @@
 import py_compile
 import pydoc
 import rexec
-try:
-    import rlcompleter   # not available on Windows
-except ImportError:
-    if verbose:
-        print "skipping rlcompleter"
+import rlcompleter
 import sched
 import smtplib
 import sndhdr

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Sun Apr 30 20:14:54 2006
@@ -86,6 +86,9 @@
 Library
 -------
 
+- Patch #1472854: make the rlcompleter.Completer class usable on non-
+  UNIX platforms.
+
 - Patch #1470846: fix urllib2 ProxyBasicAuthHandler.
 
 - Patch #1475231: ``doctest`` has a new ``SKIP`` option, which causes


More information about the Python-checkins mailing list