3 ReC@sddlmZddlZddlZddlZddlZddlZddlmZm Z m Z ddl m Z ddl mZmZmZmZmZejeZdjZejdZd Zd d ZeZGd 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()) cCsZd|krV|jdrD|jdd\}}d|krV|jd rVd||f}n|jdsVd|}|S)N z /usr/bin/env r"z%s "%s"z"%s") startswithsplit) executableenv _executabler/builddir/build/BUILDROOT/alt-python36-pip-20.2.4-5.el9.x86_64/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/distlib/scripts.pyenquote_executable3s  rc@seZdZdZeZdZd'ddZddZe j 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. NTFcCs||_||_||_d|_d|_tjdkp:tjdko:tjdk|_t d|_ |pRt ||_ tjdkprtjdkortjdk|_ tj|_dS)NFposixjavaX.Ynt)rr) source_dir target_dir add_launchersforceclobberosname_nameset_modesetvariantsr_fileop_is_ntsys version_info)selfrrrdry_runfileoprrr__init__Ns   zScriptMaker.__init__cCs@|jddr<|jr %srspythonwrrx)!r"r4r6rr rrsr r(newerr@rr<r?r-readlinerAget_command_name FIRST_LINE_REmatchr5groupclose copy_filer%rrinforseekrhrr=)r,rradjustrf first_linerrRrelinesrgrrrrr _copy_script5sR         zScriptMaker._copy_scriptcCs|jjS)N)r(r-)r,rrrr-iszScriptMaker.dry_runcCs ||j_dS)N)r(r-)r,valuerrrr-msrcCs`tjddkrd}nd}d||f}tjddd}t|j|}|sZd ||f}t||jS) NPZ64Z32z%s%s.exerirrz(Unable to find resource %s in package %s)structcalcsize__name__rsplitrfindrdbytes)r,kindbitsr#Zdistlib_packageresourcemsgrrrr|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 rr)r, specificationr7rrqrrrmakes 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,specificationsr7rrrrr make_multiples zScriptMaker.make_multiple)TFN)rXN)N)N)N) r __module__ __qualname____doc__SCRIPT_TEMPLATErmrr/r:r*rQrrCrJrWrhrr_DEFAULT_MANIFESTrtrwrrrpropertyr-setterr"r#r$r|rrrrrrrEs.     @4 4  r)iorloggingr"rerr*compatrrr resourcesrutilrr r r r getLoggerrr@striprcompilerrr_enquote_executableobjectrrrrrs