diff easyhg.py @ 448:89b6ba707096

Don't try to chmod on Windows; doesn't work
author Chris Cannam
date Wed, 29 Jun 2011 12:59:33 +0100
parents f72cad3baa34
children f778dfb6a42f
line wrap: on
line diff
--- a/easyhg.py	Tue Jun 28 17:03:16 2011 +0100
+++ b/easyhg.py	Wed Jun 29 12:59:33 2011 +0100
@@ -13,7 +13,7 @@
 #    License, or (at your option) any later version.  See the file
 #    COPYING included with this distribution for more information.
 
-import sys, os, stat, urllib, urllib2, urlparse
+import sys, os, stat, urllib, urllib2, urlparse, platform
 
 from mercurial.i18n import _
 from mercurial import ui, util, error
@@ -98,13 +98,13 @@
     except:
         ui.write("failed to open authfile %s for writing\n" % pfile)
         raise
-    try:
-        #!!! Windows equivalent?
-        os.fchmod(ofp.fileno(), stat.S_IRUSR | stat.S_IWUSR)
-    except:
-        ofp.close()
-        ui.write("failed to set permissions on authfile %s\n" % pfile)
-        raise
+    if platform.system() != 'Windows':
+        try:
+            os.fchmod(ofp.fileno(), stat.S_IRUSR | stat.S_IWUSR)
+        except:
+            ofp.close()
+            ui.write("failed to set permissions on authfile %s\n" % pfile)
+            raise
     pcfg.write(ofp)
     ofp.close()