|
1 | | -importast |
2 | | -importos |
3 | 1 | importcodecs |
4 | | - |
5 | | -fromsetuptoolsimportsetup |
| 2 | +fromos.pathimportjoin,dirname |
| 3 | +fromsetuptoolsimportsetup,find_packages |
6 | 4 |
|
7 | 5 |
|
8 | 6 | classifiers=[ |
|
23 | 21 | 'Topic :: Text Processing :: Markup :: HTML' |
24 | 22 | ] |
25 | 23 |
|
26 | | -packages= ['html5lib']+ ['html5lib.'+name |
27 | | -fornameinos.listdir(os.path.join('html5lib')) |
28 | | -ifos.path.isdir(os.path.join('html5lib',name))and |
29 | | -notname.startswith('.')andname!='tests'] |
30 | | - |
31 | | -current_dir=os.path.dirname(__file__) |
32 | | -withcodecs.open(os.path.join(current_dir,'README.rst'),'r','utf8')asreadme_file: |
33 | | -withcodecs.open(os.path.join(current_dir,'CHANGES.rst'),'r','utf8')aschanges_file: |
| 24 | +here=dirname(__file__) |
| 25 | +withcodecs.open(join(here,'README.rst'),'r','utf8')asreadme_file: |
| 26 | +withcodecs.open(join(here,'CHANGES.rst'),'r','utf8')aschanges_file: |
34 | 27 | long_description=readme_file.read()+'\n'+changes_file.read() |
35 | 28 |
|
36 | 29 | version=None |
37 | | -withopen(os.path.join("html5lib","__init__.py"),"rb")asinit_file: |
38 | | -t=ast.parse(init_file.read(),filename="__init__.py",mode="exec") |
39 | | -assertisinstance(t,ast.Module) |
40 | | -assignments=filter(lambdax:isinstance(x,ast.Assign),t.body) |
41 | | -forainassignments: |
42 | | -if (len(a.targets)==1and |
43 | | -isinstance(a.targets[0],ast.Name)and |
44 | | -a.targets[0].id=="__version__"and |
45 | | -isinstance(a.value,ast.Str)): |
46 | | -version=a.value.s |
| 30 | +withopen(join(here,'html5lib','__init__.py'))asfp: |
| 31 | +forlineinfp: |
| 32 | +_locals= {} |
| 33 | +ifline.startswith('__version__'): |
| 34 | +exec(line,None,_locals) |
| 35 | +version=_locals['__version__'] |
| 36 | +break |
47 | 37 |
|
48 | 38 | setup(name='html5lib', |
49 | 39 | version=version, |
|
54 | 44 | classifiers=classifiers, |
55 | 45 | maintainer='James Graham', |
56 | 46 | maintainer_email='james@hoppipolla.co.uk', |
57 | | -packages=packages, |
| 47 | +packages=find_packages(exclude=["*.tests","*.tests.*","tests.*","tests"]), |
58 | 48 | install_requires=[ |
59 | 49 | 'six', |
60 | 50 | ], |
|
70 | 60 |
|
71 | 61 | # Standard extras, will be installed when the extra is requested. |
72 | 62 | "genshi": ["genshi"], |
73 | | -"charade": ["charade"], |
| 63 | +"chardet": ["chardet>=2.2"], |
74 | 64 |
|
75 | 65 | # The all extra combines a standard extra which will be used anytime |
76 | 66 | # the all extra is requested, and it extends it with a conditional |
77 | 67 | # extra that will be installed whenever the condition matches and the |
78 | 68 | # all extra is requested. |
79 | | -"all": ["genshi","charade"], |
| 69 | +"all": ["genshi","chardet>=2.2"], |
80 | 70 | "all:python_implementation == 'CPython'": ["datrie","lxml"], |
81 | 71 | }, |
82 | 72 | ) |