Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ readme = "README.md"
authors = [
{ name="Jeff Whitaker", email="[email protected]"}
]
license = "MIT"
license-files = ["LICENSE"]
license = {text = "MIT"}
classifiers = [
'Development Status :: 5 - Production/Stable',
'Operating System :: MacOS :: MacOS X',
Expand Down
25 changes: 12 additions & 13 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import sys
import numpy

from Cython.Build import cythonize
from setuptools import Command, Extension, setup


Expand All @@ -28,6 +27,7 @@
NAME = 'cftime'
CFTIME_DIR = os.path.join(SRCDIR, NAME)
CYTHON_FNAME = os.path.join(CFTIME_DIR, '_{}.pyx'.format(NAME))
CYTHON_CNAME = os.path.join(CFTIME_DIR, '_{}.c'.format(NAME))


class CleanCython(Command):
Expand All @@ -53,8 +53,7 @@ def run(self):
print('clean: skipping file {!r}'.format(artifact))


if ((FLAG_COVERAGE in sys.argv or os.environ.get('CYTHON_COVERAGE', None))
and cythonize):
if FLAG_COVERAGE in sys.argv or os.environ.get('CYTHON_COVERAGE', None):
COMPILER_DIRECTIVES = {
**COMPILER_DIRECTIVES, **COVERAGE_COMPILER_DIRECTIVES
}
Expand All @@ -68,16 +67,16 @@ def run(self):
if any([arg in CMDS_NOCYTHONIZE for arg in sys.argv]):
ext_modules = []
else:
extension = Extension('{}._{}'.format(NAME, NAME),
sources=[os.path.relpath(CYTHON_FNAME, BASEDIR)],
define_macros=DEFINE_MACROS,
include_dirs=[numpy.get_include(),])

ext_modules = cythonize(
extension,
compiler_directives=COMPILER_DIRECTIVES,
language_level=3,
)
ext_modules = [Extension('{}._{}'.format(NAME, NAME),
sources=[os.path.relpath(CYTHON_FNAME, BASEDIR)],
define_macros=DEFINE_MACROS,
include_dirs=[numpy.get_include(),])]
for e in ext_modules:
e.cython_directives = {'language_level': "3"}
e.compiler_directives = COMPILER_DIRECTIVES
# remove _cftime.c file if it exists, so cython will recompile _cftime.pyx.
if os.path.exists(CYTHON_CNAME):
os.remove(CYTHON_CNAME)

setup(
cmdclass={'clean_cython': CleanCython},
Expand Down
Loading