|
41 | 41 | from mypyc.ir.pprint import format_modules |
42 | 42 | from mypyc.namegen import exported_name |
43 | 43 | from mypyc.options import CompilerOptions |
44 | | - |
| 44 | +import mypyc.build_setup |
45 | 45 |
|
46 | 46 | class ModDesc(NamedTuple): |
47 | 47 | module: str |
@@ -122,52 +122,6 @@ class ModDesc(NamedTuple): |
122 | 122 | else: |
123 | 123 | from distutils import ccompiler, sysconfig |
124 | 124 |
|
125 | | -EXTRA_FLAGS_PER_COMPILER_TYPE_PER_PATH_COMPONENT = { |
126 | | - "unix": { |
127 | | - "base64/arch/ssse3": "-mssse3", |
128 | | - "base64/arch/sse41": "-msse4.1", |
129 | | - "base64/arch/sse42": "-msse4.2", |
130 | | - "base64/arch/avx2": "-mavx2", |
131 | | - "base64/arch/avx": "-mavx", |
132 | | - }, |
133 | | - "msvc": { |
134 | | - "base64/arch/sse42": "/arch:SSE4.2", |
135 | | - "base64/arch/avx2": "/arch:AVX2", |
136 | | - "base64/arch/avx": "/arch:AVX", |
137 | | - }, |
138 | | -} |
139 | | - |
140 | | -__spawn = ccompiler.CCompiler.spawn |
141 | | - |
142 | | - |
143 | | -def spawn(self, cmd, **kwargs): # type: ignore[no-untyped-def] |
144 | | - compiler_type: str = self.compiler_type |
145 | | - extra_options = EXTRA_FLAGS_PER_COMPILER_TYPE_PER_PATH_COMPONENT[compiler_type] |
146 | | - new_cmd = list(cmd) |
147 | | - if extra_options is not None: |
148 | | - # filenames are closer to the end of command line |
149 | | - for argument in reversed(new_cmd): |
150 | | - # Check if argument contains a filename. We must check for all |
151 | | - # possible extensions; checking for target extension is faster. |
152 | | - if self.obj_extension and not str(argument).endswith(self.obj_extension): |
153 | | - continue |
154 | | - |
155 | | - for path in extra_options.keys(): |
156 | | - if path in str(argument): |
157 | | - if compiler_type == "bcpp": |
158 | | - # Borland accepts a source file name at the end, |
159 | | - # insert the options before it |
160 | | - new_cmd[-1:-1] = extra_options[path] |
161 | | - else: |
162 | | - new_cmd.append(extra_options[path]) |
163 | | - |
164 | | - # path component is found, no need to search any further |
165 | | - break |
166 | | - __spawn(self, new_cmd, **kwargs) |
167 | | - |
168 | | - |
169 | | -ccompiler.CCompiler.spawn = spawn # type: ignore[method-assign] |
170 | | - |
171 | 125 |
|
172 | 126 | def get_extension() -> type[Extension]: |
173 | 127 | # We can work with either setuptools or distutils, and pick setuptools |
|
0 commit comments