o _a! @sdddlmZddlmmZddlmZddlZddl Z ddl m Z m Z m Z GdddejZdS))logN)DistutilsModuleError) Distribution PathMetadataensure_directoryc@s*eZdZdZddZddZd ddZd S) install_scriptsz;Do normal script install, plus any egg_info wrapper scriptscCstj|d|_dS)NF)origrinitialize_optionsno_ep)selfr D/usr/lib/python3/dist-packages/setuptools/command/install_scripts.pyr s  z"install_scripts.initialize_optionsc Csddlmm}|d|jjrtj|ng|_ |j r!dS| d}t |j t|j |j|j|j}| d}t|dd}z | d}t|dd}Wn ttfyZd}Ynw|j}|red}|j}|tjkrm|g}|}|j|} ||| D]} |j| qdS) Nregg_info build_scripts executable bdist_wininst _is_runningFz python.exe)setuptools.command.easy_installcommand easy_install run_command distributionscriptsrrrunoutfilesr get_finalized_commandregg_baserregg_name egg_versiongetattr ImportErrorr ScriptWriterWindowsScriptWritersysrbestcommand_spec_class from_paramget_args as_header write_script) r eiei_cmddistbs_cmd exec_parambw_cmd is_wininstwritercmdargsr r r rs>       zinstall_scripts.runtc Gsddlm}m}td||jtj|j|}|j ||}|j sAt |t |d|} | || ||d|dSdS)z1Write an executable file to the scripts directoryr)chmod current_umaskzInstalling %s script to %swiN)rr5r6rinfo install_dirospathjoinrappenddry_runropenwriteclose) r script_namecontentsmodeignoredr5r6targetmaskfr r r r)7s  zinstall_scripts.write_scriptN)r4)__name__ __module__ __qualname____doc__r rr)r r r r r s &r) distutilsr!distutils.command.install_scriptsrrrdistutils.errorsrr:r# pkg_resourcesrrrr r r r s