From f38b0ed79737665fd4aad1de74c08fb806ecfd9b Mon Sep 17 00:00:00 2001 From: Guangyuan Yang Date: Thu, 19 Jul 2018 16:13:41 -0400 Subject: [PATCH] setup.py: Fails the script if nothing installed This fails the installation when readline is not built-in and no custom packages will be installed. Closes https://github.com/pombredanne/anyreadline/issues/1 --- setup.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/setup.py b/setup.py index be5d72a..031a2b5 100644 --- a/setup.py +++ b/setup.py @@ -11,19 +11,21 @@ import os import sys from setuptools import setup - +from distutils import sysconfig long_description = """anyreadline tries to do the right thing and installs either -readline on MacOSX or pyreadline or Windows. -Or does nothing on Linux which comes in general with readline built-in""" +pyreadline for Windows or gnureadline for other platforms if the stdlib version +wasn't built in.""" sysplat = str(sys.platform).lower() +have_readline = sysconfig.get_config_var('HAVE_LIBREADLINE') -install_requires = ['setuptools'] -if 'darwin' in sysplat: - install_requires += ['gnureadline'] -if 'win32' in sysplat: - install_requires += ['pyreadline'] +if not have_readline: + install_requires = ['setuptools'] + if 'win32' in sysplat: + install_requires += ['pyreadline'] + else: + install_requires += ['gnureadline'] setup( name = name,