File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111BASEDIR = os .path .abspath (os .path .dirname (__file__ ))
1212SRCDIR = os .path .join (BASEDIR ,'src' )
1313CMDS_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+
1418COMPILER_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
109118setup (
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)
You can’t perform that action at this time.
0 commit comments