From d5b0dc26ca5f3f89db0a7256894d322cd3180df7 Mon Sep 17 00:00:00 2001 From: Geoffrey Sneddon Date: Mon, 6 Jun 2016 17:16:28 +0100 Subject: [PATCH 1/3] Make sure setup.py works regardless of cwd --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 4d5f1523..0d867279 100644 --- a/setup.py +++ b/setup.py @@ -28,7 +28,7 @@ long_description = readme_file.read() + '\n' + changes_file.read() version = None -with open(join("html5lib", "__init__.py"), "rb") as init_file: +with open(join(here, "html5lib", "__init__.py"), "rb") as init_file: t = ast.parse(init_file.read(), filename="__init__.py", mode="exec") assert isinstance(t, ast.Module) assignments = filter(lambda x: isinstance(x, ast.Assign), t.body) From 21aabd6413c7429b1111265714b3de9c155bda24 Mon Sep 17 00:00:00 2001 From: Geoffrey Sneddon Date: Mon, 6 Jun 2016 18:15:32 +0100 Subject: [PATCH 2/3] Try fixing #231 again: Return to using platform_python_implementation This makes us require setuptools>=18.5 --- requirements-install.sh | 2 +- requirements.txt | 1 + setup.py | 7 ++++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/requirements-install.sh b/requirements-install.sh index 8cab142d..9b28888a 100755 --- a/requirements-install.sh +++ b/requirements-install.sh @@ -6,7 +6,7 @@ if [[ $USE_OPTIONAL != "true" && $USE_OPTIONAL != "false" ]]; then fi # Make sure we're running setuptools >= 18.5 -pip install -U pip setuptools +pip install -U pip setuptools>=18.5 pip install -U -r requirements-test.txt diff --git a/requirements.txt b/requirements.txt index 745993b9..92c09036 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ six webencodings ordereddict ; python_version < '2.7' +setuptools>=18.5 diff --git a/setup.py b/setup.py index 0d867279..7cc30534 100644 --- a/setup.py +++ b/setup.py @@ -52,6 +52,7 @@ install_requires=[ 'six', 'webencodings', + 'setuptools>=18.5' ], extras_require={ # A empty extra that only has a conditional marker will be @@ -60,8 +61,8 @@ # A conditional extra will only install these items when the extra is # requested and the condition matches. - "datrie:platform.python_implementation == 'CPython'": ["datrie"], - "lxml:platform.python_implementation == 'CPython'": ["lxml"], + "datrie:platform_python_implementation == 'CPython'": ["datrie"], + "lxml:platform_python_implementation == 'CPython'": ["lxml"], # Standard extras, will be installed when the extra is requested. "genshi": ["genshi"], @@ -72,6 +73,6 @@ # extra that will be installed whenever the condition matches and the # all extra is requested. "all": ["genshi", "chardet>=2.2"], - "all:platform.python_implementation == 'CPython'": ["datrie", "lxml"], + "all:platform_python_implementation == 'CPython'": ["datrie", "lxml"], }, ) From c562f28b03df132c6311a7c930635dd0e12abc5b Mon Sep 17 00:00:00 2001 From: Geoffrey Sneddon Date: Mon, 6 Jun 2016 18:21:52 +0100 Subject: [PATCH 3/3] Give a more useful error message than a SyntaxError on old setuptools --- setup.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 7cc30534..7c419e2c 100644 --- a/setup.py +++ b/setup.py @@ -1,9 +1,17 @@ +from __future__ import print_function + import ast import codecs +import sys from os.path import join, dirname -from setuptools import setup, find_packages +from setuptools import setup, find_packages, __version__ as setuptools_version +from pkg_resources import parse_version +if parse_version(setuptools_version) < parse_version("18.5"): + print("html5lib requires setuptools version 18.5 or above; " + "please upgrade before installing (you have %s)" % setuptools_version) + sys.exit(1) classifiers = [ 'Development Status :: 5 - Production/Stable',