3 ”ReCã@s°ddlmZddlZddlZddlZddlZddlZddlmZm Z m Z ddl m Z ddl mZmZmZmZmZejeƒZdjƒZejdƒZd Zd d „ZeZGd 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()) cCsZd|krV|jdƒrD|jddƒ\}}d|krV|jdƒ rVd||f}n|jdƒsVd|}|S)Nú z /usr/bin/env rú"z%s "%s"z"%s")Ú startswithÚsplit)Ú executableÚenvÚ _executable©rúŠ/builddir/build/BUILDROOT/alt-python36-pip-20.2.4-5.el8.x86_64/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/distlib/scripts.pyÚenquote_executable3s  rc@sÚeZdZdZeZdZd'dd„Zdd„Ze j 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. NTFcCs‚||_||_||_d|_d|_tjdkp:tjdko:tjdk|_t dƒ|_ |pRt |ƒ|_ tjdkprtjdkortjdk|_ tj|_dS)NFÚposixÚjavaÚúX.YÚnt)rr)Ú source_dirÚ target_dirÚ add_launchersÚforceÚclobberÚosÚnameÚ_nameÚset_modeÚsetÚvariantsrÚ_fileopÚ_is_ntÚsysÚ version_info)ÚselfrrrÚdry_runÚfileoprrrÚ__init__Ns   zScriptMaker.__init__cCs@|jddƒr<|jr %srspythonwr˜rx)!r"r4r6rr rrsr r(Únewerr@r…r<r?r-ÚreadlinerAÚget_command_nameÚ FIRST_LINE_REÚmatchr5ÚgroupÚcloseÚ copy_filer%r†r‡ÚinforÚseekrhr•r=)r,r›rŠÚadjustr‘ÚfÚ first_liner£rRreÚlinesrgr‹r’rrrÚ _copy_script5sR         zScriptMaker._copy_scriptcCs|jjS)N)r(r-)r,rrrr-iszScriptMaker.dry_runcCs ||j_dS)N)r(r-)r,Úvaluerrrr-msrcCs`tjdƒdkrd}nd}d||f}tjddƒd}t|ƒj|ƒ}|sZd ||f}t|ƒ‚|jS) NÚPéZ64Z32z%s%s.exerirrz(Unable to find resource %s in package %s)ÚstructÚcalcsizeÚ__name__ÚrsplitrÚfindrdÚbytes)r,ÚkindÚbitsr#Zdistlib_packageÚresourceÚmsgrrrr|us zScriptMaker._get_launchercCs6g}t|ƒ}|dkr"|j||ƒ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)r7)r r­r�)r,Ú specificationr7rŠrqrrrÚmake‡s zScriptMaker.makecCs(g}x|D]}|j|j||ƒƒ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,Úspecificationsr7rŠr»rrrÚ make_multiplešs zScriptMaker.make_multiple)TFN)rXN)N)N)N) r³Ú __module__Ú __qualname__Ú__doc__ÚSCRIPT_TEMPLATErmrr/r:r*rQrrCrJrWrhrrÚ_DEFAULT_MANIFESTrtrwr•r�r­Úpropertyr-Úsetterr"r#r$r|r¼r¿rrrrrEs.     @4 4  r)ÚiorÚloggingr"Úrer±r*ÚcompatrrrÚ resourcesrÚutilrr r r r Ú getLoggerr³r@ÚstriprÄÚcompiler¢rÃrÚ_enquote_executableÚobjectrrrrrÚs