Skip to content

Commit c6b88e1

Browse files
gkonefal-reefjreback
authored andcommitted
BLD: since we already use setuptools, let's remove the optional logic…
closes pandas-dev#18113 Author: Grzegorz Konefał <[email protected]> Author: Krzysztof Chomski <[email protected]> Closes pandas-dev#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).
1 parent 7a3f81a commit c6b88e1

File tree

2 files changed

+13
-42
lines changed

2 files changed

+13
-42
lines changed

doc/source/whatsnew/v0.22.0.txt

+1
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ Other API Changes
114114
- Inserting missing values into indexes will work for all types of indexes and automatically insert the correct type of missing value (``NaN``, ``NaT``, etc.) regardless of the type passed in (:issue:`18295`)
115115
- 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`).
116116
- :func:`DataFrame.from_items` provides a more informative error message when passed scalar values (:issue:`17312`)
117+
- Building from source now explicity requires ``setuptools`` in ``setup.py`` (:issue:`18113`)
117118

118119
.. _whatsnew_0220.deprecations:
119120

setup.py

+12-42
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@
99
import os
1010
from os.path import join as pjoin
1111

12+
import pkg_resources
1213
import sys
1314
import shutil
1415
from distutils.version import LooseVersion
16+
from setuptools import setup, Command
1517

1618
# versioning
1719
import versioneer
@@ -38,46 +40,18 @@ def is_platform_mac():
3840
except ImportError:
3941
_CYTHON_INSTALLED = False
4042

41-
try:
42-
import pkg_resources
43-
from setuptools import setup, Command
44-
_have_setuptools = True
45-
except ImportError:
46-
# no setuptools installed
47-
from distutils.core import setup, Command
48-
_have_setuptools = False
4943

50-
setuptools_kwargs = {}
5144
min_numpy_ver = '1.9.0'
52-
if sys.version_info[0] >= 3:
45+
setuptools_kwargs = {
46+
'install_requires': [
47+
'python-dateutil >= 2' if sys.version_info[0] >= 3 else 'python-dateutil',
48+
'pytz >= 2011k',
49+
'numpy >= %s' % min_numpy_ver,
50+
],
51+
'setup_requires': ['numpy >= %s' % min_numpy_ver],
52+
'zip_safe': False,
53+
}
5354

54-
setuptools_kwargs = {'zip_safe': False,
55-
'install_requires': ['python-dateutil >= 2',
56-
'pytz >= 2011k',
57-
'numpy >= %s' % min_numpy_ver],
58-
'setup_requires': ['numpy >= %s' % min_numpy_ver]}
59-
if not _have_setuptools:
60-
sys.exit("need setuptools/distribute for Py3k"
61-
"\n$ pip install distribute")
62-
63-
else:
64-
setuptools_kwargs = {
65-
'install_requires': ['python-dateutil',
66-
'pytz >= 2011k',
67-
'numpy >= %s' % min_numpy_ver],
68-
'setup_requires': ['numpy >= %s' % min_numpy_ver],
69-
'zip_safe': False,
70-
}
71-
72-
if not _have_setuptools:
73-
try:
74-
import numpy # noqa:F401
75-
import dateutil # noqa:F401
76-
setuptools_kwargs = {}
77-
except ImportError:
78-
sys.exit("install requires: 'python-dateutil < 2','numpy'."
79-
" use pip or easy_install."
80-
"\n $ pip install 'python-dateutil < 2' 'numpy'")
8155

8256
from distutils.extension import Extension # noqa:E402
8357
from distutils.command.build import build # noqa:E402
@@ -695,7 +669,7 @@ def pxd(name):
695669
# ----------------------------------------------------------------------
696670
# ujson
697671

698-
if suffix == '.pyx' and 'setuptools' in sys.modules:
672+
if suffix == '.pyx':
699673
# undo dumb setuptools bug clobbering .pyx sources back to .c
700674
for ext in extensions:
701675
if ext.sources[0].endswith(('.c', '.cpp')):
@@ -729,10 +703,6 @@ def pxd(name):
729703
sources=['pandas/util/move.c'])
730704
extensions.append(_move_ext)
731705

732-
733-
if _have_setuptools:
734-
setuptools_kwargs["test_suite"] = "nose.collector"
735-
736706
# The build cache system does string matching below this point.
737707
# if you change something, be careful.
738708

0 commit comments

Comments
 (0)