Skip to content

Commit 473d26f

Browse files
committed
fixup! fixup! fixup! exp: tentative fixup
1 parent a62b2be commit 473d26f

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

setup.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
BASEDIR = os.path.abspath(os.path.dirname(__file__))
1212
SRCDIR = os.path.join(BASEDIR,'src')
1313
CMDS_NOCYTHONIZE = ['clean','clean_cython','sdist']
14+
15+
# See https://github.com/Unidata/cftime/issues/91
16+
USE_CYTHONIZE = not any([arg in CMDS_NOCYTHONIZE for arg in sys.argv])
17+
1418
COMPILER_DIRECTIVES = {
1519
# Cython 3.0.0 changes the default of the c_api_binop_methods directive to
1620
# False, resulting in errors in datetime and timedelta arithmetic:
@@ -105,9 +109,14 @@ def run(self):
105109
sys.argv.remove(FLAG_COVERAGE)
106110
print('enable: "linetrace" Cython compiler directive')
107111

112+
if USE_CYTHONIZE:
113+
# To trick build into running build_ext
114+
ext_modules = [Extension('cftime.x', ['x.c'])]
115+
else:
116+
ext_modules = []
108117

109118
setup(
110119
cmdclass={'clean_cython': CleanCython, 'build_ext': BuildExt},
111-
ext_modules = [Extension('cftime.x', ['x.c'])], # To trick build into running build_ext
120+
ext_modules=ext_modules,
112121
options=SETUP_OPTIONS,
113122
)

0 commit comments

Comments
 (0)