Skip to content

Commit 205aced

Browse files
author
James Graham
committed
rearrage directory structure
1 parent ac090d1 commit 205aced

File tree

8 files changed

+39
-215
lines changed

8 files changed

+39
-215
lines changed

html5-tests.patch

Lines changed: 0 additions & 145 deletions
This file was deleted.

html5lib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
f = open("my_document.html")
1111
tree = html5lib.parse(f)
1212
"""
13-
__version__ = "%(version)s"
13+
__version__ = "0.95-dev"
1414
from html5parser import HTMLParser, parse, parseFragment
1515
from treebuilders import getTreeBuilder
1616
from treewalkers import getTreeWalker

html5lib/tests/__init__.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,12 @@
1+
import sys
2+
import os
3+
4+
parent_path = os.path.abspath(os.path.join(os.path.split(__file__)[0], ".."))
5+
6+
if not parent_path in sys.path:
7+
sys.path.insert(0, parent_path)
8+
del parent_path
9+
110
from runtests import buildTestSuite
11+
12+
import support

html5lib/tests/runtests.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@
33
import glob
44
import unittest
55

6-
#Allow us to import the parent module
7-
os.chdir(os.path.split(os.path.abspath(__file__))[0])
8-
sys.path.insert(0, os.path.abspath(os.curdir))
9-
sys.path.insert(0, os.path.abspath(os.pardir))
10-
sys.path.insert(0, os.path.join(os.path.abspath(os.pardir), "src"))
11-
126
def buildTestSuite():
137
suite = unittest.TestSuite()
148
for testcase in glob.glob('test_*.py'):

html5lib/tests/support.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,23 @@
22
import sys
33
import glob
44

5-
#Allow us to import the parent module
6-
os.chdir(os.path.split(os.path.abspath(__file__))[0])
7-
sys.path.insert(0, os.path.abspath(os.path.join(os.pardir, "src")))
8-
95
import html5lib
106
from html5lib import html5parser, treebuilders
117

12-
#Define the location of the tests as this changes in release versions
13-
#RELEASE remove
14-
test_dir = os.path.join(os.path.pardir,os.path.pardir,'testdata')
15-
#END RELEASE
16-
#RELEASE add
17-
#test_dir = './testdata'
18-
#END RELEASE
8+
base_path = os.path.split(__file__)[0]
9+
if os.path.exists(os.path.join(base_path, 'testdata')):
10+
#release
11+
test_dir = os.path.join(base_path, 'testdata')
12+
else:
13+
#development
14+
test_dir = os.path.abspath(
15+
os.path.join(base_path,
16+
os.path.pardir, os.path.pardir,
17+
os.path.pardir, 'testdata'))
18+
assert os.path.exists(test_dir), "Test data not found"
19+
20+
del base_path
21+
1922
import simplejson
2023

2124
#Build a dict of avaliable trees

html5lib/treebuilders/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232

3333
treeBuilderCache = {}
3434

35+
import sys
36+
3537
def getTreeBuilder(treeType, implementation=None, **kwargs):
3638
"""Get a TreeBuilder class for various types of tree with built-in support
3739

setup.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
1-
try:
2-
from setuptools import setup
3-
except ImportError:
4-
from distutils.core import setup
1+
from setuptools import setup
52
import os
63

7-
long_description="""HTML parser designed to follow the HTML5
4+
long_description="""HTML parser designed to follow the WHATWG HTML5
85
specification. The parser is designed to handle all flavours of HTML and
96
parses invalid documents using well-defined error handling rules compatible
107
with the behaviour of major desktop web browsers.
118
129
Output is to a tree structure; the current release supports output to
13-
DOM, ElementTree and lxml tree formats as well as a
10+
DOM, ElementTree, lxml and BeautifulSoup tree formats as well as a
1411
simple custom format"""
1512

1613
classifiers=[
17-
'Development Status :: %(status)s',
14+
'Development Status :: 5 - Production/Stable',
1815
'Intended Audience :: Developers',
1916
'License :: OSI Approved :: MIT License',
2017
'Operating System :: OS Independent',
@@ -24,17 +21,19 @@
2421
]
2522

2623
setup(name='html5lib',
27-
version='%(version)s',
24+
version='0.95-dev',
2825
url='http://code.google.com/p/html5lib/',
2926
license="MIT License",
30-
description='HTML parser based on the HTML5 specifcation',
27+
description='HTML parser based on the WHAT-WG Web Applications 1.0'
28+
'("HTML5") specifcation',
3129
long_description=long_description,
3230
classifiers=classifiers,
3331
maintainer='James Graham',
3432
maintainer_email='james@hoppipolla.co.uk',
3533
packages=['html5lib'] + ['html5lib.'+name
36-
for name in os.listdir(os.path.join('src','html5lib'))
37-
if os.path.isdir(os.path.join('src','html5lib',name)) and
34+
for name in os.listdir(os.path.join('html5lib'))
35+
if os.path.isdir(os.path.join('html5lib',name)) and
3836
not name.startswith('.')],
39-
package_dir = {'html5lib': os.path.join('src', 'html5lib')},
37+
test_suite = "html5lib.tests.buildTestSuite",
38+
tests_require = ['simplejson']
4039
)

setup_base.py

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)