11#!/usr/bin/env python
22"""SingleStoreDB package installer."""
3+ import os
34import platform
45from typing import Tuple
56
1112py_limited_api = '0x03080000'
1213# py_limited_api = False
1314
15+ build_extension = bool (int (os .environ .get ('SINGLESTOREDB_BUILD_EXTENSION' , '1' )))
16+
1417universal2_flags = ['-arch' , 'x86_64' , '-arch' , 'arm64' ] \
1518 if (
1619 platform .platform ().startswith ('mac' ) and
@@ -33,16 +36,21 @@ def get_tag(self) -> Tuple[str, str, str]:
3336 return python , abi , plat
3437
3538
36- setup (
37- ext_modules = [
38- Extension (
39- '_singlestoredb_accel' ,
40- sources = ['accel.c' ],
41- define_macros = [('Py_LIMITED_API' , py_limited_api )] if py_limited_api else [],
42- py_limited_api = bool (py_limited_api ),
43- extra_compile_args = universal2_flags ,
44- extra_link_args = universal2_flags ,
45- ),
46- ],
47- cmdclass = {'bdist_wheel' : bdist_wheel_abi3 if py_limited_api else bdist_wheel },
48- )
39+ if build_extension :
40+ setup (
41+ ext_modules = [
42+ Extension (
43+ '_singlestoredb_accel' ,
44+ sources = ['accel.c' ],
45+ define_macros = [
46+ ('Py_LIMITED_API' , py_limited_api ),
47+ ] if py_limited_api else [],
48+ py_limited_api = bool (py_limited_api ),
49+ extra_compile_args = universal2_flags ,
50+ extra_link_args = universal2_flags ,
51+ ),
52+ ],
53+ cmdclass = {'bdist_wheel' : bdist_wheel_abi3 if py_limited_api else bdist_wheel },
54+ )
55+ else :
56+ setup ()
0 commit comments