a oe @sddlZddlZddlZddlZddlZddZejddkrXedededz ddl Z WnJe yZ z2eded e fed ed WYdZ [ n dZ [ 00z ddl Z WnLe yZ z2ed ed e fed ed WYdZ [ n dZ [ 00d dZ ddZddZejeej\ZZ\ZZeje\ZZe edeeede jede jeddS)NcCsJttdtdtdttdtdtdt|dS)Nz=This script is designed to copy and register the Python debugz>binaries. It looks for pythonxx_d.dll, pythoncomxx_d.dll etc,z=and installs them to work correctly with Python debug builds.z9You will generally find this script in the. zip file thatz5included these _d files. Please run this script fromzthat directory)printsysexit)rcr6C:\Program Files\Certbot\pkgs\win32\scripts\setup_d.py usage_and_diesr_dz=This scripts appears to be running a DEBUG version of Python.z7Please run it using a normal release build (python.exe)z1Could not import the release version of pythoncomzThe error details are: %sz.Please correct this error and rerun the scriptz2Could not import the release version of pywintypescCs|}tj|sTtjtjtjdd|}tdtj|tj|fdSz"t ||td||fWdStd||ftt tj dt dYn0dS)NrzCan not find %s or %s to copyzCopied %s -> %sr zError copying '%s' -> '%s')ospathisfilejoinsplitrargvrabspathshutilcopystrexc_infor)srcdestZorig_srcrrr_docopy0s"   rc Cstj|sJdzttjdtj|f}Wn\tjyzttjdtj|f}Wn*tjyt d|ft dYn0Yn0t |d}t |dtj |t d|fdS)Nz-Shouldn't get here if the file doesn't exist!z(Software\Python\PythonCore\%s\Modules\%szBCould not find the existing '%s' module registered in the registryZDebugzRegistered '%s' in the registry)r rrwinregOpenKeyHKEY_LOCAL_MACHINErwinvererrorrr CreateKeySetValueREG_SZ)mod_nameZdll_namekeyZsub_keyrrr _doregisterCs0  r&cCsVtj|\}}tj|\}}|d|}t||rRt|tjtj||dS)Nr )r rrsplitextrr&rr)r$Zrelease_mod_filenamerfnamebaseextZ new_fnamerrr _domodule]s   r+ pythoncom pywintypeszSystem _d files were setup.)r rrrZwin32apir__file__findrr, ImportErrorZdetailsr-rr&r+rrZGetModuleFileName dllhandler(r'r)r*rrrrs@