[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tmda-cvs
Subject:    CVS: tmda-cgi ChangeLog,1.37,1.38 Install.py,1.16,1.17
From:       Gre7g Luterman <gre7g () users ! sourceforge ! net>
Date:       2003-05-31 17:02:40
[Download RAW message or body]

Update of /cvsroot/tmda/tmda-cgi
In directory sc8-pr-cvs1:/tmp/cvs-serv19812

Modified Files:
	ChangeLog Install.py 
Log Message:
Changed installer/uninstaller to support multiple type of MAIL_TRANSFER_AGENT
in a single install or uninstall skel directory.


Index: ChangeLog
===================================================================
RCS file: /cvsroot/tmda/tmda-cgi/ChangeLog,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- ChangeLog	30 May 2003 04:36:13 -0000	1.37
+++ ChangeLog	31 May 2003 17:02:37 -0000	1.38
@@ -1,3 +1,8 @@
+2003-05-31  Gre7g Luterman  <gre7g@wolfhome.com>
+
+	* Changed installer/uninstaller to support multiple type of
+	  MAIL_TRANSFER_AGENT in a single install or uninstall skel directory.
+
 2003-05-29  Gre7g Luterman  <gre7g@wolfhome.com>
 
 	* tmda-cgi 0.10 is released.

Index: Install.py
===================================================================
RCS file: /cvsroot/tmda/tmda-cgi/Install.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- Install.py	30 May 2003 04:29:35 -0000	1.16
+++ Install.py	31 May 2003 17:02:38 -0000	1.17
@@ -27,6 +27,7 @@
 import re
 import sys
 import time
+from types import DictType
 
 import CgiUtil
 import Template
@@ -244,12 +245,17 @@
 
 def GetAnomalies(Dir):
   "Find any anomaly instructions."
+  Filename = os.path.join("skel", Dir, "anomalies")
   RetVal = \
   {
     "PERMISSIONS": {}, "VIRTUAL_TEST": "", "REAL_ONLY": [], "VIRTUAL_ONLY": []
   }
   try:
-    execfile(os.path.join("skel", Dir, "anomalies"), RetVal)
+    execfile(Filename, RetVal)
+  except SyntaxError, ErrStr:
+    CgiUtil.TermError("SyntaxError", ErrStr, "read anomalies",
+      CgiUtil.FileDetails("anomalies", Filename),
+      "Contact system administrator.")
   except IOError:
     pass
   return RetVal
@@ -276,6 +282,60 @@
 
   return Defaults
 
+def IgnoreFiles(Anomalies):
+  "Generate a list of files we should ignore during file installation."
+
+  # Peek at the MAIL_TRANSFER_AGENT to help in generating the file list.
+  Mode = os.environ["TMDA_CGI_MODE"]
+  os.environ["TMDA_CGI_MODE"] = "no-su"
+  Mail = ReimportDefaults([], "")["MAIL_TRANSFER_AGENT"]
+  os.environ["TMDA_CGI_MODE"] = Mode
+
+  RetVal = []
+
+  # To generate the ignore list, add everything and then remove the ones we do
+  # want to install.
+
+  # Add everything
+  if type(Anomalies["VIRTUAL_ONLY"]) == DictType:
+    for Mail in Anomalies["VIRTUAL_ONLY"].keys():
+      RetVal += Anomalies["VIRTUAL_ONLY"][Mail]
+  else:
+    RetVal += Anomalies["VIRTUAL_ONLY"]
+  if type(Anomalies["REAL_ONLY"]) == DictType:
+    for Mail in Anomalies["REAL_ONLY"].keys():
+      RetVal += Anomalies["REAL_ONLY"][Mail]
+  else:
+    RetVal += Anomalies["REAL_ONLY"]
+
+  # Remove correct files
+  if re.search(Anomalies["VIRTUAL_TEST"], PVars["HOME"]):
+    Dict["VirtUser"] = 1
+    if type(Anomalies["VIRTUAL_ONLY"]) == DictType:
+      if Anomalies["VIRTUAL_ONLY"].has_key(Mail):
+        ListDiff(RetVal, Anomalies["VIRTUAL_ONLY"][Mail])
+      else:
+        CgiUtil.TermError("Unknown mailtype",
+          "VIRTUAL_ONLY dictionary has no key: %s" % Mail, "locate files",
+          "VIRTUAL_ONLY = %s" % repr(VIRTUAL_ONLY),
+          "Contact system administrator.")
+    else:
+      ListDiff(RetVal, Anomalies["VIRTUAL_ONLY"])
+  else:
+    Dict["VirtUser"] = 0
+    if type(Anomalies["REAL_ONLY"]) == DictType:
+      if Anomalies["REAL_ONLY"].has_key(Mail):
+        ListDiff(RetVal, Anomalies["REAL_ONLY"][Mail])
+      else:
+        CgiUtil.TermError("Unknown mailtype",
+          "REAL_ONLY dictionary has no key: %s" % Mail, "locate files",
+          "REAL_ONLY = %s" % repr(REAL_ONLY),
+          "Contact system administrator.")
+    else:
+      ListDiff(RetVal, Anomalies["REAL_ONLY"])
+
+  return RetVal
+
 def Install():
   "Do the actual installation."
 
@@ -287,12 +347,7 @@
   FilesToInstall = FindFiles("", InstallDir)
 
   # Are we supposed to ignore any of those?
-  if re.search(Anomalies["VIRTUAL_TEST"], PVars["HOME"]):
-    Dict["VirtUser"] = 1
-    ListDiff(FilesToInstall, Anomalies["REAL_ONLY"])
-  else:
-    Dict["VirtUser"] = 0
-    ListDiff(FilesToInstall, Anomalies["VIRTUAL_ONLY"])
+  ListDiff(FilesToInstall, IgnoreFiles(Anomalies))
 
   # What files will that clobber?
   FilesClobbered = FindExisting(FilesToInstall, os.environ["HOME"])
@@ -383,10 +438,7 @@
   UninstallFiles = FindFiles("", UninstallDir)
 
   # Are we supposed to ignore any of those?
-  if re.search(Anomalies["VIRTUAL_TEST"], PVars["HOME"]):
-    ListDiff(UninstallFiles, Anomalies["REAL_ONLY"])
-  else:
-    ListDiff(UninstallFiles, Anomalies["VIRTUAL_ONLY"])
+  ListDiff(UninstallFiles, IgnoreFiles(Anomalies))
 
   # Don't clobber anything.
   FilesClobbered = FindExisting(UninstallFiles, os.environ["HOME"])

_______________________________________
tmda-cvs mailing list
http://tmda.net/lists/listinfo/tmda-cvs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic