AlkantarClanX12

Your IP : 18.224.56.127


Current Path : /opt/alt/python37/lib64/python3.7/distutils/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/distutils/__pycache__/util.cpython-37.opt-1.pyc

B

� f�O�@sdZddlZddlZddlZddlZddlZddlmZddl	m
Z
ddlmZddl
mZddlmZdd	�Zd
d�Zdd
�Zdadd�Zdd�Zd(dd�Zdaaadd�Zdd�Zd)dd�Zdd�Zd*dd�Zd d!�Zd+d"d#�Z d,d$d%�Z!Gd&d'�d'�Z"dS)-zudistutils.util

Miscellaneous utility functions -- anything that doesn't fit into
one of the other *util.py modules.
�N)�DistutilsPlatformError)�newer)�spawn)�log)�DistutilsByteCompileErrorc
Cs�tjdkr"dtj��krdStjSdtjkr6tjdStjdksJttd�sPtjSt��\}}}}}|���	dd�}|�	d	d
�}|�	dd�}|dd
�dkr�d||fS|dd
�dk�r|ddk�r�d}dt
|d�d|dd�f}ddd�}|d|tj7}n�|dd�dk�r(d|||fS|dd�dk�rfd}t�
dtj�}|�|�}|�r�|��}n>|dd�d k�r�ddl}ddl}	|�|	j��|||�\}}}d!|||fS)"a�Return a string that identifies the current platform.  This is used mainly to
    distinguish platform-specific build directories and platform-specific built
    distributions.  Typically includes the OS name and version and the
    architecture (as supplied by 'os.uname()'), although the exact information
    included depends on the OS; eg. on Linux, the kernel version isn't
    particularly important.

    Examples of returned values:
       linux-i586
       linux-alpha (?)
       solaris-2.6-sun4u

    Windows will return one of:
       win-amd64 (64bit Windows on AMD64 (aka x86_64, Intel64, EM64T, etc)
       win32 (all others - specifically, sys.platform is returned)

    For other non-POSIX platforms, currently just returns 'sys.platform'.

    �ntZamd64z	win-amd64Z_PYTHON_HOST_PLATFORM�posix�uname�/�� �_�-N�Zlinuxz%s-%sZsunosr�5Zsolarisz%d.%s��Z32bitZ64bit)i���l����z.%sZaixz%s-%s.%s��cygwinz[\d.]+�darwinz%s-%s-%s)�os�name�sys�version�lower�platform�environ�hasattrr	�replace�int�maxsize�re�compile�ASCII�match�group�_osx_supportZdistutils.sysconfigZget_platform_osxZ	sysconfigZget_config_vars)
ZosnameZhost�releaser�machineZbitnessZrel_re�mr&�	distutils�r+�3/opt/alt/python37/lib64/python3.7/distutils/util.py�get_platformsD


 


r-cCs~tjdkr|S|s|S|ddkr.td|��|ddkrFtd|��|�d�}xd|krf|�d�qRW|srtjStjj|�S)a�Return 'pathname' as a name that will work on the native filesystem,
    i.e. split it on '/' and put it back together again using the current
    directory separator.  Needed because filenames in the setup script are
    always supplied in Unix style, and have to be converted to the local
    convention before we can actually use them in the filesystem.  Raises
    ValueError on non-Unix-ish systems if 'pathname' either starts or
    ends with a slash.
    r
rzpath '%s' cannot be absolute���zpath '%s' cannot end with '/'�.)r�sep�
ValueError�split�remove�curdir�path�join)�pathname�pathsr+r+r,�convert_path`s	


r9cCs�tjdkr<tj�|�s$tj�||�Stj�||dd��SnNtjdkr|tj�|�\}}|ddkrn|dd�}tj�||�Stdtj��dS)a	Return 'pathname' with 'new_root' prepended.  If 'pathname' is
    relative, this is equivalent to "os.path.join(new_root,pathname)".
    Otherwise, it requires making 'pathname' relative and then joining the
    two, which is tricky on DOS/Windows and Mac OS.
    r�Nrr�\z!nothing known about platform '%s')rrr5�isabsr6�
splitdriver)Znew_rootr7Zdriver5r+r+r,�change_root|s

r>c	CsxtrdStjdkrZdtjkrZy$ddl}|�t���dtjd<Wnttfk
rXYnXdtjkrpt	�tjd<dadS)aLEnsure that 'os.environ' has all the environment variables we
    guarantee that users can use in config files, command-line options,
    etc.  Currently this includes:
      HOME - user's home directory (Unix only)
      PLAT - description of the current platform, including hardware
             and OS (see 'get_platform()')
    Nr�HOMErrZPLATr:)
�_environ_checkedrrr�pwd�getpwuid�getuid�ImportError�KeyErrorr-)rAr+r+r,�
check_environ�s	
rFc
CsTt�|fdd�}yt�d||�Stk
rN}ztd|��Wdd}~XYnXdS)a�Perform shell/Perl-style variable substitution on 'string'.  Every
    occurrence of '$' followed by a name is considered a variable, and
    variable is substituted by the value found in the 'local_vars'
    dictionary, or in 'os.environ' if it's not in 'local_vars'.
    'os.environ' is first checked/augmented to guarantee that it contains
    certain values: see 'check_environ()'.  Raise ValueError for any
    variables not found in either 'local_vars' or 'os.environ'.
    cSs,|�d�}||krt||�Stj|SdS)Nr:)r%�strrr)r$�
local_varsZvar_namer+r+r,�_subst�s
zsubst_vars.<locals>._substz\$([a-zA-Z_][a-zA-Z_0-9]*)zinvalid variable '$%s'N)rFr!�subrEr1)�srHrI�varr+r+r,�
subst_vars�s	rM�error: cCs|t|�S)N)rG)�exc�prefixr+r+r,�grok_environment_error�srQcCs(t�dtj�at�d�at�d�adS)Nz
[^\\\'\"%s ]*z'(?:[^'\\]|\\.)*'z"(?:[^"\\]|\\.)*")r!r"�string�
whitespace�
_wordchars_re�
_squote_re�
_dquote_rer+r+r+r,�_init_regex�s
rWcCs�tdkrt�|��}g}d}�x`|�r�t�||�}|��}|t|�kr\|�|d|��P||tjkr�|�|d|��||d��	�}d}n�||dkr�|d|�||dd�}|d}n�||dkr�t
�||�}n*||dkr�t�||�}ntd||��|dk�r"t
d||��|��\}}|d|�||d|d�||d�}|��d	}|t|�kr"|�|�Pq"W|S)
aSplit a string up according to Unix shell-like rules for quotes and
    backslashes.  In short: words are delimited by spaces, as long as those
    spaces are not escaped by a backslash, or inside a quoted string.
    Single and double quotes are equivalent, and the quote characters can
    be backslash-escaped.  The backslash is stripped from any two-character
    escape sequence, leaving only the escaped character.  The quote
    characters are stripped from any quoted string.  Returns a list of
    words.
    Nrr;r:�'�"z!this can't happen (bad char '%c')z"bad string (mismatched %s quotes?)r)rTrW�stripr$�end�len�appendrRrS�lstriprUrV�RuntimeErrorr1�span)rKZwords�posr)r[Zbegr+r+r,�split_quoted�s@


,
rbcCsP|dkr6d|j|f}|dd�dkr6|dd�d}t�|�|sL||�dS)a�Perform some action that affects the outside world (eg.  by
    writing to the filesystem).  Such actions are special because they
    are disabled by the 'dry_run' flag.  This method takes care of all
    that bureaucracy for you; all you have to do is supply the
    function to call and an argument tuple for it (to embody the
    "external action" being performed), and an optional message to
    print.
    Nz%s%r���z,)r�))�__name__r�info)�func�args�msg�verbose�dry_runr+r+r,�executes	
rlcCs2|��}|dkrdS|dkr dStd|f��dS)z�Convert a string representation of truth to true (1) or false (0).

    True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values
    are 'n', 'no', 'f', 'false', 'off', and '0'.  Raises ValueError if
    'val' is anything else.
    )�yZyes�t�trueZon�1r:)�nZno�fZfalseZoff�0rzinvalid truth value %rN)rr1)�valr+r+r,�	strtobool&srur:cCsRddl}tjrtd��|dkr*do(|dk}|�s8yddlm}	|	d�\}
}Wn.tk
rzddlm}d|d�}
}YnXt�	d|�|s�|
dk	r�t
�|
d	�}
n
t|d	�}
|
�
d
�|
�
d�tt|��d�|
�
d
|||||f�|
��tjg}|�|���|�|�t||d�tt
j|fd||d��nddlm}�x|D]�}|dd�dk�rf�qL|dk�r�|dk�r~dn|}tjj||d�}ntj�|�}|}|�r�|dt|��|k�r�td||f��|t|�d�}|�r�t
j �||�}t
j �!|�}|�rL|�st"||��r:t�	d||�|�sH||||�nt�#d||��qLWdS)a~Byte-compile a collection of Python source files to .pyc
    files in a __pycache__ subdirectory.  'py_files' is a list
    of files to compile; any files that don't end in ".py" are silently
    skipped.  'optimize' must be one of the following:
      0 - don't optimize
      1 - normal optimization (like "python -O")
      2 - extra optimization (like "python -OO")
    If 'force' is true, all files are recompiled regardless of
    timestamps.

    The source filename encoded in each bytecode file defaults to the
    filenames listed in 'py_files'; you can modify these with 'prefix' and
    'basedir'.  'prefix' is a string that will be stripped off of each
    source filename, and 'base_dir' is a directory name that will be
    prepended (after 'prefix' is stripped).  You can supply either or both
    (or neither) of 'prefix' and 'base_dir', as you wish.

    If 'dry_run' is true, doesn't actually do anything that would
    affect the filesystem.

    Byte-compilation is either done directly in this interpreter process
    with the standard py_compile module, or indirectly by writing a
    temporary script and executing it.  Normally, you should let
    'byte_compile()' figure out to use direct compilation or not (see
    the source for details).  The 'direct' flag is used by the script
    generated in indirect mode; unless you know what you're doing, leave
    it set to None.
    rNzbyte-compiling is disabled.F)�mkstempz.py)�mktempz$writing byte-compilation script '%s'�wz2from distutils.util import byte_compile
files = [
z,
z]
z�
byte_compile(files, optimize=%r, force=%r,
             prefix=%r, base_dir=%r,
             verbose=%r, dry_run=0,
             direct=1)
)rkzremoving %s)r"���r)�optimizationz1invalid prefix: filename %r doesn't start with %rzbyte-compiling %s to %sz%skipping byte-compilation of %s to %s)$�
subprocessr�dont_write_bytecoderZtempfilervrDrwrrfr�fdopen�open�writer6�map�repr�close�
executable�extendZ"_optim_args_from_interpreter_flagsr]rrlr3�
py_compiler"�	importlib�util�cache_from_sourcer\r1r5�basenamer�debug)Zpy_files�optimizeZforcerPZbase_dirrjrkZdirectr{rvZ	script_fdZscript_namerwZscript�cmdr"�fileZopt�cfile�dfileZ
cfile_baser+r+r,�byte_compile6sl$


r�cCs|�d�}d}|�|�S)z�Return a version of the string escaped for inclusion in an
    RFC-822 header, by ensuring there are 8 spaces space after each newline.
    �
z	
        )r2r6)�header�linesr0r+r+r,�
rfc822_escape�s
r�cCsV|sdSddlm}m}Gdd�d|�}|dkr8|d�}|||d�}|j|dd	�dS)
aInvoke 2to3 on a list of Python files.
    The files should all come from the build area, as the
    modification is done in-place. To reduce the build time,
    only files modified since the last invocation of this
    function should be passed in the files argument.Nr)�RefactoringTool�get_fixers_from_packagec@s$eZdZdd�Zdd�Zdd�ZdS)z*run_2to3.<locals>.DistutilsRefactoringToolc_stj|f|��dS)N)r�error)�selfrirh�kwr+r+r,�	log_error�sz4run_2to3.<locals>.DistutilsRefactoringTool.log_errorcWstj|f|��dS)N)rrf)r�rirhr+r+r,�log_message�sz6run_2to3.<locals>.DistutilsRefactoringTool.log_messagecWstj|f|��dS)N)rr�)r�rirhr+r+r,�	log_debug�sz4run_2to3.<locals>.DistutilsRefactoringTool.log_debugN)re�
__module__�__qualname__r�r�r�r+r+r+r,�DistutilsRefactoringTool�sr�z
lib2to3.fixes)�optionsT)r)Zlib2to3.refactorr�r�Zrefactor)�files�fixer_namesr��explicitr�r�r��rr+r+r,�run_2to3�s
r�c	Csddlm}ddlm}ddlm}|�}	t��}
t�|�z|	�	�Wdt�|
�X|	j
|	jdd�<|r�x(|��D]}|�
�}|s�qt|	�|�qtWg}xV|	jD]L}
tj�||
�}|tj�|��|tj�||
�|dd�}|dr�|�|�q�Wtdd	�|D�|||d
�|S)z�Recursively copy a directory, only copying new and changed files,
    running run_2to3 over all newly copied Python modules afterward.

    If you give a template string, it's parsed like a MANIFEST.in.
    r)�mkpath)�	copy_file)�FileListNr:)�updatecSsg|]}|���d�r|�qS)z.py)r�endswith)�.0�fnr+r+r,�
<listcomp>sz$copydir_run_2to3.<locals>.<listcomp>)r�r�r�)Zdistutils.dir_utilr�Zdistutils.file_utilr�Zdistutils.filelistr�r�getcwd�chdir�findallZallfilesr��
splitlinesrZZprocess_template_liner5r6�dirnamer]r�)�src�dest�templater�r�r�r�r�r�Zfilelistr4�lineZcopied�filenameZoutnameZresr+r+r,�copydir_run_2to3�s4
r�c@s$eZdZdZdZdZdZdd�ZdS)�	Mixin2to3z�Mixin class for commands that run 2to3.
    To configure 2to3, setup scripts may either change
    the class variables, or inherit from individual commands
    to override how 2to3 is invoked.NcCst||j|j|j�S)N)r�r�r�r�)r�r�r+r+r,r�"szMixin2to3.run_2to3)rer�r��__doc__r�r�r�r�r+r+r+r,r�s
r�)rN)Nrr)rrNNr:rN)NNN)NNNN)#r�rr!�importlib.utilr�rRrZdistutils.errorsrZdistutils.dep_utilrZdistutils.spawnrr*rrr-r9r>r@rFrMrQrTrUrVrWrbrlrur�r�r�r�r�r+r+r+r,�<module>s@N
=