33
44try :
55 # Import setuptools so that it monkey-patch overrides distutils
6- import setuptools
6+ import setuptools # noqa: F401
77except ImportError :
88 pass
99
1515
1616EXTRA_FLAGS_PER_COMPILER_TYPE_PER_PATH_COMPONENT = {
1717 "unix" : {
18- "base64/arch/ssse3" : "-mssse3" ,
19- "base64/arch/sse41" : "-msse4.1" ,
20- "base64/arch/sse42" : "-msse4.2" ,
21- "base64/arch/avx2" : "-mavx2" ,
22- "base64/arch/avx" : "-mavx" ,
18+ "base64/arch/ssse3" : [ "-mssse3" , "-DBASE64_WITH_SSSE3" ] ,
19+ "base64/arch/sse41" : [ "-msse4.1" , "-DBASE64_WITH_SSE41" ] ,
20+ "base64/arch/sse42" : [ "-msse4.2" , "-DBASE64_WITH_SSE42" ] ,
21+ "base64/arch/avx2" : [ "-mavx2" , "-DBASE64_WITH_AVX2" ] ,
22+ "base64/arch/avx" : [ "-mavx" , "-DBASE64_WITH_AVX" ] ,
2323 },
2424 "msvc" : {
25- "base64/arch/sse42" : "/arch:SSE4.2" ,
26- "base64/arch/avx2" : "/arch:AVX2" ,
27- "base64/arch/avx" : "/arch:AVX" ,
25+ "base64/arch/sse42" : [ "/arch:SSE4.2" , "/DBASE64_WITH_SSE42" ] ,
26+ "base64/arch/avx2" : [ "/arch:AVX2" , "/DBASE64_WITH_AVX2" ] ,
27+ "base64/arch/avx" : [ "/arch:AVX" , "/DBASE64_WITH_AVX" ] ,
2828 },
2929}
3030
@@ -47,11 +47,13 @@ def spawn(self, cmd, **kwargs) -> None: # type: ignore[no-untyped-def]
4747 for path in extra_options .keys ():
4848 if path in str (argument ):
4949 if compiler_type == "bcpp" :
50+ compiler = new_cmd .pop ()
5051 # Borland accepts a source file name at the end,
5152 # insert the options before it
52- new_cmd [- 1 :- 1 ] = extra_options [path ]
53+ new_cmd .extend (extra_options [path ])
54+ new_cmd .append (compiler )
5355 else :
54- new_cmd .append (extra_options [path ])
56+ new_cmd .extend (extra_options [path ])
5557
5658 # path component is found, no need to search any further
5759 break
0 commit comments