From 4bc68966458d26feb08985d77ee68f6204c592cc Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 11 May 2018 15:21:41 -0400 Subject: [PATCH] Disallow installation on Python 2. This takes advantage of package metadata to require Python 3.4. If a new enough pip that doesn't understand the metadata is being used, then setup.py also checks for outdated Python. --- README.rst | 1 + flit.ini | 1 + setup.cfg | 6 ------ setup.py | 12 ++++++++++++ 4 files changed, 14 insertions(+), 6 deletions(-) delete mode 100644 setup.cfg diff --git a/README.rst b/README.rst index 05d9d1a..32fa363 100644 --- a/README.rst +++ b/README.rst @@ -141,3 +141,4 @@ Contributors - Konstantin Stadler (issues & use in IOA) - Dhanuka Lakshan - Andreas Fehlner +- Elliott Sales de Andrade diff --git a/flit.ini b/flit.ini index 16921f3..d0929bb 100644 --- a/flit.ini +++ b/flit.ini @@ -4,6 +4,7 @@ author = Rick Lupton author-email = rick.lupton@eng.cam.ac.uk home-page = https://github.com/ricklupton/floweaver classifiers = License :: OSI Approved :: MIT License +requires-python = ">=3.4" requires = numpy pandas networkx (>=1,<2) diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 7f1c3f5..0000000 --- a/setup.cfg +++ /dev/null @@ -1,6 +0,0 @@ -[bdist_wheel] -# This flag says to generate wheels that support both Python 2 and Python -# 3. If your code will not run unchanged on both Python 2 and 3, you will -# need to generate separate wheels for each Python version that you -# support. -universal=1 \ No newline at end of file diff --git a/setup.py b/setup.py index c6444da..44c98f6 100644 --- a/setup.py +++ b/setup.py @@ -2,12 +2,23 @@ import codecs import re from os import path +import sys # Always prefer setuptools over distutils from setuptools import setup, find_packages here = path.abspath(path.dirname(__file__)) +# This check is here if the user does not have a new enough pip to recognize +# the minimum Python requirement in the metadata. +if sys.version_info < (3, 4): + error = """ +floWeaver 2.0.0+ does not support Python 2.x, 3.0, 3.1, 3.2, or 3.3. +Python 3.4 and above is required. This may be due to an out of date pip. +Make sure you have pip >= 9.0.1. +""" + sys.exit(error) + def read(*parts): with codecs.open(path.join(here, *parts), 'r') as fp: @@ -46,6 +57,7 @@ def find_version(*file_paths): ], keywords='Sankey diagram flow data visualisation', packages=find_packages(exclude=['docs', 'tests']), + python_requires='>=3.4', install_requires=[ 'numpy', 'pandas',