raise error, 'Need to locate the file %s, but the win32ui module is not available\nPlease run the program again, passing as a parameter the path to this file.' % fileName
flags = win32con.OFN_FILEMUSTEXIST
ext = os.path.splitext(fileName)[1]
filter = 'Files of requested type (*%s)|*%s||' % (ext, ext)
usage = 'regsetup.py - Setup/maintain the registry for Python apps.\n\nRun without options, (but possibly search paths) to repair a totally broken\npython registry setup. This should allow other options to work.\n\nUsage: %s [options ...] paths ...\n-p packageName -- Find and register a package. Looks in the paths for\n a sub-directory with the name of the package, and\n adds a path entry for the package.\n-a appName -- Unconditionally add an application name to the path.\n A new path entry is create with the app name, and the\n paths specified are added to the registry.\n-c -- Add the specified paths to the core Pythonpath.\n If a path appears on the core path, and a package also\n needs that same path, the package will not bother\n registering it. Therefore, By adding paths to the\n core path, you can avoid packages re-registering the same path.\n-m filename -- Find and register the specific file name as a module.\n Do not include a path on the filename!\n--shell -- Register everything with the Win95/NT shell.\n--upackage name -- Unregister the package\n--uapp name -- Unregister the app (identical to --upackage)\n--umodule name -- Unregister the module\n\n--description -- Print a description of the usage.\n--examples -- Print examples of usage.\n' % sys.argv[0]
description = 'If no options are processed, the program attempts to validate and set\nthe standard Python path to the point where the standard library is\navailable. This can be handy if you move Python to a new drive/sub-directory,\nin which case most of the options would fail (as they need at least string.py,\nos.py etc to function.)\nRunning without options should repair Python well enough to run with\nthe other options.\n\npaths are search paths that the program will use to seek out a file.\nFor example, when registering the core Python, you may wish to\nprovide paths to non-standard places to look for the Python help files,\nlibrary files, etc.\n\nSee also the "regcheck.py" utility which will check and dump the contents\nof the registry.\n'
examples = 'Examples:\n"regsetup c:\\wierd\\spot\\1 c:\\wierd\\spot\\2"\nAttempts to setup the core Python. Looks in some standard places,\nas well as the 2 wierd spots to locate the core Python files (eg, Python.exe,\npython14.dll, the standard library and Win32 Extensions.\n\n"regsetup -a myappname . .\\subdir"\nRegisters a new Pythonpath entry named myappname, with "C:\\I\\AM\\HERE" and\n"C:\\I\\AM\\HERE\\subdir" added to the path (ie, all args are converted to\nabsolute paths)\n\n"regsetup -c c:\\my\\python\\files"\nUnconditionally add "c:\\my\\python\\files" to the \'core\' Python path.\n\n"regsetup -m some.pyd \\windows\\system"\nRegister the module some.pyd in \\windows\\system as a registered\nmodule. This will allow some.pyd to be imported, even though the\nwindows system directory is not (usually!) on the Python Path.\n\n"regsetup --umodule some"\nUnregister the module "some". This means normal import rules then apply\nfor that module.\n'
if __name__ == '__main__':
if len(sys.argv) > 1 and sys.argv[1] in ('/?', '-?', '-help', '-h'):
print usage
elif len(sys.argv) == 1 or sys.argv[1][0] not in ('/', '-'):
searchPath = sys.path[:]
for arg in sys.argv[1:]:
searchPath.append(arg)
searchPath.append('..\\Build')
searchPath.append('..\\Lib')
searchPath.append('..')
searchPath.append('..\\..')
searchPath.append('..\\..\\lib')
searchPath.append('..\\build')
searchPath.append('..\\..\\pcbuild')
print 'Attempting to setup/repair the Python core'