Skip to content

remove have_setuptools branching #18349

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

Closed
wants to merge 2 commits into from
Closed
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
68 changes: 20 additions & 48 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,46 +38,23 @@ 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 = {}
from setuptools import setup, Command
import pkg_resources


min_numpy_ver = '1.9.0'
if sys.version_info[0] >= 3:

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")
setuptools_kwargs = {'zip_safe': False,
'setup_requires': ['numpy >= %s' % min_numpy_ver],
'install_requires': ['pytz >= 2011k',
'numpy >= %s' % min_numpy_ver]}

if sys.version_info[0] >= 3:
setuptools_kwargs['install_requires'].append('python-dateutil >= 2')
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'")
setuptools_kwargs['install_requires'].append('python-dateutil')


from distutils.extension import Extension # noqa:E402
from distutils.command.build import build # noqa:E402
Expand Down Expand Up @@ -151,7 +128,8 @@ def build_extensions(self):
with open(outfile, "w") as f:
f.write(pyxcontent)

numpy_incl = pkg_resources.resource_filename('numpy', 'core/include')
assert len(numpy_incls) == 1
numpy_incl = numpy_incls[0]

for ext in self.extensions:
if (hasattr(ext, 'include_dirs') and
Expand Down Expand Up @@ -363,8 +341,8 @@ def run(self):
else:
for pyxfile in self._pyxfiles:
cfile = pyxfile[:-3] + 'c'
msg = "C-source file '%s' not found." % (cfile) +\
" Run 'setup.py cython' before sdist."
msg = ("C-source file '{cfile}' not found. Run "
"'setup.py cython' before sdist.".format(cfile=cfile))
Copy link
Member

Choose a reason for hiding this comment

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

👍 - nice

assert os.path.isfile(cfile), msg
sdist_class.run(self)

Expand Down Expand Up @@ -452,7 +430,6 @@ def srcpath(name=None, suffix='.pyx', subdir='src'):
lib_depends.append('pandas/_libs/src/util.pxd')
else:
lib_depends = []
plib_depends = []

common_include = ['pandas/_libs/src/klib', 'pandas/_libs/src']

Expand All @@ -461,12 +438,10 @@ def pxd(name):
return os.path.abspath(pjoin('pandas', name + '.pxd'))


if _have_setuptools:
# Note: this is a list, whereas `numpy_incl` in build_ext.build_extensions
# is a string
numpy_incls = [pkg_resources.resource_filename('numpy', 'core/include')]
else:
numpy_incls = []
# Note: this is a list, whereas `numpy_incl` in build_ext.build_extensions
# is a string
numpy_incls = [pkg_resources.resource_filename('numpy', 'core/include')]


# args to ignore warnings
if is_platform_windows():
Expand Down Expand Up @@ -720,9 +695,6 @@ def pxd(name):
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