Author: Maciej Fijalkowski <fij...@gmail.com>
Branch: 
Changeset: r62953:084c46734a1c
Date: 2013-04-03 10:04 +0200
http://bitbucket.org/pypy/pypy/changeset/084c46734a1c/

Log:    Kill _minimal_curses mentions

diff --git a/lib_pypy/_minimal_curses.py b/lib_pypy/_minimal_curses.py
deleted file mode 100644
--- a/lib_pypy/_minimal_curses.py
+++ /dev/null
@@ -1,60 +0,0 @@
-"""Minimal '_curses' module, the low-level interface for curses module
-which is not meant to be used directly.
-
-Based on ctypes.  It's too incomplete to be really called '_curses', so
-to use it, you have to import it and stick it in sys.modules['_curses']
-manually.
-
-Note that there is also a built-in module _minimal_curses which will
-hide this one if compiled in.
-"""
-
-import ctypes, ctypes.util
-
-class error(Exception):
-    pass
-
-
-_clibpath = ctypes.util.find_library('curses')
-if not _clibpath:
-    raise ImportError("curses library not found")
-clib = ctypes.cdll.LoadLibrary(_clibpath)
-
-clib.setupterm.argtypes = [ctypes.c_char_p, ctypes.c_int,
-                           ctypes.POINTER(ctypes.c_int)]
-clib.setupterm.restype = ctypes.c_int
-
-clib.tigetstr.argtypes = [ctypes.c_char_p]
-clib.tigetstr.restype = ctypes.POINTER(ctypes.c_char)
-
-clib.tparm.argtypes = [ctypes.c_char_p] + 9 * [ctypes.c_int]
-clib.tparm.restype = ctypes.c_char_p
-
-OK = 0
-ERR = -1
-
-# ____________________________________________________________
-
-try: from __pypy__ import builtinify
-except ImportError: builtinify = lambda f: f
-
-@builtinify
-def setupterm(termstr, fd):
-    err = ctypes.c_int(0)
-    result = clib.setupterm(termstr, fd, ctypes.byref(err))
-    if result == ERR:
-        raise error("setupterm() failed (err=%d)" % err.value)
-
-@builtinify
-def tigetstr(cap):
-    result = clib.tigetstr(cap)
-    if ctypes.cast(result, ctypes.c_void_p).value == ERR:
-        return None
-    return ctypes.cast(result, ctypes.c_char_p).value
-
-@builtinify
-def tparm(str, i1=0, i2=0, i3=0, i4=0, i5=0, i6=0, i7=0, i8=0, i9=0):
-    result = clib.tparm(str, i1, i2, i3, i4, i5, i6, i7, i8, i9)
-    if result is None:
-        raise error("tparm() returned NULL")
-    return result
diff --git a/lib_pypy/pyrepl/curses.py b/lib_pypy/pyrepl/curses.py
--- a/lib_pypy/pyrepl/curses.py
+++ b/lib_pypy/pyrepl/curses.py
@@ -19,15 +19,12 @@
 # CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
 # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
-# Some try-import logic for two purposes: avoiding to bring in the whole
-# pure Python curses package if possible; and, in _curses is not actually
-# present, falling back to _minimal_curses (which is either a ctypes-based
-# pure Python module or a PyPy built-in module).
+# avoid importing the whole curses, if possible
 try:
     import _curses
 except ImportError:
     try:
-        import _minimal_curses as _curses
+        import curses
     except ImportError:
         # Who knows, maybe some environment has "curses" but not "_curses".
         # If not, at least the following import gives a clean ImportError.
diff --git a/rpython/tool/terminal.py b/rpython/tool/terminal.py
--- a/rpython/tool/terminal.py
+++ b/rpython/tool/terminal.py
@@ -75,16 +75,7 @@
     return text % MODULE.__dict__
 
 try:
-    if '__pypy__' in sys.builtin_module_names:
-        # this is not really the whole curses, but our _minimal_curses it's
-        # better than nothing
-        import _minimal_curses as curses
-        # a bit of a hack: we have tigetstr but not tigetnum, so we call
-        # default() to have default values, then setup() will overwrite the
-        # ones it can
-        default()
-    else:
-        import curses
+    import curses
     setup()
 except Exception, e:
     # There is a failure; set all attributes to default
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to