U ʗReF@sddlmZddlZddlZddlZddlZddlZddlZddlm Z ddl m Z m Z m Z ddlmZddlmZmZmZmZmZmZeeZdZed Zd Zd d ZeZ Gd dde!Z"dS))BytesION)ZipInfo) sysconfigdetect_encodingZipFile)finder) FileOperatorget_export_entry convert_pathget_executable get_platformin_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/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/distlib/scripts.pyenquote_executable5s  rc@seZdZdZeZdZd*ddZddZe j d rBd d Z d d Z ddZd+ddZddZeZddZddZdZddZd,ddZddZed d!Zejd"d!Zejd#ksejd krejd#krd$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)NFposixjava)X.Ynt) source_dir target_dir add_launchersforceclobberosname_nameset_modesetvariantsr _fileop_is_ntsys version_info)selfrr r!dry_runfileoprrr__init__Ps  zScriptMaker.__init__cCs@|ddr<|jr %srspythonwrr}) r$r6r8rr r rxr"r*newerrBrr>rAr/readlinerC FIRST_LINE_REmatchr7groupclose copy_filer'rrinforseekrlrr?)r.rradjustrf first_linerrTrilinesrkrrrrr _copy_scriptGsR         zScriptMaker._copy_scriptcCs|jjSrwr*r/)r.rrrr/zszScriptMaker.dry_runcCs ||j_dSrwr)r.valuerrrr/~srcCsttddkrd}nd}tdkr&dnd}d|||f}td d d }t||}|snd ||f}t||jS) NPZ64Z32z win-arm64z-armrz %s%s%s.exermrrz(Unable to find resource %s in package %s) structcalcsizer __name__rsplitrfindrhbytes)r.kindbitsZplatform_suffixr%Zdistlib_packageresourcemsgrrrrszScriptMaker._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. specificationr9rrurrrmakes 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.specificationsr9rrrrr make_multipleszScriptMaker.make_multiple)TFN)rZN)N)N)N)"r __module__ __qualname____doc__SCRIPT_TEMPLATErqrr1r<r,rSrrErLrYrlrv_DEFAULT_MANIFESTryr|rrrrrpropertyr/setterr$r%r&rrrrrrrrGs:     E: 3   r)#iorloggingr$rerr,rzipfilercompatrrr resourcesrutilr r r r r r getLoggerrrBstriprcompilerrr_enquote_executableobjectrrrrrs"