Skip to content

Commit

Permalink
BLD: since we already use setuptools, let's remove the optional logic…
Browse files Browse the repository at this point in the history
closes #18113

Author: Grzegorz Konefał <grzegorz.konefal@reef.pl>
Author: Krzysztof Chomski <krzysztof.chomski@reef.pl>

Closes #18448 from gkonefal-reef/GH18113 and squashes the following commits:

21cbe79 [Grzegorz Konefał] Comments applied
290b49c [Krzysztof Chomski] BLD: since we already use setuptools, let's remove the optional logic in setup.py (GH18113).
  • Loading branch information
gkonefal-reef authored and jreback committed Dec 3, 2017
1 parent dc5403f commit a9e4731
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 42 deletions.
1 change: 1 addition & 0 deletions doc/source/whatsnew/v0.22.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ Other API Changes
- Restricted ``DateOffset`` keyword arguments. Previously, ``DateOffset`` subclasses allowed arbitrary keyword arguments which could lead to unexpected behavior. Now, only valid arguments will be accepted. (:issue:`17176`, :issue:`18226`).
- :func:`DataFrame.from_items` provides a more informative error message when passed scalar values (:issue:`17312`)
- When created with duplicate labels, ``MultiIndex`` now raises a ``ValueError``. (:issue:`17464`)
- Building from source now explicity requires ``setuptools`` in ``setup.py`` (:issue:`18113`)

.. _whatsnew_0220.deprecations:

Expand Down
56 changes: 14 additions & 42 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,18 @@
import os
from os.path import join as pjoin

import pkg_resources
import sys
import shutil
from distutils.version import LooseVersion
from setuptools import setup, Command

# versioning
import versioneer
cmdclass = versioneer.get_cmdclass()

PY3 = sys.version_info[0] >= 3


def is_platform_windows():
return sys.platform == 'win32' or sys.platform == 'cygwin'
Expand All @@ -38,46 +42,18 @@ def is_platform_mac():
except ImportError:
_CYTHON_INSTALLED = False

try:
import pkg_resources
from setuptools import setup, Command
_have_setuptools = True
except ImportError:
# no setuptools installed
from distutils.core import setup, Command
_have_setuptools = False

setuptools_kwargs = {}
min_numpy_ver = '1.9.0'
if sys.version_info[0] >= 3:
setuptools_kwargs = {
'install_requires': [
'python-dateutil >= 2' if PY3 else 'python-dateutil',
'pytz >= 2011k',
'numpy >= %s' % min_numpy_ver,
],
'setup_requires': ['numpy >= %s' % min_numpy_ver],
'zip_safe': False,
}

setuptools_kwargs = {'zip_safe': False,
'install_requires': ['python-dateutil >= 2',
'pytz >= 2011k',
'numpy >= %s' % min_numpy_ver],
'setup_requires': ['numpy >= %s' % min_numpy_ver]}
if not _have_setuptools:
sys.exit("need setuptools/distribute for Py3k"
"\n$ pip install distribute")

else:
setuptools_kwargs = {
'install_requires': ['python-dateutil',
'pytz >= 2011k',
'numpy >= %s' % min_numpy_ver],
'setup_requires': ['numpy >= %s' % min_numpy_ver],
'zip_safe': False,
}

if not _have_setuptools:
try:
import numpy # noqa:F401
import dateutil # noqa:F401
setuptools_kwargs = {}
except ImportError:
sys.exit("install requires: 'python-dateutil < 2','numpy'."
" use pip or easy_install."
"\n $ pip install 'python-dateutil < 2' 'numpy'")

from distutils.extension import Extension # noqa:E402
from distutils.command.build import build # noqa:E402
Expand Down Expand Up @@ -695,7 +671,7 @@ def pxd(name):
# ----------------------------------------------------------------------
# ujson

if suffix == '.pyx' and 'setuptools' in sys.modules:
if suffix == '.pyx':
# undo dumb setuptools bug clobbering .pyx sources back to .c
for ext in extensions:
if ext.sources[0].endswith(('.c', '.cpp')):
Expand Down Expand Up @@ -729,10 +705,6 @@ def pxd(name):
sources=['pandas/util/move.c'])
extensions.append(_move_ext)


if _have_setuptools:
setuptools_kwargs["test_suite"] = "nose.collector"

# The build cache system does string matching below this point.
# if you change something, be careful.

Expand Down

0 comments on commit a9e4731

Please sign in to comment.