diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/maketestwiki.py	Tue Dec 13 22:54:31 2005 +0000
@@ -0,0 +1,58 @@
+# -*- coding: iso-8859-1 -*-
+"""
+MoinMoin - make a test wiki
+
+Usage:
+
+    maketestwiki.py
+
+@copyright: 2005 by Thomas Waldmann
+@license: GNU GPL, see COPYING for details.
+"""
+
+import os, sys, shutil, errno, tarfile
+
+moinpath = os.path.join(os.path.dirname(sys.argv[0]), os.pardir)
+sys.path.insert(0, os.path.abspath(moinpath))
+
+WIKI = os.path.abspath('testwiki')
+SHARE = os.path.abspath('wiki')
+
+def removeTestWiki():
+    print 'removing old wiki ...'
+    for dir in ['data', 'underlay']:
+        try:
+            shutil.rmtree(os.path.join(WIKI, dir))
+        except OSError, err:
+            if err.errno != errno.ENOENT:
+                raise
+
+def copyData():
+    print 'copying data ...'
+    src = os.path.join(SHARE, 'data')
+    dst = os.path.join(WIKI, 'data')
+    shutil.copytree(src, dst)
+    # Remove arch-ids dirs
+    for path, dirs, files in os.walk(dst):
+        for dir in dirs[:]:
+            if dir == '.arch-ids':
+                shutil.rmtree(os.path.join(path, dir))
+                dirs.remove(dir)
+
+
+def untarUnderlay():
+    print 'untaring underlay ...'
+    tar = tarfile.open(os.path.join(SHARE, 'underlay.tar.bz2'), mode='r:bz2')
+    for member in tar:
+        tar.extract(member, WIKI)
+    tar.close()
+
+
+def run():   
+    removeTestWiki()
+    copyData()
+    untarUnderlay()
+
+if __name__ == '__main__':
+    run()
+