U ÀÒ.e¢?ã@s¬ddlmZddlZddlZddlZddlZddlZddlmZm Z m Z ddl m Z ddl mZmZmZmZmZe e¡Zd ¡Ze d¡Zd Zd d „ZGd d „d eƒZdS)é)ÚBytesIONé)Ú sysconfigÚdetect_encodingÚZipFile)Úfinder)Ú FileOperatorÚget_export_entryÚ convert_pathÚget_executableÚin_venvañ s^#!.*pythonw?[0-9.]*([ ].*)?$zÍ# -*- coding: utf-8 -*- import re import sys from %(module)s import %(import_name)s if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) sys.exit(%(func)s()) cCsXd|krT| d¡rB| dd¡\}}d|krT| d¡sTd||f}n| d¡sTd|}|S)Nú z /usr/bin/env rú"z%s "%s"z"%s")Ú startswithÚsplit)Ú executableÚenvZ _executable©rú?/usr/lib/python3.8/site-packages/pip/_vendor/distlib/scripts.pyÚ_enquote_executable3s  rc@sÚeZdZdZeZdZd'dd„Zdd„Ze j   d ¡rBd d „Z d d „Z dd„Zd(dd„Zdd„ZeZdd„Zdd„Zd)dd„Zdd„Zedd„ƒZejdd„ƒZejd ksºejd krÂejd krÂd!d"„Zd*d#d$„Zd+d%d&„ZdS),Ú ScriptMakerz_ A class to copy or create scripts from source scripts or callable specifications. NTFcCsz||_||_||_d|_d|_tjdkp:tjdko:tjdk|_t dƒ|_ |pRt |ƒ|_ tjdkprtjdkortjdk|_ dS)NFÚposixÚjava)ÚúX.YÚnt)Ú source_dirÚ target_dirÚ add_launchersÚforceÚclobberÚosÚnameÚ_nameÚset_modeÚsetÚvariantsrÚ_fileopÚ_is_nt)ÚselfrrrÚdry_runZfileoprrrÚ__init__Lsÿ  ÿzScriptMaker.__init__cCs@| dd¡r<|jr %srspythonwr|rd)!r!r/r1rr rr`rr'Znewerr:ror6r9r*Úreadliner;Zget_command_nameÚ FIRST_LINE_REÚmatchr0ÚgroupÚcloseZ copy_filer$rprqÚinforÚseekrUryr7)r)r€rsZadjustrvÚfZ first_liner…rIrSÚlinesrTrtrwrrrÚ _copy_script)sX  ÿ ÿ     zScriptMaker._copy_scriptcCs|jjSr_©r'r*)r)rrrr*]szScriptMaker.dry_runcCs ||j_dSr_r)r)Úvaluerrrr*asrcCsHt d¡dkrd}nd}d||f}t dd¡d}t|ƒ |¡j}|S) NÚPéZ64Z32z%s%s.exerVrr)ÚstructÚcalcsizeÚ__name__ÚrsplitrÚfindÚbytes)r)ZkindÚbitsr"Zdistlib_packagerJrrrrhis zScriptMaker._get_launchercCs6g}t|ƒ}|dkr"| ||¡n|j|||d|S)aÓ Make a script. :param specification: The specification, which is either a valid export entry specification (to make a script from a callable) or a filename (to make a script by copying from a source location). :param options: A dictionary of options controlling script generation. :return: A list of all absolute pathnames written to. Nrz)r rŒr)r)Ú specificationr2rsr]rrrÚmakews zScriptMaker.makecCs$g}|D]}| | ||¡¡q|S)z Take a list of specifications and make scripts from them, :param specifications: A list of specifications. :return: A list of all absolute pathnames written to, )Úextendr™)r)Zspecificationsr2rsr˜rrrÚ make_multipleŠszScriptMaker.make_multiple)TFN)rLN)N)N)N) r“Ú __module__Ú __qualname__Ú__doc__ÚSCRIPT_TEMPLATErYrr+r4rGrHrr=r@rKrUr^Ú_DEFAULT_MANIFESTrarcryrrŒÚpropertyr*Úsetterr!r"r#rhr™r›rrrrrCs6ÿ     84 4   r)ÚiorZloggingr!Úrer‘rGÚcompatrrrZ resourcesrÚutilrr r r r Z getLoggerr“r:Ústripr Úcompiler„rŸrÚobjectrrrrrÚs