- d dl mZ d dlZd dlZd dlZd dlZd dlZddlmZm Z m
Z
ddlmZ ddl
mZmZmZmZmZmZ ej e Zd Z ej d Zd Zd
ZeZ G d de ZdS )
)BytesION ) 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 /builddir/build/BUILDROOT/alt-python311-pip-21.3.1-4.el9.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_vendor/distlib/scripts.pyenquote_executabler 3 s
j
11 1)//Q77Ck!!+*@*@*E*E!*-##{{{;
((--
1#j0
c 6 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__N s $$*
G+ FF1B 2E13W1D
K((
6g!6!6go 4Gv2"(d"2
,r c | dd r_| j rXt j | \ }}| dd }t j || }|S )NguiFpythonpythonw)getr. r' pathr replacejoin)r1 r optionsdnfns r _get_alternate_executablez%ScriptMaker._get_alternate_executable_ 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)r1 r fps r _is_shellzScriptMaker._is_shellg 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)rJ r langSystemgetPropertylowerendswith)r1 r r s r _fix_jython_executablez"ScriptMaker._fix_jython_executables 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( lenr/ platform)r1 r post_interpsimple_shebangshebang_lengthmax_shebang_lengthresults r _build_shebangzScriptMaker._build_shebang s 7g!NN !__s;/?/??!CN|x''%(""%("#:5 E-1CC
Z'+5=FF#FlZ/+=OOFhF
r r c d}| j r| j }d}n:t j st }nt rHt
j t j d dt j d z }nt
j t j d dt j d t j d }t
j
| sGt
j t j d dt j d z }|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|d
k r; | | n$# t( $ r t+ d|d|d w xY w|S )NTFscriptszpython%sEXEBINDIRr7 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<