a R€a8Eã@s´ddlmZddlZddlZddlZddlZddlZddlmZm Z m Z ddl m Z ddl mZmZmZmZmZmZe e¡Zd ¡Ze d¡Zd Zd d „ZeZGd d „d eƒZdS)é)ÚBytesIONé)Ú sysconfigÚdetect_encodingÚZipFile)Úfinder)Ú FileOperatorÚget_export_entryÚ convert_pathÚget_executableÚ get_platformÚ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|vrT| d¡rB| dd¡\}}d|vrT| d¡sTd||f}n| d¡sTd|}|S)Nú z /usr/bin/env rú"z%s "%s"z"%s")Ú startswithÚsplit)Ú executableÚenvZ _executable©rúL/opt/alt/python39/lib/python3.9/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„ZdZdd„Zd,dd„Zdd„Zed d!„ƒZejd"d!„ƒZejd#ksÆejd krÎejd#krÎd$d%„Zd-d&d'„Z d.d(d)„Z!dS)/Ú ScriptMakerz_ A class to copy or create scripts from source scripts or callable specifications. NTFcCs‚||_||_||_d|_d|_tjdkp:tjdko:tjdk|_t dƒ|_ |pRt |ƒ|_ tjdkprtjdkortjdk|_ tj|_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ÚsysÚ version_info)ÚselfrrrÚdry_runZfileoprrrÚ__init__Nsÿ  ÿzScriptMaker.__init__cCs@| dd¡r<|jr %srspythonwrre) r"r1r3rr rrar r(Znewerr<rpr8r;r-Úreadliner=Ú FIRST_LINE_REÚmatchr2ÚgroupÚcloseZ copy_filer%rqrrÚinforÚseekrVrzr9)r,rƒrtZadjustrwÚfZ first_linerˆrJrTÚlinesrUrurxrrrÚ _copy_script?sR     ÿ     zScriptMaker._copy_scriptcCs|jjSr`©r(r-)r,rrrr-rszScriptMaker.dry_runcCs ||j_dSr`r)r,Úvaluerrrr-vsrcCstt d¡dkrd}nd}tƒdkr&dnd}d|||f}t d d ¡d }t|ƒ |¡}|snd ||f}t|ƒ‚|jS) NÚPéZ64Z32z win-arm64z-armrz %s%s%s.exerWrrz(Unable to find resource %s in package %s) ÚstructÚcalcsizer Ú__name__ÚrsplitrÚfindrSÚbytes)r,ÚkindÚbitsZplatform_suffixr#Zdistlib_packageÚresourceÚmsgrrrri~sÿzScriptMaker._get_launchercCs6g}t|ƒ}|dur"| ||¡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. Nr€)r rr„)r,Ú specificationr4rtr^rrrÚmake‘s 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,Zspecificationsr4rtržrrrÚ make_multiple¤szScriptMaker.make_multiple)TFN)rMN)N)N)N)"r–Ú __module__Ú __qualname__Ú__doc__ÚSCRIPT_TEMPLATErZrr.r6r*rIrr?rBrLrVr_Ú_DEFAULT_MANIFESTrbrdrzr~rr„rÚpropertyr-Úsetterr"r#r$rirŸr¡rrrrrEs8ÿ     E4 3   r) ÚiorZloggingr"Úrer”r*ÚcompatrrrZ resourcesrÚutilrr r r r r Z getLoggerr–r<Ústripr¦Úcompiler‡r¥rZ_enquote_executableÚobjectrrrrrÚs