Skip to content

Commit a130375

Browse files
setup.py: allow to override extra_compile_args (#443)
At the moment extra_compile_args is set to -O2 by default. But m68k toolchain has a bug that when trying to build Extension uvloop.loop enters an infinite loop[1]. So we need to override -O2 with -O0 to make it work. So let's getenv('MODULES_CFLAGS') and assign it to local MODULES_CFLAGS (former CFLAGS) and assign it to extra_compile_args. If not MODULES_CFLAGS is found then -O2 is kept as default. [1]: http://autobuild.buildroot.net/results/17d/17d6e6422abadcd6313c430c40f2a5d7162dbbd3/build-end.log Signed-off-by: Giulio Benetti <[email protected]> * Rename to UVLOOP_OPT_CFLAGS Co-authored-by: Fantix King <[email protected]>
1 parent fedba80 commit a130375

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555

5656

5757
MACHINE = platform.machine()
58-
CFLAGS = ['-O2']
58+
MODULES_CFLAGS = [os.getenv('UVLOOP_OPT_CFLAGS', '-O2')]
5959
_ROOT = pathlib.Path(__file__).parent
6060
LIBUV_DIR = str(_ROOT / 'vendor' / 'libuv')
6161
LIBUV_BUILD_DIR = str(_ROOT / 'build' / 'libuv-{}'.format(MACHINE))
@@ -301,7 +301,7 @@ def build_extensions(self):
301301
sources=[
302302
"uvloop/loop.pyx",
303303
],
304-
extra_compile_args=CFLAGS
304+
extra_compile_args=MODULES_CFLAGS
305305
),
306306
],
307307
classifiers=[

0 commit comments

Comments
 (0)