[win32] no os.getuid on windows stable
authorAlexandre Fayolle <alexandre.fayolle@logilab.fr>
Mon, 23 Aug 2010 12:49:28 +0200
branchstable
changeset 6135 e4b37742f75a
parent 6134 272cfcc10a28
child 6136 79da6f969b15
[win32] no os.getuid on windows
cwconfig.py
--- a/cwconfig.py	Mon Aug 23 09:07:20 2010 +0200
+++ b/cwconfig.py	Mon Aug 23 12:49:28 2010 +0200
@@ -999,7 +999,7 @@
         """check given directory path exists, belongs to the user running the
         server process and is writeable.
 
-        If not, try to fix this, leting exception propagate when not possible.
+        If not, try to fix this, letting exception propagate when not possible.
         """
         if not exists(path):
             os.makedirs(path)
@@ -1010,7 +1010,10 @@
                 from pwd import getpwnam
                 uid = getpwnam(self['uid']).pw_uid
         else:
-            uid = os.getuid()
+            try:
+                uid = os.getuid()
+            except AttributeError: # we are on windows
+                return
         fstat = os.stat(path)
         if fstat.st_uid != uid:
             os.chown(path, uid, os.getgid())