B :—°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|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ú@/opt/alt/python37/lib/python3.7/site-packages/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)ÚzX.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 %srspythonwr†ri) r!r1r3rr rrerr'Únewerr<rur8r;r,Úreadliner=Ú FIRST_LINE_REÚmatchr2ÚgroupÚcloseÚ copy_filer$rvrwÚinforÚseekr[r€r9)r+rˆryZadjustr}ÚfZ first_linerŽrKrYÚlinesrZrzr~rrrÚ _copy_script?sP         zScriptMaker._copy_scriptcCs|jjS)N)r'r,)r+rrrr,rszScriptMaker.dry_runcCs ||j_dS)N)r'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.exer\rrz(Unable to find resource %s in package %s) ÚstructÚcalcsizer Ú__name__ÚrsplitrÚfindrXÚbytes)r+ÚkindÚbitsZplatform_suffixr"Zdistlib_packageÚresourceÚmsgrrrrm~szScriptMaker._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. N)r4)r r–r‰)r+Ú specificationr4ryrcrrrÚmake‘s zScriptMaker.makecCs(g}x|D]}| | ||¡¡q W|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+Zspecificationsr4ryr¤rrrÚ make_multiple¤s zScriptMaker.make_multiple)TFN)rNN)N)N)N)"rœÚ __module__Ú __qualname__Ú__doc__ÚSCRIPT_TEMPLATEr_rr-r6r)rJrr?rCrMr[rdÚ_DEFAULT_MANIFESTrfrhr€r„r…r‰r–Úpropertyr,Úsetterr!r"r#rmr¥r§rrrrrEs2     E4 3  r) ÚiorÚloggingr!Úreršr)ÚcompatrrrZ resourcesrÚutilrr r r r r Ú getLoggerrœr<Ústripr¬Úcompilerr«rZ_enquote_executableÚobjectrrrrrÚs