[pywin32-checkins] pywin32 pywin32_postinstall.py,1.26,1.27
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Mark H. <mha...@us...> - 2008-11-13 03:57:23
|
Update of /cvsroot/pywin32/pywin32 In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv23020 Modified Files: pywin32_postinstall.py Log Message: Try and nuke a dbi.pyd incase the old version hasn't been uninstalled. Index: pywin32_postinstall.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/pywin32_postinstall.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** pywin32_postinstall.py 1 Oct 2008 14:01:56 -0000 1.26 --- pywin32_postinstall.py 13 Nov 2008 03:57:19 -0000 1.27 *************** *** 263,266 **** --- 263,287 ---- return win32api.GetSystemDirectory() + def fixup_dbi(): + # We used to have a dbi.pyd with our .pyd files, but now have a .py file. + # If the user didn't uninstall, they will find the .pyd which will cause + # problems - so handle that. + import win32api, win32con + pyd_name = os.path.join(os.path.dirname(win32api.__file__), "dbi.pyd") + pyd_d_name = os.path.join(os.path.dirname(win32api.__file__), "dbi_d.pyd") + py_name = os.path.join(os.path.dirname(win32con.__file__), "dbi.py") + for this_pyd in (pyd_name, pyd_d_name): + this_dest = this_pyd + ".old" + if os.path.isfile(this_pyd) and os.path.isfile(py_name): + try: + if os.path.isfile(this_dest): + print "Old dbi '%s' already exists - deleting '%s'" % (this_dest, this_pyd) + os.remove(this_pyd) + else: + os.rename(this_pyd, this_dest) + print "renamed '%s'->'%s.old'" % (this_pyd, this_pyd) + except os.error, exc: + print "FAILED to rename '%s': %s" % (this_pyd, exc) + def install(): import distutils.sysconfig *************** *** 372,375 **** --- 393,399 ---- "been registered" + # misc other fixups. + fixup_dbi() + # Register Pythonwin in context menu try: *************** *** 483,486 **** --- 507,521 ---- for fname in glob.glob(os.path.join(pywin_dir, "*.cfc")): os.remove(fname) + + # The dbi.pyd.old files we may have created. + try: + os.remove(os.path.join(lib_dir, "win32", "dbi.pyd.old")) + except os.error: + pass + try: + os.remove(os.path.join(lib_dir, "win32", "dbi_d.pyd.old")) + except os.error: + pass + except Exception, why: print "Failed to remove misc files:", why |