[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[minion-cvs] Start making stuff work on win32 -- much more work need...



Update of /home/minion/cvsroot/src/minion/lib/mixminion/directory
In directory moria.mit.edu:/tmp/cvs-serv16360/lib/mixminion/directory

Modified Files:
	ServerList.py 
Log Message:
Start making stuff work on win32 -- much more work needed, but at least it builds and passes all but 5 tests

Index: ServerList.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/directory/ServerList.py,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- ServerList.py	12 Jun 2003 04:08:17 -0000	1.33
+++ ServerList.py	10 Jul 2003 20:01:31 -0000	1.34
@@ -220,8 +220,7 @@
             servers = self.serversByNickname[lcnickname]
             for fn in servers:
                 LOG.info("  Removing %s", fn)
-                os.rename(os.path.join(self.serverDir, fn),
-                          os.path.join(self.archiveDir, fn))
+                _moveServer(self.serverDir, self.archiveDir, fn)
                 del self.servers[fn]
             del self.serversByNickname[lcnickname]
             LOG.info("  (%s servers removed)", len(servers))
@@ -384,9 +383,7 @@
             # Now, do the actual removing.
             for fn, why in removed.items():
                 LOG.info("Removing %s descriptor %s", why, fn)
-                os.rename(os.path.join(self.serverDir, fn),
-                          os.path.join(self.archiveDir, fn))
-
+                _moveServer(self.serverDir, self.archiveDir, fn)
                 del self.servers[fn]
 
             self.__buildNicknameMap()
@@ -407,7 +404,7 @@
                     LOG.warn("Somehow, a bad server named %s got in our store",
                              filename)
                     LOG.warn(" (Error was: %s)", str(e))
-                    os.rename(path, os.path.join(self.rejectDir, filename))
+                    _moveServer(self.serverDir, self.rejectDir, filename)
 
             # Next, rebuild self.serverIDs:
             self.serverIDs = {}
@@ -463,6 +460,17 @@
     def _unlock(self):
         self.lockfile.release()
         self.rlock.release()
+
+def _moveServer(directory1, directory2, fname):
+    #DOCDOC
+    fname1 = os.path.join(directory1, fname)
+    if "-" in fname:
+        nn = fname[:fname.find("-")]
+    else:
+        nn = "UNKNOWN"
+    s = readPossiblyGzippedFile(fname1)
+    _writeServer(directory2, s, nn)
+    os.unlink(fname1)
 
 def _writeServer(directory, contents, nickname, mode=0600):
     """Write a server descriptor in 'contents' into a new file in