|
| 1 | +from __future__ import print_function |
| 2 | + |
1 | 3 | import ast
|
2 | 4 | import codecs
|
| 5 | +import sys |
3 | 6 |
|
4 | 7 | from os.path import join, dirname
|
5 |
| -from setuptools import setup, find_packages |
| 8 | +from setuptools import setup, find_packages, __version__ as setuptools_version |
| 9 | +from pkg_resources import parse_version |
6 | 10 |
|
| 11 | +if parse_version(setuptools_version) < parse_version("18.5"): |
| 12 | + print("html5lib requires setuptools version 18.5 or above; " |
| 13 | + "please upgrade before installing (you have %s)" % setuptools_version) |
| 14 | + sys.exit(1) |
7 | 15 |
|
8 | 16 | classifiers = [
|
9 | 17 | 'Development Status :: 5 - Production/Stable',
|
|
28 | 36 | long_description = readme_file.read() + '\n' + changes_file.read()
|
29 | 37 |
|
30 | 38 | version = None
|
31 |
| -with open(join("html5lib", "__init__.py"), "rb") as init_file: |
| 39 | +with open(join(here, "html5lib", "__init__.py"), "rb") as init_file: |
32 | 40 | t = ast.parse(init_file.read(), filename="__init__.py", mode="exec")
|
33 | 41 | assert isinstance(t, ast.Module)
|
34 | 42 | assignments = filter(lambda x: isinstance(x, ast.Assign), t.body)
|
|
52 | 60 | install_requires=[
|
53 | 61 | 'six',
|
54 | 62 | 'webencodings',
|
| 63 | + 'setuptools>=18.5' |
55 | 64 | ],
|
56 | 65 | extras_require={
|
57 | 66 | # A empty extra that only has a conditional marker will be
|
|
60 | 69 |
|
61 | 70 | # A conditional extra will only install these items when the extra is
|
62 | 71 | # requested and the condition matches.
|
63 |
| - "datrie:platform.python_implementation == 'CPython'": ["datrie"], |
64 |
| - "lxml:platform.python_implementation == 'CPython'": ["lxml"], |
| 72 | + "datrie:platform_python_implementation == 'CPython'": ["datrie"], |
| 73 | + "lxml:platform_python_implementation == 'CPython'": ["lxml"], |
65 | 74 |
|
66 | 75 | # Standard extras, will be installed when the extra is requested.
|
67 | 76 | "genshi": ["genshi"],
|
|
72 | 81 | # extra that will be installed whenever the condition matches and the
|
73 | 82 | # all extra is requested.
|
74 | 83 | "all": ["genshi", "chardet>=2.2"],
|
75 |
| - "all:platform.python_implementation == 'CPython'": ["datrie", "lxml"], |
| 84 | + "all:platform_python_implementation == 'CPython'": ["datrie", "lxml"], |
76 | 85 | },
|
77 | 86 | )
|
0 commit comments