Skip to content

Commit

Permalink
use conditional requirements to ensure "chardet" listed as requiremen…
Browse files Browse the repository at this point in the history
…t 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.
  • Loading branch information
FelixSchwarz committed Jan 18, 2019
1 parent b6a5848 commit 5ff84b8
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@

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',
Expand Down

0 comments on commit 5ff84b8

Please sign in to comment.