i.RGddeZddlZdZdZdZdZdZd Zd Z d Z d Z d Z dZ d=dZdZd=dZdZd=dZd=dZdZdZdejdzZdZdZedkrZeejdkrejddvr eedSeejdksejdddvr6ejddZejddD]Ze ee de de d e d!e d"e d#d$ej!vre d%ne d&ed'eeeeed(ed)ed*ddl"Z"e"j#dSgZ$ddl%Z%e%j%ejddd+gd,\Z&Z'e'D]Ze$ ee&D]\Z(Z)e(d-kr eee(d.kr eee(d/kred0ee$e(d1kred2e)ee)de$e(d3vr ddl*Z*ed4e)e*j+e)e(d5kr8ddl*Z*d6,e$Zed7e)d8ee*j-e)ee(d9kre$s ed:ddl*Z*e*j.d/d6Z0ee0Z1e$D]Z2e2e0vre0 e2ee0e1kr@ed;ee0e1z ze*j-dd6,e0wed<dSdS)>ceZdZdS)errorN)__name__ __module__ __qualname__DC:\PYTHON\_runtimes\venv\Lib\site-packages\win32/scripts/regsetup.pyrrsDrrNcjddl} ||dS#t$r }Yd}~dSd}~wwxYw)z/Check if a file exists. Returns true or false.r N)osstatOSError)fnamer detailss r FileExistsr sP III q qqqqqs  22cddl}|d}t|j|j|||S)z~Given a path, a ni package name, and possibly a known file name in the root of the package, see if this path is good. r N.)r rpathjoin)r packageName knownFileNamer s r IsPackageDirrsFIII bgll27<<k#B#BMRR S SSrc.ddl}d|jjvrdndS)zoReturn "_d" if we're running a debug version. This is to be used within DLL names when locating them. r Nz_d.pyd_d)importlib.machinery machineryEXTENSION_SUFFIXES) importlibs r IsDebugr!!s* y2EEE442Mrcddl}ddl}|j|}|rt|||r|dfS|D]3}t|||r |j|}||fcS4t d|z)zFind a package. Given a ni style package name, check the package is registered. First place looked is the registry for an existing entry. Then the searchPaths are searched. r Nz!The package %s can not be located)r regutilGetRegisteredNamedPathrrabspathr)rr searchPathsr r#pathLookrets r FindPackagePathr)+sIIINNN-w-k::HL; FF~ +} = = '//(++C8OOO  3kA B BBrc\ddl}ddl}ddl} ||jdd|j} |||d}t|j ||r.|j || Sn#|j $rYnwxYw| n#| wxYwn#|j $rYnwxYw|D]}t|j ||r|j |cS|j |d}t|j ||r|j |cStd|z)Nr zSoftware\Microsoft\Windows\HelpHelpz#The help file %s can not be located) r win32apiwin32con RegOpenKeyHKEY_LOCAL_MACHINEKEY_ALL_ACCESSRegQueryValueExrrrr%Closer) helpFilehelpDescr&r r,r-keyrr's r FindHelpPathr6Cs IIIOOOOOO !!  ' 0  #      //X>>qAbgll4::;;17??400 IIKKKK 1>     IIKKKKCIIKKKKK >     -- bgll8X66 7 7 -7??8,, , , ,7<<&11 bgll8X66 7 7 -7??8,, , , , - 5@ A AAsM"C$AB%C$$C % B2/C 1B22C 5C$ C  C$$ C10C1cddl}ddl}|j|}|r|dd}|r*t |j||rdS|D]F}t |j||r|j|cSGtd|d|)zFind an application. First place looked is the registry for an existing entry. Then the searchPaths are searched. r N;z The file z$ can not be located for application ) r r#r$splitrrrr%r)appNamerr&r r#regPathr's r FindAppPathr<esIIINNN,g,W55G)==%%a(:bgll8]CCDDt-- bgll8];; < < -7??8,, , , , - PMPPwPP  rcddl}ddl}ddl}ddl}||}|j|j|}t|sMd|jvr#|j|jdd|}n!|j|jd|}t|st||}d} | |j |j dz|z} || k}n#|j $rYnwxYw||fS)zFind an exe. Returns the full path to the .exe, and a boolean indicating if the current registered entry is OK. We don't trust the already registered version even if it exists - it may be wrong (ie, for a different Python version) r N64 bitPCBuildamd64\)r sysr#r,rrprefixrversionLocateFileName RegQueryValue GetRootKeyGetAppPathsKeyr) exeAliaspossibleRealNamesr&r rBr#r,found registered_ok registereds r FindPythonExerNsBIIIJJJNNNOOO $ GLL%6 7 7E e  K s{ " "GLLYARSSEEGLLY8IJJE e  ?0+>>M ++ G  "8'"8":":T"AH"L  + >     - s3r@)rBrrr r#r,r-rwrzryr RegCreateKeyrGBuildDefaultPythonKey RegSetValueREG_SZ RegCloseKeyr%r9__file__rErCrDisdir) r&rBrr r#r,r-rvr}hKey win32pathschecks r SetupCorerrsJJJ  IIINNNOOOOOO-k::K )GdCHHY$7$7888  !3!3!5!57Tw7T7V7V W WD#T=(/;OOOT""""T""""  h&788;<<   '// GMM.)CSXNN O OPQ R    GLLY / /E3; UG,, w}}U4!!)U3333344s *CC4cBddl}ddl}t}td|z|}|jdd|j|jdt|dzd|jd d |z|jtd |d td |d dS)zRegisters key parts of the Python installation with the Windows Shell. Assumes a valid, minimal Python installation exists (ie, SetupCore() has been previously successfully run) r Nz Python%s.exez.pyz Python.FileOpenz "%1" %*z&RunzPython.File\DefaultIconz%s,0z Python.hlpzMain Python DocumentationzActivePython.chm) r#r-r!rSetRegistryDefaultValueHKEY_CLASSES_ROOTRegisterShellCommandrSr)r&r#r-ruexePaths r RegisterShellInfors NNNOOO YYF#NV$;[IIG#G#E=(:TUUU G )@)@:)MvVVV#G#"FW$4h6P{4OPPP+[:UVVVVVraregsetup.py - Setup/maintain the registry for Python apps. Run without options, (but possibly search paths) to repair a totally broken python registry setup. This should allow other options to work. Usage: %s [options ...] paths ... -p packageName -- Find and register a package. Looks in the paths for a sub-directory with the name of the package, and adds a path entry for the package. -a appName -- Unconditionally add an application name to the path. A new path entry is create with the app name, and the paths specified are added to the registry. -c -- Add the specified paths to the core Pythonpath. If a path appears on the core path, and a package also needs that same path, the package will not bother registering it. Therefore, By adding paths to the core path, you can avoid packages re-registering the same path. -m filename -- Find and register the specific file name as a module. Do not include a path on the filename! --shell -- Register everything with the Win95/NT shell. --upackage name -- Unregister the package --uapp name -- Unregister the app (identical to --upackage) --umodule name -- Unregister the module --description -- Print a description of the usage. --examples -- Print examples of usage. aIf no options are processed, the program attempts to validate and set the standard Python path to the point where the standard library is available. This can be handy if you move Python to a new drive/sub-directory, in which case most of the options would fail (as they need at least string.py, os.py etc to function.) Running without options should repair Python well enough to run with the other options. paths are search paths that the program will use to seek out a file. 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 of the registry. a Examples: "regsetup c:\weird\spot\1 c:\weird\spot\2" Attempts to setup the core Python. Looks in some standard places, as well as the 2 weird spots to locate the core Python files (eg, Python.exe, pythonXX.dll, the standard library and Win32 Extensions). "regsetup -a myappname . .\subdir" Registers a new Pythonpath entry named myappname, with "C:\I\AM\HERE" and "C:\I\AM\HERE\subdir" added to the path (ie, all args are converted to absolute paths) "regsetup -c c:\my\python\files" Unconditionally add "c:\my\python\files" to the 'core' Python path. "regsetup -m some.pyd \windows\system" Register the module some.pyd in \windows\system as a registered module. This will allow some.pyd to be imported, even though the windows system directory is not (usually!) on the Python Path. "regsetup --umodule some" Unregister the module "some". This means normal import rules then apply for that module. __main__r )z/?z-?z-helpz-h)/-z..\Buildz..\Librpz..\..z ..\..\libz..\buildr>z..\..\pcbuild\amd64z ..\..\pcbuildz*Attempting to setup/repair the Python corez PyWin32.chmzPythonwin Referencez0Registration complete - checking the registry...zp:a:m:c)shellz upackage=zuapp=zumodule= descriptionexamplesz --descriptionz --examplesz--shellzRegistering the Python core.z-pzRegistering package)z --upackagez--uappz!Unregistering application/packagez-ar8zRegistering applicationzto pathz-cz3-c option must provide at least one additional pathzRegistering %d new core pathsz+All specified paths are already registered.)N)3 ExceptionrrBrrr!r)r6r<rNrSrErhrkrnrwrrrrrrargvusagerrrlenrzr searchPathargrrDregcheck CheckRegistryr&getoptoptsargsoar#UnregisterNamedPathrryr$r9 currentPathsoldLennewPathrrr rs/     I    TTTNNNCCC0BBBD4! ! ! H   *$*$*$ZTTT$,$,$,N"?"?"?"?J8880     ; ; ; ;242424jWWW6 6 hqk7 : & 2 z s38}}qSXa[,GGG e SX!  38A;q>Z#?#?Xaaa[ 8ABB< # #C   c " " " " +&&&)$$$$(### -(((+&&& s{ " "   6 7 7 7 7   / 0 0 0 :;;; **%%%]J8MNNN @AAA       "V] HQRRL  R R R  d  $ $C   s # # # #& I& IDAqO##k"""L  hI~~4555!!+...Dyy+Q///##At[999,,,91===++A...Dyyxx ,,/ItDDD))!T222Dyy"W% UVVV=w=dCCII#NN \***55Gl22$++G4443|$$..E733|;L;Lv;UV.G-dCHH\4J4JKKKKEGHHHi\& I& Ir