From c8d0893f5ad4a1772a92076adf48758cc7f47488 Mon Sep 17 00:00:00 2001 From: garyo Date: Tue, 12 May 2009 11:41:34 +0000 Subject: [PATCH] Fix issue 2421 by not trying to use os.chown on Windows. git-svn-id: http://scons.tigris.org/svn/scons/trunk@4190 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- src/engine/SCons/dblite.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/engine/SCons/dblite.py b/src/engine/SCons/dblite.py index e9932193..bcb2aa00 100644 --- a/src/engine/SCons/dblite.py +++ b/src/engine/SCons/dblite.py @@ -45,7 +45,10 @@ class dblite: _open = __builtin__.open _cPickle_dump = cPickle.dump _os_chmod = os.chmod - _os_chown = os.chown + try: + _os_chown = os.chown + except AttributeError: + _os_chown = None _os_rename = os.rename _os_unlink = os.unlink _shutil_copyfile = shutil.copyfile @@ -66,7 +69,7 @@ class dblite: self._mode = mode self._dict = {} self._needs_sync = 00000 - if os.geteuid()==0 or os.getuid()==0: + if self._os_chown is not None and (os.geteuid()==0 or os.getuid()==0): # running as root; chown back to current owner/group when done try: statinfo = os.stat(self._file_name) @@ -118,7 +121,7 @@ class dblite: except OSError: pass self._os_unlink(self._file_name) self._os_rename(self._tmp_name, self._file_name) - if self._chown_to > 0: # don't chown to root or -1 + if self._os_chown is not None and self._chown_to > 0: # don't chown to root or -1 try: self._os_chown(self._file_name, self._chown_to, self._chgrp_to) except OSError: -- 2.26.2