Skip to content

Commit

Permalink
Merge pull request #92 from bjlittle/fix-issue-91
Browse files Browse the repository at this point in the history
fix issue-91
  • Loading branch information
jswhit committed Dec 2, 2018
2 parents eced994 + 0ca8c44 commit 03bbb9f
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
from setuptools import Command, Extension, setup


BASEDIR = os.path.abspath(os.path.dirname(__file__))
CMD_CLEAN = 'clean'
COMPILER_DIRECTIVES = {}
DEFINE_MACROS = None
FLAG_COVERAGE = '--cython-coverage' # custom flag enabling Cython line tracing
BASEDIR = os.path.abspath(os.path.dirname(__file__))
NAME = 'cftime'
CFTIME_DIR = os.path.join(BASEDIR, NAME)
CYTHON_FNAME = os.path.join(CFTIME_DIR, '_{}.pyx'.format(NAME))
Expand Down Expand Up @@ -75,9 +76,16 @@ def description():
sys.argv.remove(FLAG_COVERAGE)
print('enable: "linetrace" Cython compiler directive')

extension = Extension('{}._{}'.format(NAME, NAME),
sources=[CYTHON_FNAME],
define_macros=DEFINE_MACROS)
# See https://github.com/Unidata/cftime/issues/91
if CMD_CLEAN in sys.argv:
ext_modules = []
else:
extension = Extension('{}._{}'.format(NAME, NAME),
sources=[CYTHON_FNAME],
define_macros=DEFINE_MACROS)
ext_modules = cythonize(extension,
compiler_directives=COMPILER_DIRECTIVES,
language_level=2)

setup(
name=NAME,
Expand All @@ -89,9 +97,7 @@ def description():
cmdclass={'clean_cython': CleanCython},
packages=[NAME],
version=extract_version(),
ext_modules=cythonize(extension,
compiler_directives=COMPILER_DIRECTIVES,
language_level=2),
ext_modules=ext_modules,
setup_requires=load('setup.txt'),
install_requires=load('requirements.txt'),
tests_require=load('requirements-dev.txt'),
Expand Down

0 comments on commit 03bbb9f

Please sign in to comment.