Skip to content

Commit a9e4731

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

File tree

2 files changed

+15
-42
lines changed

2 files changed

+15
-42
lines changed

doc/source/whatsnew/v0.22.0.txt

+1
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ Other API Changes
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`)
117117
- When created with duplicate labels, ``MultiIndex`` now raises a ``ValueError``. (:issue:`17464`)
118+
- Building from source now explicity requires ``setuptools`` in ``setup.py`` (:issue:`18113`)
118119

119120
.. _whatsnew_0220.deprecations:
120121

setup.py

+14-42
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,18 @@
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
1820
cmdclass = versioneer.get_cmdclass()
1921

22+
PY3 = sys.version_info[0] >= 3
23+
2024

2125
def is_platform_windows():
2226
return sys.platform == 'win32' or sys.platform == 'cygwin'
@@ -38,46 +42,18 @@ def is_platform_mac():
3842
except ImportError:
3943
_CYTHON_INSTALLED = False
4044

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
4945

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

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'")
8157

8258
from distutils.extension import Extension # noqa:E402
8359
from distutils.command.build import build # noqa:E402
@@ -695,7 +671,7 @@ def pxd(name):
695671
# ----------------------------------------------------------------------
696672
# ujson
697673

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

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

0 commit comments

Comments
 (0)