[pypy-commit] pypy default: merge compile_ncurses_tcl_tk_suse_latest which adds other locations to search

mattip pypy.commits at gmail.com
Tue Sep 10 01:59:38 EDT 2019


Author: Matti Picus <matti.picus at gmail.com>
Branch: 
Changeset: r97412:6ff327526dc7
Date: 2019-09-10 08:34 +0300
http://bitbucket.org/pypy/pypy/changeset/6ff327526dc7/

Log:	merge compile_ncurses_tcl_tk_suse_latest which adds other locations
	to search

diff --git a/lib_pypy/_curses_build.py b/lib_pypy/_curses_build.py
--- a/lib_pypy/_curses_build.py
+++ b/lib_pypy/_curses_build.py
@@ -1,4 +1,15 @@
 from cffi import FFI
+import os
+
+# On some systems, the ncurses library is
+# located at /usr/include/ncurses, so we must check this case.
+# Let's iterate over well known paths
+incdirs =  []
+for _path in ['/usr/include', '/usr/include/ncurses']:
+    if os.path.isfile(os.path.join(_path, 'panel.h')):
+        incdirs.append(_path)
+        break
+
 
 ffi = FFI()
 
@@ -10,6 +21,13 @@
 #define NCURSES_OPAQUE 0
 #endif
 
+
+/* ncurses 6 change behaviour  and makes all pointers opaque, 
+  lets define backward compatibility. It doesn't harm 
+  previous versions */
+
+#define NCURSES_INTERNALS 1
+#define NCURSES_REENTRANT 0
 #include <ncurses.h>
 #include <panel.h>
 #include <term.h>
@@ -41,7 +59,8 @@
 void _m_getsyx(int *yx) {
     getsyx(yx[0], yx[1]);
 }
-""", libraries=['ncurses', 'panel'])
+""", include_dirs=incdirs, 
+     libraries=['ncurses', 'panel'])
 
 
 ffi.cdef("""
diff --git a/lib_pypy/_tkinter/tklib_build.py b/lib_pypy/_tkinter/tklib_build.py
--- a/lib_pypy/_tkinter/tklib_build.py
+++ b/lib_pypy/_tkinter/tklib_build.py
@@ -36,8 +36,11 @@
         for _ver in ['8.6', '8.5', '']:
             incdirs = []
             linklibs = ['tcl' + _ver, 'tk' + _ver]
-            if os.path.isfile(''.join(['/usr/lib/lib', linklibs[1], '.so'])):
-                found = True
+            for lib in ['/usr/lib/lib', '/usr/lib64/lib']: 
+                if os.path.isfile(''.join([lib, linklibs[1], '.so'])):
+                    found = True
+                    break
+            if found:
                 break
     if not found:
         sys.stderr.write("*** TCL libraries not found!  Falling back...\n")
diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst
--- a/pypy/doc/whatsnew-head.rst
+++ b/pypy/doc/whatsnew-head.rst
@@ -66,3 +66,7 @@
 .. branch: cryptograhpt-2.7
 
 Update vendored cryptography used for _ssl to 2.7
+
+.. branch: compile_ncurses_tcl_tk_suse_latest
+
+Check for headers and runtime libraries in more locations to support other linuxes


More information about the pypy-commit mailing list