Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow setup.py --version to run without Cython, numpy #7

Merged
merged 2 commits into from
Apr 16, 2020
Merged
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
17 changes: 12 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import sys
from setuptools import setup, Extension

import numpy as np
from Cython.Build import cythonize
# Special case here to allow `python setup.py --version` to run without
# requiring cython and numpy to be installed.
if '--version' in sys.argv[1:]:
cythonize = lambda arg: None
fastss_ext = None
else:
from Cython.Build import cythonize
import numpy as np
fastss_ext = Extension("Ska.Numpy.fastss",
['Ska/Numpy/fastss.pyx'],
include_dirs=[np.get_include()])

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't something like this then silently not install the extension if you install within an environment that does not have cython?

fastss_ext = Extension("Ska.Numpy.fastss",
['Ska/Numpy/fastss.pyx'],
include_dirs=[np.get_include()])
try:
from testr.setup_helper import cmdclass
except ImportError:
Expand Down