From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Fri, 14 Jan 2022 23:36:52 +0330 Subject: [PATCH] Tweak `setup.py` Make some tweaks to Python's `setup.py`: - Add `/usr/local/lib` and `/usr/local/include` to the system lib and include dirs respectively, relative to the sysroot when crosscompiling. These are by default only included when not crosscompiling for some reason. - Add `/usr/local/include/ncurses` to the curses include paths so it can build the `_curses` module. This is by default included for a bunch of extensions, but not `_curses`. --- setup.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 15d0d4576a4772e9920ac2d7c1a9dee75c29b341..e651ac7627e8b796f8b9b4d60f592bc9261b6540 100644 --- a/setup.py +++ b/setup.py @@ -868,8 +868,8 @@ class PyBuildExt(build_ext): add_dir_to_list(self.compiler.include_dirs, sysconfig.get_config_var("INCLUDEDIR")) - system_lib_dirs = ['/lib64', '/usr/lib64', '/lib', '/usr/lib'] - system_include_dirs = ['/usr/include'] + system_lib_dirs = ['/lib64', '/usr/lib64', '/lib', '/usr/lib', '/usr/local/lib'] + system_include_dirs = ['/usr/include', '/usr/local/include'] # lib_dirs and inc_dirs are used to search for files; # if a file is found in one of those directories, it can # be assumed that no additional -I,-L directives are needed. @@ -1117,7 +1117,12 @@ class PyBuildExt(build_ext): # Curses support, requiring the System V version of curses, often # provided by the ncurses library. curses_defines = [] - curses_includes = [] + if not CROSS_COMPILING: + curses_includes = ['/usr/local/include/ncurses'] + else: + curses_includes = sysroot_paths( + ('CPPFLAGS', 'CFLAGS', 'CC'), ['/usr/local/include/ncurses'] + ) panel_library = 'panel' if curses_library == 'ncursesw': curses_defines.append(('HAVE_NCURSESW', '1'))