From 5ff84b83fbf60598406e9af616bdc8a565e38fde Mon Sep 17 00:00:00 2001 From: Felix Schwarz Date: Fri, 18 Jan 2019 11:24:51 +0100 Subject: [PATCH] use conditional requirements to ensure "chardet" listed as requirement on Python 3 (fixes #213) Previously "chardet" was added only added when setup.py was run with Python 3. However wheels contain a static list of requirements and a wheel-based install will never execute setup.py at installation time. pdfminer.six uses universal wheels for Python 2 and Python 3 so the requirements will always be wrong on one version (see #213). The solution is to use conditional requirements as specified in PEP 496 which are evaluated at installation time. --- setup.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/setup.py b/setup.py index dd9db18..404c308 100644 --- a/setup.py +++ b/setup.py @@ -3,9 +3,7 @@ import sys import pdfminer as package -requires = ['six', 'pycryptodome', 'sortedcontainers'] -if sys.version_info >= (3, 0): - requires.append('chardet') +requires = ['six', 'pycryptodome', 'sortedcontainers', 'chardet ; python_version > "3.0"'] setup( name='pdfminer.six',