Mike Frysinger | ce0b8c0 | 2019-07-11 00:40:18 -0400 | [diff] [blame] | 1 | Remove local python modules from the search path when running the compiler. |
| 2 | |
| 3 | The python build will invoke python with a custom PYTHONPATH (pointing to |
| 4 | local libs) which will mess up any python scripts we execute, like our |
| 5 | compiler wrapper. |
| 6 | |
| 7 | We can't create wrappers and point the build at those because python will |
| 8 | record the values for CC/CXX and write it out to its installed modules, and |
| 9 | those values will be loaded later when cross-compiling other python packages. |
| 10 | |
| 11 | This hack is kind of terrible, but so are many of the alternatives. |
| 12 | |
| 13 | --- a/setup.py |
| 14 | +++ a/setup.py |
| 15 | @@ -46,6 +46,10 @@ |
| 16 | disable_ssl = 0 |
| 17 | |
| 18 | |
| 19 | +for v in ('CC', 'CXX', 'LDSHARED'): |
| 20 | + if v in os.environ: |
| 21 | + os.environ[v] = 'env -u PYTHONPATH ' + os.environ[v] |
| 22 | + |
| 23 | exit_status = 0 |
| 24 | |
| 25 | def add_dir_to_list(dirlist, dir): |