]> code.delx.au - pymsnt/blobdiff - src/housekeep.py
Recursively ignore *.pyc
[pymsnt] / src / housekeep.py
index 608c01e836bbb1d3230977ff612be8a831f89043..057bb348853474d2e6cd7d4c7e1b0774d0a51e31 100644 (file)
@@ -1,7 +1,7 @@
 # Copyright 2005 James Bunton <james@delx.cjb.net>
 # Licensed for distribution under the GPL version 2, check COPYING for details
 
-from tlib import xmlw
+from twisted.words.protocols.jabber.jid import internJID
 
 import utils
 import config
@@ -72,7 +72,7 @@ def doSpoolPrepCheck():
                        if not os.path.isfile(file):
                                continue
                        file = xdb.unmangle(file).decode("utf-8")
-                       filej = xmlw.jid.intern(file).full()
+                       filej = internJID(file).full()
                        if(file != filej):
                                file = xdb.mangle(file)
                                filej = xdb.mangle(filej)
@@ -133,8 +133,8 @@ def doMD5HashDirUpgrade():
        if os.path.exists(pre + "avatars"):
                # Remove the avatars dir that gets created when we import
                # legacy/glue.py (it only contains the defaultAvatar)
-               shutil.rmtree(config.spooldir + X + "avatars")
-               shutil.move(pre + "avatars", config.spooldir + X + "avatars")
+               shutil.rmtree(os.path.join(config.spooldir, "avatars"))
+               shutil.move(pre + "avatars", os.path.join(config.spooldir, "avatars"))
        else:
                print "Could not move your cached avatars directory automatically. It is safe to delete it, the avatars will be recreated as necessary."
 
@@ -155,7 +155,7 @@ def doMD5HashDirUpgrade():
                                if not os.path.exists(pre + hash):
                                        os.makedirs(pre + hash)
                                shutil.move(pre2 + file, pre + hash + X + file)
-                       os.rmdir(dir)
+                       os.rmdir(pre2)
        except Exception, e:
                print "Error in migration", pre, dir, hash, file, str(e)
                sys.exit(1)