|
1 | 1 | import ast |
2 | | -import os |
3 | 2 | import codecs |
4 | 3 |
|
5 | | -from setuptools import setup |
| 4 | +from os.path import join, dirname |
| 5 | +from setuptools import setup, find_packages |
6 | 6 |
|
7 | 7 |
|
8 | 8 | classifiers = [ |
|
22 | 22 | 'Topic :: Text Processing :: Markup :: HTML' |
23 | 23 | ] |
24 | 24 |
|
25 | | -packages = ['html5lib'] + ['html5lib.' + name |
26 | | - for name in os.listdir(os.path.join('html5lib')) |
27 | | - if os.path.isdir(os.path.join('html5lib', name)) and |
28 | | - not name.startswith('.') and name != 'tests'] |
29 | | - |
30 | | -current_dir = os.path.dirname(__file__) |
31 | | -with codecs.open(os.path.join(current_dir, 'README.rst'), 'r', 'utf8') as readme_file: |
32 | | - with codecs.open(os.path.join(current_dir, 'CHANGES.rst'), 'r', 'utf8') as changes_file: |
| 25 | +here = dirname(__file__) |
| 26 | +with codecs.open(join(here, 'README.rst'), 'r', 'utf8') as readme_file: |
| 27 | + with codecs.open(join(here, 'CHANGES.rst'), 'r', 'utf8') as changes_file: |
33 | 28 | long_description = readme_file.read() + '\n' + changes_file.read() |
34 | 29 |
|
35 | 30 | version = None |
36 | | -with open(os.path.join("html5lib", "__init__.py"), "rb") as init_file: |
| 31 | +with open(join("html5lib", "__init__.py"), "rb") as init_file: |
37 | 32 | t = ast.parse(init_file.read(), filename="__init__.py", mode="exec") |
38 | 33 | assert isinstance(t, ast.Module) |
39 | 34 | assignments = filter(lambda x: isinstance(x, ast.Assign), t.body) |
|
53 | 48 | classifiers=classifiers, |
54 | 49 | maintainer='James Graham', |
55 | 50 | maintainer_email='james@hoppipolla.co.uk', |
56 | | - packages=packages, |
| 51 | + packages=find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"]), |
57 | 52 | install_requires=[ |
58 | 53 | 'six', |
59 | 54 | 'webencodings', |
|
70 | 65 |
|
71 | 66 | # Standard extras, will be installed when the extra is requested. |
72 | 67 | "genshi": ["genshi"], |
73 | | - "charade": ["charade"], |
| 68 | + "chardet": ["chardet>=2.2"], |
74 | 69 |
|
75 | 70 | # The all extra combines a standard extra which will be used anytime |
76 | 71 | # the all extra is requested, and it extends it with a conditional |
77 | 72 | # extra that will be installed whenever the condition matches and the |
78 | 73 | # all extra is requested. |
79 | | - "all": ["genshi", "charade"], |
| 74 | + "all": ["genshi", "chardet>=2.2"], |
80 | 75 | "all:platform.python_implementation == 'CPython'": ["datrie", "lxml"], |
81 | 76 | }, |
82 | 77 | ) |
0 commit comments