From 08d5948186227230f7bc103ed7c58c2cd9b4ce52 Mon Sep 17 00:00:00 2001 From: Johan Herland Date: Mon, 5 Aug 2019 16:40:04 +0200 Subject: [PATCH] bpo-37763: Teach setup.py to pick up "-isystem " from $CPPFLAGS When (cross-)compiling, setup.py will pick up header search dirs from $CPPFLAGS and lib search dirs from $LDFLAGS. However, the code only looks at the -I options in $CPPFLAGS to find header search dirs. Using the -isystem option (instead of -I) to pass header search dirs is also a valid option, but this is currently unsupported by setup.py. This patch adds handling of -isystem options, so that these are picked up the same way that -I options currently are. --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 7cd77257ae35df..b6bd361a32c8d7 100644 --- a/setup.py +++ b/setup.py @@ -634,7 +634,8 @@ def add_ldflags_cppflags(self): for env_var, arg_name, dir_list in ( ('LDFLAGS', '-R', self.compiler.runtime_library_dirs), ('LDFLAGS', '-L', self.compiler.library_dirs), - ('CPPFLAGS', '-I', self.compiler.include_dirs)): + ('CPPFLAGS', '-I', self.compiler.include_dirs), + ('CPPFLAGS', '-isystem', self.compiler.include_dirs)): env_val = sysconfig.get_config_var(env_var) if env_val: parser = argparse.ArgumentParser()