9
9
10
10
exclude = [".svn" ,"*.pyc" ,"*~" ,"*.orig" ,"*.patch" ,"__basedir__/utils" ,
11
11
"__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' ]
15
14
16
15
class Package (object ):
17
16
@@ -23,20 +22,19 @@ def __init__(self, inDir, outDir, version="0", status=4, installDir="~"):
23
22
self .inDir = os .path .abspath (inDir )
24
23
self .outDir = os .path .abspath (outDir )
25
24
self .exclude = self .getExcludeList ()
26
- print self .exclude
27
25
self .fileList = self .getFileList ()
28
26
self .installDir = installDir
29
27
self .outFiles = []
30
28
31
29
def runall (self ):
32
30
self .copyTestData ()
33
- self .getFileList ()
34
31
self .copy ()
32
+ self .makeInitFile ()
35
33
self .makeSetupFile ()
36
34
self .preprocess ()
37
35
#if self.test():
38
36
self .makeZipFile ()
39
- # self.cleanup()
37
+ self .cleanup ()
40
38
41
39
42
40
def getExcludeList (self ):
@@ -55,7 +53,7 @@ def copyTestData(self):
55
53
if not os .path .exists (outDir ):
56
54
raise
57
55
58
- inBaseDir = os .path .abspath (os .path .join (self .inDir ,"../ testdata" ))
56
+ inBaseDir = os .path .abspath (os .path .join (self .inDir ,".." , " testdata" ))
59
57
dirWalker = os .walk (inBaseDir )
60
58
for (curDir ,dirs ,files )in dirWalker :
61
59
outDir = os .path .join (self .inDir ,"tests" ,"testdata" ,curDir [len (inBaseDir )+ 1 :])
@@ -111,12 +109,20 @@ def makeSetupFile(self):
111
109
"5" :"5 - Production/Stable" ,
112
110
"6" :"6 - Mature" ,
113
111
"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" ))
116
113
text = "" .join (inFile .readlines ())
114
+ inFile .close ()
115
+ outFile = open (os .path .join (self .outDir ,"setup.py" ),"w" )
117
116
outFile .write (text % {"status" :statusStrings [self .status ],
118
117
"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
+
120
126
def copy (self ):
121
127
if not os .path .exists (self .outDir ):
122
128
os .mkdir (self .outDir )