U o afB@sddlmZddlZddlZddlZddlZddlZddlmZm Z m Z ddl m Z ddl mZmZmZmZmZeeZdZedZd Zd d ZGd d d eZdS))BytesION) sysconfigdetect_encodingZipFile)finder) FileOperatorget_export_entry convert_pathget_executablein_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|drB|dd\}}d|krT|dsTd||f}n|dsTd|}|S)N z /usr/bin/env r"z%s "%s"z"%s") startswithsplit) executableenv _executabler\C:\Users\vtejo\AppData\Local\Temp\pip-unpacked-wheel-6mt8ur68\pip\_vendor\distlib\scripts.py_enquote_executable3s  rc@seZdZdZeZdZd'ddZddZe j d rBd d Z d d Z ddZd(ddZddZeZddZddZd)ddZddZeddZejddZejd ksejd krejd krd!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)NFposixjava)X.Ynt) source_dir target_dir add_launchersforceclobberosname_nameset_modesetvariantsr_fileop_is_nt)selfrrrdry_runfileoprrr__init__Ls  zScriptMaker.__init__cCs@|ddr<|jrr?existsremoverenamedebugr!r%set_executable_modeappend)r*namesrg script_bytes filenamesext use_launcherr|launcherstreamzfzip_datar#outnamenedfnamerrr _write_scriptsX                zScriptMaker._write_scriptc Csd}|r0|dg}|r0dd|}|d}|jd||d}||d}|j}t} d|jkrp| |d|jkr| d |t j d fd |jkr| d |t j d t j d f|r|ddrd} nd} | | |||| dS)NrWinterpreter_argsz %sr r\r5rXz%s%srrz%s-%s.%srr.Fpywry) r1r4rarhrrr#r&r'addrO version_infor) r*rqrr5rQargsrgscriptr# scriptnamesrrrr _make_scripts,      zScriptMaker._make_scriptcCsd}tj|jt|}tj|jtj|}|jsT|j ||sTt d|dSzt |d}Wn t k r|jszd}YnLX|}|st d||dSt|dd}|rd}|dpd }|s|r||j|||jr|j|g||nt d ||j|jjst|j\} } |d || |} d |kr^d } nd} tj|} || g| | || |r|dS)NFznot copying %s (up-to-date)rbz"%s: %s is an empty file (skipping)s rMTrrWzcopying and adjusting %s -> %srspythonwrry)!r"r2r4rr rrtr r(newerr>rr:r=r+readliner?get_command_name FIRST_LINE_REmatchr3groupclose copy_filer%rrinforseekrhrr;)r*rradjustrf first_linerrQrelinesrgrrrrr _copy_script2sX        zScriptMaker._copy_scriptcCs|jjSrsr(r+)r*rrrr+fszScriptMaker.dry_runcCs ||j_dSrsr)r*valuerrrr+jsrcCs`tddkrd}nd}d||f}tddd}t||}|sZd ||f}t||jS) NP6432z%s%s.exerirrz(Unable to find resource %s in package %s)structcalcsize__name__rsplitrfindrdbytes)r*kindbitsr#distlib_packageresourcemsgrrrr}rs 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. Nr)r rr)r* specificationr5rrqrrrmakes 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*specificationsr5rrrrr make_multipleszScriptMaker.make_multiple)TFN)rWN)N)N)N) r __module__ __qualname____doc__SCRIPT_TEMPLATErmrr-r8rOrPrrArHrVrhrr_DEFAULT_MANIFESTrurxrrrpropertyr+setterr"r#r$r}rrrrrrrCs6     @4 4   r)iorloggingr"rerrOcompatrrr resourcesrutilrr r r r getLoggerrr>striprcompilerrrobjectrrrrrs