[pywin32-checkins] pywin32/win32/scripts regsetup.py,1.12,1.13
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Mark H. <mha...@us...> - 2005-10-23 12:25:53
|
Update of /cvsroot/pywin32/pywin32/win32/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10313/win32/scripts Modified Files: regsetup.py Log Message: Bring these ancient and semi-useless registry utilities somewhat up to date Index: regsetup.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/scripts/regsetup.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** regsetup.py 13 Feb 2005 12:16:17 -0000 1.12 --- regsetup.py 23 Oct 2005 12:25:44 -0000 1.13 *************** *** 25,36 **** def IsDebug(): ! """Return "_d" if we're running a debug version. ! ! This is to be used within DLL names when locating them. ! """ ! import parser # This comes as a .pyd with most versions. ! if parser.__file__[-6:] == '_d.pyd': ! return '_d' ! return '' def FindPackagePath(packageName, knownFileName, searchPaths): --- 25,37 ---- def IsDebug(): ! """Return "_d" if we're running a debug version. ! ! This is to be used within DLL names when locating them. ! """ ! import imp ! for suffix_item in imp.get_suffixes(): ! if suffix_item[0]=='_d.pyd': ! return '_d' ! return '' def FindPackagePath(packageName, knownFileName, searchPaths): *************** *** 218,226 **** suffix = IsDebug() for path in presearchPaths: ! if FileExists(os.path.join(path, "parser%s.pyd" % suffix)): corePath = path break if corePath is None and searchPaths is not None: ! corePath = LocatePath("parser%s.pyd" % suffix, searchPaths) if corePath is None: raise error, "The core Python path could not be located." --- 219,227 ---- suffix = IsDebug() for path in presearchPaths: ! if FileExists(os.path.join(path, "unicodedata%s.pyd" % suffix)): corePath = path break if corePath is None and searchPaths is not None: ! corePath = LocatePath("unicodedata%s.pyd" % suffix, searchPaths) if corePath is None: raise error, "The core Python path could not be located." *************** *** 330,338 **** finally: win32api.RegCloseKey(hKey) - # The core DLL. - # regutil.RegisterCoreDLL() - - # Register the win32 extensions, as some of them are pretty much core! - # Why doesnt win32con.__file__ give me a path? (ahh - because only the .pyc exists?) # Register the win32 core paths. --- 331,334 ---- *************** *** 340,348 **** os.path.abspath( os.path.split(LocateFileName("win32con.py;win32con.pyc", sys.path ) )[0] ) ! suffix = IsDebug() ! ver_str = hex(sys.hexversion)[2] + hex(sys.hexversion)[4] ! # pywintypes now has a .py stub ! regutil.RegisterNamedPath("win32",win32paths) ! def RegisterShellInfo(searchPaths): --- 336,346 ---- os.path.abspath( os.path.split(LocateFileName("win32con.py;win32con.pyc", sys.path ) )[0] ) ! # Python has builtin support for finding a "DLLs" directory, but ! # not a PCBuild. Having it in the core paths means it is ignored when ! # an EXE not in the Python dir is hosting us - so we add it as a named ! # value ! check = os.path.join(sys.prefix, "PCBuild") ! if os.path.isdir(check): ! regutil.RegisterNamedPath("PCBuild",check) def RegisterShellInfo(searchPaths): *************** *** 367,421 **** # FindRegisterApp("win32", ["win32con.pyc", "win32api%s.pyd" % suffix], searchPaths) - def RegisterPythonwin(searchPaths): - """Knows how to register Pythonwin components - """ - import regutil - suffix = IsDebug() - # FindRegisterApp("Pythonwin", "docview.py", searchPaths) - - FindRegisterHelpFile("PyWin32.chm", searchPaths, "Pythonwin Reference") - - FindRegisterPythonExe("pythonwin%s.exe" % suffix, searchPaths, "Pythonwin%s.exe" % suffix) - - fnamePythonwin = regutil.GetRegisteredExe("Pythonwin%s.exe" % suffix) - fnamePython = regutil.GetRegisteredExe("Python%s.exe" % suffix) - - regutil.RegisterShellCommand("Edit", QuotedFileName(fnamePythonwin)+" /edit \"%1\"") - regutil.RegisterDDECommand("Edit", "Pythonwin", "System", '[self.OpenDocumentFile(r"%1")]') - - FindRegisterPackage("pywin", "__init__.py", searchPaths, "Pythonwin") - - regutil.RegisterFileExtensions(defPyIcon=fnamePythonwin+",0", - defPycIcon = fnamePythonwin+",5", - runCommand = QuotedFileName(fnamePython)+" \"%1\" %*") - - def UnregisterPythonwin(): - """Knows how to unregister Pythonwin components - """ - import regutil - regutil.UnregisterNamedPath("Pythonwin") - regutil.UnregisterHelpFile("Pythonwin.hlp") - regutil.UnregisterHelpFile("PyWin32.chm") - - suffix = IsDebug() - regutil.UnregisterPythonExe("pythonwin%s.exe" % suffix) - - #regutil.UnregisterShellCommand("Edit") - - regutil.UnregisterModule("win32ui") - regutil.UnregisterModule("win32uiole") - - - def RegisterWin32com(searchPaths): - """Knows how to register win32com components - """ - import win32api - # import ni,win32dbg;win32dbg.brk() - corePath = FindRegisterPackage("win32com", "olectl.py", searchPaths) - if corePath: - FindRegisterHelpFile("PyWin32.chm", searchPaths + [corePath+"\\win32com"], "Python COM Reference") - suffix = IsDebug() - ver_str = hex(sys.hexversion)[2] + hex(sys.hexversion)[4] - usage = """\ regsetup.py - Setup/maintain the registry for Python apps. --- 365,368 ---- *************** *** 439,445 **** Do not include a path on the filename! --shell -- Register everything with the Win95/NT shell. - --pythonwin -- Find and register all Pythonwin components. - --unpythonwin -- Unregister Pythonwin - --win32com -- Find and register all win32com components --upackage name -- Unregister the package --uapp name -- Unregister the app (identical to --upackage) --- 386,389 ---- *************** *** 462,467 **** For example, when registering the core Python, you may wish to provide paths to non-standard places to look for the Python help files, ! library files, etc. When registering win32com, you should pass paths ! specific to win32com. See also the "regcheck.py" utility which will check and dump the contents --- 406,410 ---- For example, when registering the core Python, you may wish to provide paths to non-standard places to look for the Python help files, ! library files, etc. See also the "regcheck.py" utility which will check and dump the contents *************** *** 476,485 **** python14.dll, the standard library and Win32 Extensions. - "regsetup --win32com" - Attempts to register win32com. No options are passed, so this is only - likely to succeed if win32com is already successfully registered, or the - win32com directory is current. If neither of these are true, you should pass - the path to the win32com directory. - "regsetup -a myappname . .\subdir" Registers a new Pythonpath entry named myappname, with "C:\\I\\AM\\HERE" and --- 419,422 ---- *************** *** 523,529 **** print "Attempting to setup/repair the Python core" ! SetupCore(searchPath) ! RegisterShellInfo(searchPath) # Check the registry. print "Registration complete - checking the registry..." --- 460,467 ---- print "Attempting to setup/repair the Python core" ! SetupCore(searchPath) ! RegisterShellInfo(searchPath) ! FindRegisterHelpFile("PyWin32.chm", searchPath, "Pythonwin Reference") # Check the registry. print "Registration complete - checking the registry..." *************** *** 534,538 **** import getopt, string opts, args = getopt.getopt(sys.argv[1:], 'p:a:m:c', ! ['pythonwin','unpythonwin','win32com','shell','upackage=','uapp=','umodule=','description','examples']) for arg in args: searchPaths.append(arg) --- 472,476 ---- import getopt, string opts, args = getopt.getopt(sys.argv[1:], 'p:a:m:c', ! ['shell','upackage=','uapp=','umodule=','description','examples']) for arg in args: searchPaths.append(arg) *************** *** 545,557 **** print "Registering the Python core." RegisterShellInfo(searchPaths) - if o=='--pythonwin': - print "Registering Pythonwin" - RegisterPythonwin(searchPaths) - if o=='--win32com': - print "Registering win32com" - RegisterWin32com(searchPaths) - if o=='--unpythonwin': - print "Unregistering Pythonwin" - UnregisterPythonwin() if o=='-p': print "Registering package", a --- 483,486 ---- |