home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyo (Python 2.7)
-
- import warnings
- warnings.warn('The regcheck module has been pending deprecation since build 210', category = PendingDeprecationWarning)
- import win32con
- import regutil
- import win32api
- import os
- import sys
-
- def CheckRegisteredExe(exename):
-
- try:
- os.stat(win32api.RegQueryValue(regutil.GetRootKey(), regutil.GetAppPathsKey() + '\\' + exename))
- except (os.error, win32api.error):
- print 'Registration of %s - Not registered correctly' % exename
-
-
-
- def CheckPathString(pathString):
- for path in pathString.split(';'):
- if not os.path.isdir(path):
- return "'%s' is not a valid directory!" % path
-
-
-
- def CheckPythonPaths(verbose):
- if verbose:
- print 'Python Paths:'
- if verbose:
- print '\tCore Path:',
-
- try:
- appPath = win32api.RegQueryValue(regutil.GetRootKey(), regutil.BuildDefaultPythonKey() + '\\PythonPath')
- except win32api.error:
- exc = None
- print '** does not exist - ', exc.strerror
-
- problem = CheckPathString(appPath)
- if problem:
- print problem
- elif verbose:
- print appPath
- key = win32api.RegOpenKey(regutil.GetRootKey(), regutil.BuildDefaultPythonKey() + '\\PythonPath', 0, win32con.KEY_READ)
-
- try:
- keyNo = 0
- while None:
-
- try:
- appName = win32api.RegEnumKey(key, keyNo)
- appPath = win32api.RegQueryValue(key, appName)
- if verbose:
- print '\t' + appName + ':',
- if appPath:
- problem = CheckPathString(appPath)
- if problem:
- print problem
- elif verbose:
- print appPath
-
- elif verbose:
- print '(empty)'
- keyNo = keyNo + 1
- continue
- except win32api.error:
- break
- continue
-
-
- win32api.RegCloseKey(key)
- return None
-
-
-
- def CheckHelpFiles(verbose):
- if verbose:
- print 'Help Files:'
-
- try:
- key = win32api.RegOpenKey(regutil.GetRootKey(), regutil.BuildDefaultPythonKey() + '\\Help', 0, win32con.KEY_READ)
- except win32api.error:
- exc = None
- import winerror
- if exc.winerror != winerror.ERROR_FILE_NOT_FOUND:
- raise
- return None
-
-
- try:
- keyNo = 0
- while None:
-
- try:
- helpDesc = win32api.RegEnumKey(key, keyNo)
- helpFile = win32api.RegQueryValue(key, helpDesc)
- if verbose:
- print '\t' + helpDesc + ':',
-
- try:
- os.stat(helpFile)
- if verbose:
- print helpFile
- except os.error:
- print '** Help file %s does not exist' % helpFile
-
- keyNo = keyNo + 1
- continue
- except win32api.error:
- exc = None
- import winerror
- if exc.winerror != winerror.ERROR_NO_MORE_ITEMS:
- raise
- break
- continue
-
-
- win32api.RegCloseKey(key)
- return None
-
-
-
- def CheckRegisteredModules(verbose):
- k = regutil.BuildDefaultPythonKey() + '\\Modules'
-
- try:
- keyhandle = win32api.RegOpenKey(regutil.GetRootKey(), k)
- print "WARNING: 'Modules' registry entry is deprectated and evil!"
- except win32api.error:
- exc = None
- import winerror
- if exc.winerror != winerror.ERROR_FILE_NOT_FOUND:
- raise
- return None
-
-
-
- def CheckRegistry(verbose = 0):
- if verbose and 'pythonpath' in os.environ:
- print 'Warning - PythonPath in environment - please check it!'
- CheckPythonPaths(verbose)
- CheckHelpFiles(verbose)
- CheckRegisteredModules(verbose)
- CheckRegisteredExe('Python.exe')
-
- if __name__ == '__main__':
- if len(sys.argv) > 1 and sys.argv[1] == '-q':
- verbose = 0
- else:
- verbose = 1
- CheckRegistry(verbose)
-