[Zope3-checkins] SVN: Zope3/branches/3.2/src/zope/app/server/mkzopeinstance.py Added hack to try to work around distutils strippping execute bits.

Jim Fulton jim at zope.com
Fri Dec 23 18:06:58 EST 2005


Log message for revision 41012:
  Added hack to try to work around distutils strippping execute bits.
  

Changed:
  U   Zope3/branches/3.2/src/zope/app/server/mkzopeinstance.py

-=-
Modified: Zope3/branches/3.2/src/zope/app/server/mkzopeinstance.py
===================================================================
--- Zope3/branches/3.2/src/zope/app/server/mkzopeinstance.py	2005-12-23 23:02:35 UTC (rev 41011)
+++ Zope3/branches/3.2/src/zope/app/server/mkzopeinstance.py	2005-12-23 23:06:58 UTC (rev 41012)
@@ -258,15 +258,28 @@
             # perform replacements
             for var, string in self.replacements:
                 text = text.replace(var, string)
-            f = open(dst, "w")
+
+            # If the file exists, keep the old file.  This is a
+            # hopefully temporary hack to get around distutils
+            # stripping the permissions on the server skeletin files.
+            # We reuse the original default files, which have the
+            # right permissions.
+            old = os.path.exists(dst)
+            if old:
+                f = open(dst, "r+")
+                f.truncate(0)
+            else:
+                f = open(dst, "w")
+
             f.write(text)
             f.close()
-            shutil.copymode(src, dst)
-            shutil.copystat(src, dst)
+
+            if not old:
+                shutil.copymode(src, dst)
+                shutil.copystat(src, dst)
         else:
             shutil.copy2(src, dst)
 
-
 SKELTARGET_MESSAGE = """\
 Please choose a directory in which you'd like to install Zope
 'instance home' files such as database files, configuration files,



More information about the Zope3-Checkins mailing list