| 184 | |
| 185 | # https://github.com/pypa/setuptools/issues/2806 |
| 186 | def new_compiler(): |
| 187 | from setuptools import Distribution |
| 188 | |
| 189 | build_ext = Distribution().get_command_obj("build_ext") |
| 190 | build_ext.finalize_options() |
| 191 | # register an extension to ensure a compiler is created |
| 192 | build_ext.extensions = [Extension("ignored", ["ignored.c"])] |
| 193 | # disable building fake extensions |
| 194 | build_ext.build_extensions = lambda: None |
| 195 | # run to populate self.compiler |
| 196 | build_ext.run() |
| 197 | return build_ext.compiler |
| 198 | |
| 199 | |
| 200 | def add_from_path(envname, dirs): |