관리-도구
편집 파일: scripts.cpython-38.pyc
U ʗRe�F � @ s� d dl mZ d dlZd dlZd dlZd dlZd dlZd dlZd dlm Z ddl mZmZm Z ddlmZ ddlmZmZmZmZmZmZ e�e�Zd�� Ze�d �Zd Zdd� ZeZ G d 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 C sX d| krT| � d�rB| �dd�\}}d|krT|� d�sTd||f } n| � d�sTd| } | S )N� z /usr/bin/env r �"z%s "%s"z"%s")� startswith�split)� executable�env�_executable� r ��/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.py�enquote_executable5 s r c @ s� e Zd ZdZeZdZd*dd�Zdd� Ze j �d �rBd d� Zdd � Z dd� Zd+dd�Zdd� ZeZdd� Zdd� ZdZdd� Zd,dd�Zdd� Zed d!� �Zejd"d!� �Zejd#ks�ejd kr�ejd#kr�d$d%� Zd-d&d'�Z d.d(d)�Z!dS )/�ScriptMakerz_ A class to copy or create scripts from source scripts or callable specifications. NTFc C s� || _ || _|| _d| _d| _tjdkp:tjdko:tjdk| _t d�| _ |pRt|�| _tjdkprtjdkortjdk| _ tj| _d S )NF�posix�java)� �X.Y�nt)� source_dir� target_dir� add_launchers�force�clobber�os�name�_name�set_mode�set�variantsr �_fileop�_is_nt�sys�version_info)�selfr r r! �dry_run�fileopr r r �__init__P s � �zScriptMaker.__init__c C s@ |� dd�r<| jr<tj�|�\}}|�dd�}tj�||�}|S )N�guiF�python�pythonw)�getr+ r$ �pathr �replace�join)r. r �options�dn�fnr r r �_get_alternate_executablea s z%ScriptMaker._get_alternate_executabler c C s\ z0t |��}|�d�dkW 5 Q R � W S Q R X W n& ttfk rV t�d|� Y dS X dS )zl Determine if the specified executable is a script (contains a #! line) � z#!zFailed to open %sFN)�open�read�OSError�IOError�logger�warning)r. r �fpr r r � _is_shelli s &zScriptMaker._is_shellc C sD | � |�r*dd l}|jj�d�dkr<|S n|�� �d�r<|S d| S )Nr zos.name�Linuxz jython.exez/usr/bin/env %s)rE r �lang�System�getProperty�lower�endswith)r. r r r r r �_fix_jython_executableu s z"ScriptMaker._fix_jython_executablec C s� t jdkrd}n8t|�t|� d }tjdkr4d}nd}d|koF||k}|r^d| | d }n d }|d| | d 7 }|d 7 }|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)r. r �post_interp�simple_shebang�shebang_length�max_shebang_length�resultr r r �_build_shebang� s �zScriptMaker._build_shebang� c C s~ d}| j r| j }d}n�t�� s&t� }nxt� rLtj�t�d�dt� d� �}nRtj�t� d�dt� d�t� d�f �}tj� |�s�tj�t� d�dt� d� �}|r�| �||�}tj �d �r�| �|�}|r�t|�}|�d �}tj dkr�d|kr�d |kr�|d7 }| �||�}z|�d � W n" tk �r8 td| ��Y nX |d k�rzz|�|� W n& tk �rx td||f ��Y nX |S )NTF�scriptszpython%s�EXE�BINDIRz python%s%s�VERSIONr �utf-8�cliz -X:Framesz -X:FullFramess -X:Framesz,The shebang (%r) is not decodable from utf-8z?The shebang (%r) is not decodable from the script encoding (%r))r r �is_python_buildr r r$ r6 r8 �get_path�get_config_var�isfiler<