From 1b3a766b16ea315a115f78bfe97fab90305871e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Fri, 20 Sep 2024 14:40:25 +0200 Subject: [PATCH] Support any number of flags in UVLOOP_OPT_CFLAGS Use `shlex.split()` to split the flags in `UVLOOP_OPT_FLAGS`, permitting the user to pass any number of flags rather than exactly one. This can be used e.g. to pass `-O2 -flto`. --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 32d94ae..920077d 100644 --- a/setup.py +++ b/setup.py @@ -12,6 +12,7 @@ import os.path import pathlib import platform import re +import shlex import shutil import subprocess import sys @@ -23,7 +24,7 @@ from setuptools.command.sdist import sdist CYTHON_DEPENDENCY = 'Cython~=3.0' MACHINE = platform.machine() -MODULES_CFLAGS = [os.getenv('UVLOOP_OPT_CFLAGS', '-O2')] +MODULES_CFLAGS = shlex.split(os.getenv('UVLOOP_OPT_CFLAGS', '-O2')) _ROOT = pathlib.Path(__file__).parent LIBUV_DIR = str(_ROOT / 'vendor' / 'libuv') LIBUV_BUILD_DIR = str(_ROOT / 'build' / 'libuv-{}'.format(MACHINE))