[pywin32-checkins] pywin32/com/win32com __init__.py,1.3,1.4
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: <mha...@us...> - 2003-09-01 08:16:37
|
Update of /cvsroot/pywin32/pywin32/com/win32com In directory sc8-pr-cvs1:/tmp/cvs-serv28824 Modified Files: __init__.py Log Message: Ensure win32com.gen_py exists even when the genpath is the default, and if the win32com\gen_py directory doesn't exist use %TEMP%\gen_py\%Py_VERSION% (rather than trying to create a directory which may be read-only after installation for some users) Index: __init__.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/__init__.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** __init__.py 2 Jul 2003 03:43:42 -0000 1.3 --- __init__.py 1 Sep 2003 08:16:33 -0000 1.4 *************** *** 3,7 **** # ! import win32api, sys import pythoncom --- 3,7 ---- # ! import win32api, sys, os import pythoncom *************** *** 57,76 **** found = 0 global __gen_path__ ! try: ! if key is not None: __gen_path__ = win32api.RegQueryValue(key, "GenPath") found = 1 ! # Import a special module, Otherwise it is already all setup for us. ! import new ! global gen_py # Exists in the win32com namespace. ! gen_py = new.module("win32com.gen_py") ! gen_py.__path__ = [ __gen_path__ ] ! sys.modules[gen_py.__name__]=gen_py ! ! except win32api.error: ! found = 0 ! if not found: ! __gen_path__ = win32api.GetFullPathName( __path__[0] + "\\gen_py") finally: if key is not None: --- 57,83 ---- found = 0 global __gen_path__ ! if key is not None: ! try: __gen_path__ = win32api.RegQueryValue(key, "GenPath") found = 1 ! except win32api.error: ! pass if not found: ! # no key. ! # We used to use a directory under win32com - but this sucks. ! # If that directory exists, we still use it, but now we prefer ! # a version specific directory under the user temp directory. ! if os.path.isdir(win32api.GetFullPathName( __path__[0] + "\\gen_py")): ! __gen_path__ = win32api.GetFullPathName( __path__[0] + "\\gen_py") ! else: ! __gen_path__ = os.path.join( ! win32api.GetTempPath(), "gen_py", ! "%d.%d" % (sys.version_info[0], sys.version_info[1])) ! # Create a "win32com.gen_py", but with a custom __path__ ! import new ! global gen_py # Exists in the win32com namespace. ! gen_py = new.module("win32com.gen_py") ! gen_py.__path__ = [ __gen_path__ ] ! sys.modules[gen_py.__name__]=gen_py finally: if key is not None: *************** *** 97,99 **** # get rid of these for module users ! del sys, win32api, pythoncom --- 104,106 ---- # get rid of these for module users ! del os, sys, win32api, pythoncom |