[pywin32-checkins] pywin32 pywin32_postinstall.py,1.22,1.23
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Mark H. <mha...@us...> - 2008-05-24 00:33:11
|
Update of /cvsroot/pywin32/pywin32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30958 Modified Files: pywin32_postinstall.py Log Message: Index: pywin32_postinstall.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/pywin32_postinstall.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** pywin32_postinstall.py 23 May 2008 23:56:35 -0000 1.22 --- pywin32_postinstall.py 24 May 2008 00:33:16 -0000 1.23 *************** *** 243,246 **** --- 243,263 ---- return os.path.join(fldr, install_group) + # Get the system directory, which may be the Wow64 directory if we are a 32bit + # python on a 64bit OS. + def get_system_dir(): + import win32api # we assume this exists. + try: + import pythoncom + import win32process + from win32com.shell import shell, shellcon + try: + if win32process.IsWow64Process(): + return shell.SHGetSpecialFolderPath(0,shellcon.CSIDL_SYSTEMX86) + return shell.SHGetSpecialFolderPath(0,shellcon.CSIDL_SYSTEM) + except (pythoncom.com_error, win32process.error): + return win32api.GetSystemDirectory().encode('mbcs') + except ImportError: + return win32api.GetSystemDirectory().encode('mbcs') + def install(): import distutils.sysconfig *************** *** 279,283 **** # Try the system32 directory first - if that fails due to "access denied", # it implies a non-admin user, and we use sys.prefix ! for dest_dir in [win32api.GetSystemDirectory(), sys.prefix]: # and copy some files over there worked = 0 --- 296,300 ---- # Try the system32 directory first - if that fails due to "access denied", # it implies a non-admin user, and we use sys.prefix ! for dest_dir in [get_system_dir(), sys.prefix]: # and copy some files over there worked = 0 *************** *** 478,483 **** # it implies a non-admin user, and we use sys.prefix try: ! import win32api ! for dest_dir in [win32api.GetSystemDirectory(), sys.prefix]: # and copy some files over there worked = 0 --- 495,499 ---- # it implies a non-admin user, and we use sys.prefix try: ! for dest_dir in [get_system_dir(), sys.prefix]: # and copy some files over there worked = 0 |