관리-도구
편집 파일: scripts.cpython-311.pyc
� �܋f\I � � � d dl mZ d dlZd dlZd dlZd dlZd dlZd dlZd dlm Z ddl mZmZm Z ddlmZ ddlmZmZmZmZmZmZ ej e� � Zd� � � Z ej d � � Zd Ze� dd� � d Z d� ee � � �! d � � D � � Z"d� Z#e#Z$ G d� de%� � Z&dS )� )�BytesION)�ZipInfo� )� sysconfig�detect_encoding�ZipFile)�finder)�FileOperator�get_export_entry�convert_path�get_executable�get_platform�in_venva� <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="%s" type="win32"/> <!-- Identify the application security requirements. --> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> <security> <requestedPrivileges> <requestedExecutionLevel level="asInvoker" uiAccess="false"/> </requestedPrivileges> </security> </trustInfo> </assembly>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 �\ � i | ])}|j � d � � �|j |j ��*S )�.exe)�name�endswith�bytes)�.0�rs �R/opt/cloudlinux/venv/lib64/python3.11/site-packages/pip/_vendor/distlib/scripts.py� <dictcomp>r @ sB � � � � � ��v���v�����F�A�G�� � � � 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")� startswith�split)� executable�env�_executables r �enquote_executabler$ G s� � � �j��� � � ��1�1� 1�)�/�/��Q�7�7��C���k�!�!�+�*@�*@��*E�*E�!�*-�#�#�{�{�{�;� ���(�(��-�-� 1�#�j�0� ��r c �8 � e Zd ZdZeZdZ dd�Zd� Ze j � d� � rd� Zd � Z d � Zdd�Zd � ZeZd� Zd� ZdZd� Zdd�Zd� Zed� � � Zej d� � � Zej dk sej dk rej dk rd� Zdd�Z dd�Z!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 )NF�posix�java)r �X.Y�nt)� source_dir� target_dir� add_launchers�force�clobber�osr �_name�set_mode�set�variantsr �_fileop�_is_nt�sys�version_info)�selfr, r- r. �dry_run�fileops r �__init__zScriptMaker.__init__d s� � � %���$���*����� ������G�+� J���F�1B� 2I�57�X��5H� � ��K�(�(�� ��6��g�!6�!6����g��o� @�"�'�V�*;� +?�.0�h�$�.>� ���,����r c �� � |� dd� � r_| j rXt j � |� � \ }}|� dd� � }t j � ||� � }|S )N�guiF�python�pythonw)�getr7 r1 �pathr �replace�join)r: r! �options�dn�fns r �_get_alternate_executablez%ScriptMaker._get_alternate_executabley sf � ��;�;�u�e�$�$� .��� .��W�]�]�:�.�.�F�B�����H�i�0�0�B�����b�"�-�-�J��r 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)�open�read�OSError�IOError�logger�warning)r: r! �fps r � _is_shellzScriptMaker._is_shell� s� � � ��*�%�%� .���7�7�1�:�:��-�.� .� .� .� .� .� .� .� .� .� .� .���� .� .� .� .� .� .���W�%� � � ����2�J�?�?�?��u�u� ���s, �A �7�A �;�A �;�A �,A4�3A4c �� � | � |� � r*dd l}|j j � d� � dk r|S n)|� � � � d� � r|S d|z S )Nr zos.name�Linuxz jython.exez/usr/bin/env %s)rS r) �lang�System�getProperty�lowerr )r: r! r) s r �_fix_jython_executablez"ScriptMaker._fix_jython_executable� s| � ��~�~�j�)�)� "������9�#�/�/� �:�:�g�E�E�%�%� F��!�!�#�#�,�,�\�:�:� "�!�!�$�z�1�1r 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 ' ''')r1 r �lenr8 �platform)r: r! �post_interp�simple_shebang�shebang_length�max_shebang_length�results r �_build_shebangzScriptMaker._build_shebang� s� � � �7�g���!�N�N� !��_�_�s�;�/?�/?�?�!�C�N��|�x�'�'�%(�"�"�%(�"�#�:�5� I�#1�5G�#G� � � ��Z�'�+�5��=�F�F�#�F��l�Z�/�+�=��O�O�F��h��F�� r r c � � d}| j r| j }d}�n,t j � � st � � }�n t � � rHt j � t j d� � dt j d� � z � � }n�t 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 )NTF�scriptszpython%s�EXEr+ �BINDIRr@ �VERSIONr) �utf-8�cliz -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 r1 rC rE �get_path�get_config_varr rI r8 rb r rZ r$ �encoderh �decode�UnicodeDecodeError� ValueError)r: �encodingrc rF �enquoter! �shebangs r �_get_shebangzScriptMaker._get_shebang� s� � ����?� F���J��G�G��*�,�,� F�'�)�)�J�J� �Y�Y� F������"�9�-�-��Y�5�e�<�<�<�>� >�J�J� �w�$��� �W�\�\��,�X�6�6��)�":�5�"A�"A�B�D� D� � � �W�\�\��,�X�6�6�6�$-�$<�Y�$G�$G�$G�$-�$<�U�$C�$C�$C�E�F� F� � � M��7�7� �G�L�L�J��<�"�"�6�*�*� A��4�4�Z�@�@�J� � 8�+�J�7�7�J� �&�&�w�/�/� ��L�E�!�!�k��&D�&D�#�;�6�6��=�(�K��%�%�j�+�>�>�� &��N�N�7�#�#�#�#��!� &� &� &��K�$�%� &� &� &� &���� �w��� 6����x�(�(�(�(��%� 6� 6� 6� �j�")�'�'�8�8�8�"5� 6� 6� 6� 6���� �s �'G= �=H�$H: �:!Ic � � | j t |j |j � d� � d |j �� � z S )Nr r )�module�import_name�func)�script_template�dict�prefix�suffixr )r: �entrys r �_get_script_textzScriptMaker._get_script_text sE � ��#�d��<���*�*�3�/�/��2���'� '� '� � r c �T � t j � |� � }| j |z S �N)r1 rC �basename�manifest)r: �exename�bases r �get_manifestzScriptMaker.get_manifest s$ � ��w����(�(���}�t�#�#r c �� � | j o| j }t j � d� � }|� |� � s||z }|s||z }�n|dk r| � d� � }n| � d� � }t � � } t | d� � 5 } t j � d� � }|rQt j t |� � � � d d� }t d|�� � } | � | |� � n| � d|� � d d d � � n# 1 swxY w Y | � � � }||z |z }|D �]}t j � | j |� � }|�r.t j � |� � \ }}|� d � � r|}d |z } | j � ||� � �nx# t0 $ r� t2 � d� � d|z }t j � |� � rt j |� � t j ||� � | j � ||� � t2 � d � � t j |� � n# t0 $ r Y nw xY wY n�w xY w| j r|� d|z � � s|�d|��}t j � |� � r$| j st2 � d|� � ���| j � ||� � | j r| j �! |g� � |�"