99
1010exclude = [".svn" ,"*.pyc" ,"*~" ,"*.orig" ,"*.patch" ,"__basedir__/utils" ,
1111"__basedir__/setup_base.py" ,"*.prof" ,"#*" ,"__basedir__/build" ,
12- '__basedir__/tests/performance' ,'*.out' ,
13- '__basedir__/tests/testdata/*.html' ,
14- '__basedir__/tests/testdata/sites' ,'__basedir__/print-stats.py' ]
12+ '__basedir__/tests' ,'*.out' ,'__basedir__/dist' ,
13+ '__basedir__/html5lib.egg-info' ,'__basedir__/print-stats.py' ]
1514
1615class Package (object ):
1716
@@ -23,20 +22,19 @@ def __init__(self, inDir, outDir, version="0", status=4, installDir="~"):
2322self .inDir = os .path .abspath (inDir )
2423self .outDir = os .path .abspath (outDir )
2524self .exclude = self .getExcludeList ()
26- print self .exclude
2725self .fileList = self .getFileList ()
2826self .installDir = installDir
2927self .outFiles = []
3028
3129def runall (self ):
3230self .copyTestData ()
33- self .getFileList ()
3431self .copy ()
32+ self .makeInitFile ()
3533self .makeSetupFile ()
3634self .preprocess ()
3735#if self.test():
3836self .makeZipFile ()
39- # self.cleanup()
37+ self .cleanup ()
4038
4139
4240def getExcludeList (self ):
@@ -55,7 +53,7 @@ def copyTestData(self):
5553if not os .path .exists (outDir ):
5654raise
5755
58- inBaseDir = os .path .abspath (os .path .join (self .inDir ,"../ testdata" ))
56+ inBaseDir = os .path .abspath (os .path .join (self .inDir ,".." , " testdata" ))
5957dirWalker = os .walk (inBaseDir )
6058for (curDir ,dirs ,files )in dirWalker :
6159outDir = os .path .join (self .inDir ,"tests" ,"testdata" ,curDir [len (inBaseDir )+ 1 :])
@@ -111,12 +109,20 @@ def makeSetupFile(self):
111109"5" :"5 - Production/Stable" ,
112110"6" :"6 - Mature" ,
113111"7" :"7 - Inactive" }
114- inFile = open (os .path .join (self .inDir ,"setup_base.py" ))
115- outFile = open (os .path .join (self .outDir ,"setup.py" ),"w" )
112+ inFile = open (os .path .join (self .outDir ,"setup.py" ))
116113text = "" .join (inFile .readlines ())
114+ inFile .close ()
115+ outFile = open (os .path .join (self .outDir ,"setup.py" ),"w" )
117116outFile .write (text % {"status" :statusStrings [self .status ],
118117"version" :self .version })
119-
118+
119+ def makeInitFile (self ):
120+ inFile = open (os .path .join (self .outDir ,"src" ,"html5lib" ,"__init__.py" ))
121+ text = "" .join (inFile .readlines ())
122+ outFile = open (os .path .join (self .outDir ,"src" ,"html5lib" ,"__init__.py" ),
123+ "w" )
124+ outFile .write (text % {"version" :self .version })
125+
120126def copy (self ):
121127if not os .path .exists (self .outDir ):
122128os .mkdir (self .outDir )