comparison tests/maketestwiki.py @ 315:830cf8bdcf24

implemented 'make pagepacks', updated underlay imported from: moin--main--1.5--patch-319
author Thomas Waldmann <tw@waldmann-edv.de>
date Tue, 13 Dec 2005 22:54:31 +0000
parents
children f308f9478d51
comparison
equal deleted inserted replaced
314:43c6bc5dc22c 315:830cf8bdcf24
1 # -*- coding: iso-8859-1 -*-
2 """
3 MoinMoin - make a test wiki
4
5 Usage:
6
7 maketestwiki.py
8
9 @copyright: 2005 by Thomas Waldmann
10 @license: GNU GPL, see COPYING for details.
11 """
12
13 import os, sys, shutil, errno, tarfile
14
15 moinpath = os.path.join(os.path.dirname(sys.argv[0]), os.pardir)
16 sys.path.insert(0, os.path.abspath(moinpath))
17
18 WIKI = os.path.abspath('testwiki')
19 SHARE = os.path.abspath('wiki')
20
21 def removeTestWiki():
22 print 'removing old wiki ...'
23 for dir in ['data', 'underlay']:
24 try:
25 shutil.rmtree(os.path.join(WIKI, dir))
26 except OSError, err:
27 if err.errno != errno.ENOENT:
28 raise
29
30 def copyData():
31 print 'copying data ...'
32 src = os.path.join(SHARE, 'data')
33 dst = os.path.join(WIKI, 'data')
34 shutil.copytree(src, dst)
35 # Remove arch-ids dirs
36 for path, dirs, files in os.walk(dst):
37 for dir in dirs[:]:
38 if dir == '.arch-ids':
39 shutil.rmtree(os.path.join(path, dir))
40 dirs.remove(dir)
41
42
43 def untarUnderlay():
44 print 'untaring underlay ...'
45 tar = tarfile.open(os.path.join(SHARE, 'underlay.tar.bz2'), mode='r:bz2')
46 for member in tar:
47 tar.extract(member, WIKI)
48 tar.close()
49
50
51 def run():
52 removeTestWiki()
53 copyData()
54 untarUnderlay()
55
56 if __name__ == '__main__':
57 run()
58