Update of /cvsroot/pywin32/pywin32
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21769
Modified Files:
pywin32_postinstall.py
Log Message:
Try and avoid having copies of the system32 dlls in both sys.prefix and
%system32%. If we do install into System32, nuke any versions of the same
file in sys.prefix. If we fail to install into system32 but the file
already exists there, we refuse to install in sys.prefix.
Index: pywin32_postinstall.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/pywin32_postinstall.py,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** pywin32_postinstall.py 6 Oct 2004 05:16:08 -0000 1.13
--- pywin32_postinstall.py 6 Oct 2004 05:38:29 -0000 1.14
***************
*** 181,189 ****
file_created(dst)
worked = 1
if worked:
break
except win32api.error, details:
if details[0]==5:
! # access denied - user not admin - try sys.prefix dir.
continue
raise
--- 181,205 ----
file_created(dst)
worked = 1
+ # If this isn't sys.prefix (ie, System32), then nuke
+ # any versions that may exist in sys.prefix - having
+ # duplicates causes major headaches.
+ if dest_dir != sys.prefix:
+ bad_fname = os.path.join(sys.prefix, base)
+ if os.path.exists(bad_fname):
+ # let exceptions go here - delete must succeed
+ os.unlink(bad_fname)
if worked:
break
except win32api.error, details:
if details[0]==5:
! # access denied - user not admin - try sys.prefix dir,
! # but first check that a version doesn't already exist
! # in that place - otherwise that one will still get used!
! if os.path.exists(dst):
! msg = "The file '%s' exists, but can not be replaced " \
! "due to insufficient permissions. You must " \
! "reinstall this software as an Administrator" \
! % dst
! raise RuntimeError, msg
continue
raise
|