Skip to content

Commit

Permalink
Backport PR pandas-dev#25568: BLD: Fixed pip install with no numpy
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAugspurger authored and MeeseeksDev[bot] committed Mar 6, 2019
1 parent f99f44a commit 7d449b2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions doc/source/whatsnew/v0.24.2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Fixed Regressions
- Fixed regression in :class:`TimedeltaIndex` where ``np.sum(index)`` incorrectly returned a zero-dimensional object instead of a scalar (:issue:`25282`)
- Fixed regression in ``IntervalDtype`` construction where passing an incorrect string with 'Interval' as a prefix could result in a ``RecursionError``. (:issue:`25338`)
- Fixed regression in :class:`Categorical`, where constructing it from a categorical ``Series`` and an explicit ``categories=`` that differed from that in the ``Series`` created an invalid object which could trigger segfaults. (:issue:`25318`)
- Fixed pip installing from source into an environment without NumPy (:issue:`25193`)

.. _whatsnew_0242.enhancements:

Expand Down
12 changes: 7 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,11 @@ def maybe_cythonize(extensions, *args, **kwargs):
# Avoid running cythonize on `python setup.py clean`
# See https://github.com/cython/cython/issues/1495
return extensions
if not cython:
# Avoid trying to look up numpy when installing from sdist
# https://github.com/pandas-dev/pandas/issues/25193
# TODO: See if this can be removed after pyproject.toml added.
return extensions

numpy_incl = pkg_resources.resource_filename('numpy', 'core/include')
# TODO: Is this really necessary here?
Expand All @@ -480,11 +485,8 @@ def maybe_cythonize(extensions, *args, **kwargs):
numpy_incl not in ext.include_dirs):
ext.include_dirs.append(numpy_incl)

if cython:
build_ext.render_templates(_pxifiles)
return cythonize(extensions, *args, **kwargs)
else:
return extensions
build_ext.render_templates(_pxifiles)
return cythonize(extensions, *args, **kwargs)


def srcpath(name=None, suffix='.pyx', subdir='src'):
Expand Down

0 comments on commit 7d449b2

Please sign in to comment.