}]W d dl mZ d dlZd dlZd dlZd dlZd dlZd dlZd dlm Z ddl
mZmZm
Z
ddlmZ ddlmZmZmZmZmZmZ ej e Zd Z ej d Zd
Zd ZeZ G d d
e! Z"dS ) )BytesION)ZipInfo ) sysconfigdetect_encodingZipFile)finder)FileOperatorget_export_entryconvert_pathget_executableget_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())
c d| v rj| d r;| dd \ }}d|v r| d s|d|d} n| d sd| z } | S )N z
/usr/bin/env r "z "z"%s")
startswithsplit)
executableenv_executables /srv/buildsys-work-dir/castor/build_node/builder-2/WGSG1/unpkd_srcs/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/distlib/scripts.pyenquote_executabler 5 s
j
11 1)//Q77Ck!!+*@*@*E*E!*-##{{{;
((--
1#j0
c 8 e Zd ZdZeZdZ ddZd Ze j
d rd Zd Z
d
ZddZd
ZeZd Zd ZdZd ZddZd Zed Zej d Zej dk sej dk rej dk rd ZddZ ddZ!dS )ScriptMakerz_
A class to copy or create scripts from source scripts or callable
specifications.
NTFc || _ || _ || _ d| _ d| _ t
j dk pt
j dk ot
j dk | _ t d | _
|pt | | _ t
j dk pt
j dk ot
j dk | _
t j | _ d S )NFposixjava) X.Ynt)
source_dir
target_dir
add_launchersforceclobberosname_nameset_modesetvariantsr
_fileop_is_ntsysversion_info)selfr# r$ r% dry_runfileops r __init__zScriptMaker.__init__R s %$*
G+ JF1B 2I57X5H
K((
6g!6!6go @"'V*; +?.0h$.>
,r c | dd r_| j rXt j | \ }}| dd }t j || }|S )NguiFpythonpythonw)getr/ r( pathr replacejoin)r2 r optionsdnfns r _get_alternate_executablez%ScriptMaker._get_alternate_executableg sf ;;ue$$ . .W]]:..FBHi00Bb"--Jr r c t | 5 }| d dk cddd S # 1 swxY w Y dS # t t f$ r t d| Y dS w xY w)zl
Determine if the specified executable is a script
(contains a #! line)
z#!NzFailed to open %sF)openreadOSErrorIOErrorloggerwarning)r2 r fps r _is_shellzScriptMaker._is_shellp s
*%% .771::-. . . . . . . . . . . . . . . . . .W%
2J???uu
s, A 7A ;A ;A ,A43A4c | | r*dd l}|j j d dk r|S n)| d r|S d|z S )Nr zos.nameLinuxz
jython.exez/usr/bin/env %s)rK r langSystemgetPropertylowerendswith)r2 r r s r _fix_jython_executablez"ScriptMaker._fix_jython_executable| s| ~~j))
"9#// ::gEE%% F!!##,,\::
"!!$z11r c t j dk rd}nAt | t | z dz }t j dk rd}nd}d|vo||k }|rd|z |z d z }nd
}|d|z |z dz z
}|d
z
}|S )a
Build a shebang line. In the simple case (on Windows, or a shebang line
which is not too long or contains spaces) use a simple formulation for
the shebang. Otherwise, use /bin/sh as the executable, with a contrived
shebang which allows the script to run either under Python or sh, using
suitable quoting. Thanks to Harald Nordgren for his input.
See also: http://www.in-ulm.de/~mascheck/various/shebang/#length
https://hg.mozilla.org/mozilla-central/file/tip/mach
r T darwini s #!
s
#!/bin/sh
s '''exec' s "$0" "$@"
s ' ''')r( r) lenr0 platform)r2 r post_interpsimple_shebangshebang_lengthmax_shebang_lengthresults r _build_shebangzScriptMaker._build_shebang s 7g!NN !__s;/?/??!CN|x''%(""%("#:5 I#15G#G
Z'+5=FF#FlZ/+=OOFhF
r r c d}| j r| j }d}n,t j st }n t rHt
j t j d dt j d z }nt
j
dk rHt
j t j d dt j d z }n[t
j t j d dt j d t j d }|r| || }t j
d
r| | }|rt! | }| d }t j
dk r
d
|vr d|vr|dz
}| || } | d n # t( $ r t+ d|z w xY w|dk r; | | n$# t( $ r t+ d|d|d w xY w|S )NTFscriptszpython%sEXEr" BINDIRr8 VERSIONr utf-8cliz -X:Framesz
-X:FullFramess
-X:Framesz,The shebang (%r) is not decodable from utf-8z
The shebang (z-) is not decodable from the script encoding ())r r is_python_buildr
r r( r; r= get_pathget_config_varr) rA r0 r[ r rS r encodera decodeUnicodeDecodeError
ValueError)r2 encodingr\ r> enquoter shebangs r _get_shebangzScriptMaker._get_shebang s ? FJGG*,, F'))JJ
YY F"9--Y5e<<<> >JJ w$ W\\,X66)":5"A"ABD D
W\\,X666$-$