From 783707644bfa0d92d924faea745e34f3c0555219 Mon Sep 17 00:00:00 2001 From: Cosimo Lupo Date: Thu, 18 Oct 2018 12:03:34 +0100 Subject: [PATCH] setup.py: add optional dependencies to extras_require --- setup.py | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/setup.py b/setup.py index cc8824d36..a8d7edf65 100755 --- a/setup.py +++ b/setup.py @@ -30,6 +30,56 @@ wheel = ['wheel'] if needs_wheel else [] needs_bumpversion = {'release'}.intersection(sys.argv) bumpversion = ['bump2version'] if needs_bumpversion else [] +extras_require = { + # for fontTools.ufoLib: to read/write UFO fonts + "ufo": [ + "fs >= 2.1.1, < 3", + "enum34 >= 1.1.6; python_version < '3.4'", + ], + # for fontTools.misc.etree and fontTools.misc.plistlib: use lxml to + # read/write XML files (faster/safer than built-in ElementTree) + "lxml": [ + "lxml >= 4.0, < 5", + "singledispatch >= 3.4.0.3; python_version < '3.4'", + ], + # for fontTools.sfnt and fontTools.woff2: to compress/uncompress + # WOFF 1.0 and WOFF 2.0 webfonts. + "woff": [ + "brotli >= 1.0.1; platform_python_implementation != 'PyPy'", + "brotlipy >= 0.7.0; platform_python_implementation == 'PyPy'", + "zopfli >= 0.1.4", + ], + # for fontTools.unicode and fontTools.unicodedata: to use the latest version + # of the Unicode Character Database instead of the built-in unicodedata + # which varies between python versions and may be outdated. + "unicode": [ + # the unicodedata2 extension module doesn't work on PyPy. + # Python 3.7 already has Unicode 11, so the backport is not needed. + ( + "unicodedata2 >= 11.0.0; " + "python_version < '3.7' and platform_python_implementation != 'PyPy'" + ), + ], + # for fontTools.interpolatable: to solve the "minimum weight perfect + # matching problem in bipartite graphs" (aka Assignment problem) + "interpolatable": [ + # use pure-python alternative on pypy + "scipy; platform_python_implementation != 'PyPy'", + "munkres; platform_python_implementation == 'PyPy'", + ], + # for fontTools.misc.symfont, module for symbolic font statistics analysis + "symfont": [ + "sympy", + ], + # To get file creator and type of Macintosh PostScript Type 1 fonts (macOS only) + "type1": [ + "xattr; sys_platform == 'darwin'", + ], +} +# use a special 'all' key as shorthand to includes all the extra dependencies +extras_require["all"] = sum(extras_require.values(), []) + + # Trove classifiers for PyPI classifiers = {"classifiers": [ "Development Status :: 5 - Production/Stable", @@ -307,6 +357,7 @@ setup( tests_require=[ 'pytest>=3.0', ], + extras_require=extras_require, entry_points={ 'console_scripts': [ "fonttools = fontTools.__main__:main",