From a2161287c2b4ea0e71fb79a376eb3cc5ddb5d53f Mon Sep 17 00:00:00 2001 From: tqfx Date: Sun, 12 May 2024 12:40:31 +0800 Subject: [PATCH] change USE_PYTHON type from boolean to int --- setup.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/setup.py b/setup.py index 2133646..ef5ef9b 100755 --- a/setup.py +++ b/setup.py @@ -7,10 +7,10 @@ except ImportError: from distutils.extension import Extension from distutils.core import setup try: - USE_CYTHON = True + USE_CYTHON = 1 from Cython.Build import cythonize except ImportError: - USE_CYTHON = False + USE_CYTHON = 0 from subprocess import Popen from argparse import ArgumentParser from sys import byteorder @@ -43,7 +43,7 @@ def strtobool(s): os.chdir(os.path.dirname(os.path.abspath(sys.argv[0]))) if len(sys.argv) < 2: sys.argv += ["--quiet", "build_ext", "--inplace"] -if not USE_CYTHON: +if USE_CYTHON == 0: CYTHON = find_executable("cython3", "cython") LIBA_OPENMP = os.environ.get("LIBA_OPENMP") if LIBA_OPENMP: @@ -163,13 +163,11 @@ ext_modules = [ ) ] if USE_CYTHON: - ext_modules = cythonize( - ext_modules, - quiet=True, - ) + ext_modules = cythonize(ext_modules, quiet=True) elif CYTHON: - cmd = [CYTHON, "--fast-fail", "--module-name"] - Popen(cmd + ["liba", "python/src/a.pyx"]).wait() + cmd = [CYTHON, "--fast-fail"] + cmd += ["--module-name", "liba"] + Popen(cmd + ["python/src/a.pyx"]).wait() class Build(build_ext): # type: ignore -- 2.11.4.GIT