| 82 | ) |
| 83 | |
| 84 | def build_extension(self, ext): |
| 85 | # "ProgramFiles(x86)" is not a valid environment variable in Cygwin but is needed for |
| 86 | # the MSVCCompiler in distutils. |
| 87 | if os.name == "nt": |
| 88 | if "ProgramFiles" in os.environ and "ProgramFiles(x86)" not in os.environ: |
| 89 | os.environ["ProgramFiles(x86)"] = os.environ["ProgramFiles"] + " (x86)" |
| 90 | name = ext.name |
| 91 | try: |
| 92 | build_ext.build_extension(self, ext) |
| 93 | except Exception: |
| 94 | if os.environ.get("PYMONGO_C_EXT_MUST_BUILD"): |
| 95 | raise |
| 96 | e = sys.exc_info()[1] |
| 97 | sys.stdout.write("%s\n" % str(e)) |
| 98 | warnings.warn( |
| 99 | self.warning_message |
| 100 | % ( |
| 101 | "The %s extension module" % (name,), # noqa: UP031 |
| 102 | "The output above this warning shows how the compilation failed.", |
| 103 | ), |
| 104 | stacklevel=2, |
| 105 | ) |
| 106 | |
| 107 | |
| 108 | ext_modules = [ |