Your IP : 3.145.73.167


Current Path : /opt/alt/python311/lib64/python3.11/distutils/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/distutils/__pycache__/util.cpython-311.pyc

�

c��f(R���dZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
mZddlm
Z
ddlmZddlmZd�Zd	�Zd
�Zd�Zdad�Zd
�Zdd�Zdxaxaad�Zd�Zdd�Zd�Z				dd�Zd�Z dd�Z!		dd�Z"Gd�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��tjdkrrdtj���vrdSdtj���vrdSdtj���vrdStjSdtjvrtjdStjd	ksttd
��stjStj��\}}}}}|����	dd��}|�	d
d��}|�	dd��}|dd�dkr|�d|��S|dd�dkrQ|ddkrDd}dt|d��dz
|dd�fz}ddd�}|d|tjzz
}n�|dd�dkrddlm
}|��S|dd �d!krMd!}tjd"tj��}|�|��}|r|���}nI|dd �d#kr;ddl}	ddl}
|	�|
j���|||��\}}}|�d|�d|��S)$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'.

    �nt�amd64�	win-amd64z(arm)�	win-arm32z(arm64)z	win-arm64�_PYTHON_HOST_PLATFORM�posix�uname�/�� �_�-N��linux�sunosr�5�solarisz%d.%s���32bit�64bit)i���l����z.%s�aix)�aix_platform��cygwinz[\d.]+�darwin)�os�name�sys�version�lower�platform�environ�hasattrr�replace�int�maxsize�_aix_supportr�re�compile�ASCII�match�group�_osx_support�distutils.sysconfig�get_platform_osx�	sysconfig�get_config_vars)�osname�host�releaser&�machine�bitnessr�rel_re�mr4�	distutilss           �5/opt/alt/python311/lib64/python3.11/distutils/util.py�get_host_platformrBs���(
�w�$����c�k�'�'�)�)�)�)��;��c�k�'�'�)�)�)�)��;����)�)�+�+�+�+��;��|���"�*�,�,��z�1�2�2�	�w�'�����W�!5�!5���|��13��
�
�-�V�T�7�G�W��\�\�^�^�
#�
#�C��
,�
,�F��o�o�c�3�'�'�G��o�o�c�3�'�'�G�
�b�q�b�z�W���"�6�6�7�7�+�+�	�����w�	�	��1�:�����F���W�Q�Z���1�!4�g�a�b�b�k� B�B�G�#*�w�G�G�G��u�w�s�{�3�3�3�G��	�����u�	�	�-�-�-�-�-�-��|�~�~��	�����x�	�	�����Y���1�1���L�L��!�!���	 ��g�g�i�i�G��	�����x�	�	�0�0�0�0�0�0�0�0�#/�#@�#@�(1�(;�(K�(K�(M�(M�(.���$B�$B� ���� ������'�'�2�2�c���tjdkrFdddd�}|�tj�d����p
t	��St	��S)Nr	�win32rr)�x86�x64�arm�VSCMD_ARG_TGT_ARCH)r#r$�getr)rB)�TARGET_TO_PLATs rA�get_platformrLcs_��	�w�$������
�
��
�!�!�"�*�.�.�1E�"F�"F�G�G�^�K\�K^�K^�^� �"�"�"rCc�L�tjdkr|S|s|S|ddkrtd|z���|ddkrtd|z���|�d��}d|vr|�d��d|v�|stjStjj|�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.
    rrzpath '%s' cannot be absolute���zpath '%s' cannot end with '/'�.)r#�sep�
ValueError�split�remove�curdir�path�join)�pathname�pathss  rA�convert_pathrYns���
�v��}�}���������{�c����7�(�B�C�C�C���|�s����8�8�C�D�D�D��N�N�3���E�

��,�,�
���S������,�,����y��
�7�<���rCc��tjdkrgtj�|��s tj�||��Stj�||dd���StjdkrXtj�|��\}}|ddkr
|dd�}tj�||��St
dtjz���)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�Nr	r�\z!nothing known about platform '%s')r#r$rU�isabsrV�
splitdriver)�new_rootrW�driverUs    rA�change_rootra�s���
�w�'����w�}�}�X�&�&�	8��7�<�<��(�3�3�3��7�<�<��(�1�2�2�,�7�7�7�	��D�����*�*�8�4�4�
�����7�d�?�?�����8�D��w�|�|�H�d�+�+�+�%�%H�2�7�%R�S�S�SrCc�V�trdStjdkrddtjvrV	ddl}|�tj����dtjd<n#ttf$rYnwxYwdtjvrt��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�HOMErr�PLATr[)
�_environ_checkedr#r$r)�pwd�getpwuid�getuid�ImportError�KeyErrorrL)rfs rA�
check_environrk�s�������	�w�'���f�B�J�6�6�	��J�J�J�!$���b�i�k�k�!:�!:�1�!=�B�J�v�����X�&�	�	�	�
�D�	����
�R�Z���)�^�^��
�6�����s�=A'�'A;�:A;c��t��|fd�}	tjd||��S#t$r}t	d|z���d}~wwxYw)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'.
    c��|�d��}||vrt||��Stj|S)Nr[)r3�strr#r))r2�
local_vars�var_names   rA�_substzsubst_vars.<locals>._subst�s<���;�;�q�>�>���z�!�!��z�(�+�,�,�,��:�h�'�'rCz\$([a-zA-Z_][a-zA-Z_0-9]*)zinvalid variable '$%s'N)rkr/�subrjrQ)�srorq�vars    rA�
subst_varsru�sq���O�O�O�",�(�(�(�(�9��v�3�V�Q�?�?�?���9�9�9��1�C�7�8�8�8�����9���s�+�
A�A�A�error: c�&�|t|��zS�N)rn)�exc�prefixs  rA�grok_environment_errorr{�s���C��H�H��rCc��tjdtjz��atjd��atjd��adS)Nz
[^\\\'\"%s ]*z'(?:[^'\\]|\\.)*'z"(?:[^"\\]|\\.)*")r/r0�string�
whitespace�
_wordchars_re�
_squote_re�
_dquote_re�rCrA�_init_regexr��s>���J�/�&�2C�C�D�D�M���0�1�1�J���0�1�1�J�J�JrCc�"�t�t��|���}g}d}|�r�t�||��}|���}|t|��kr|�|d|����n}||tjvr=|�|d|���||d��	��}d}�n||dkr|d|�||dzd�z}|dz}n�||dkrt�||��}n@||dkrt�||��}ntd||z���|�td||z���|���\}}|d|�||dz|dz
�z||d�z}|���d	z
}|t|��kr|�|��n|���|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)rr��stripr2�end�len�appendr}r~�lstripr�r��RuntimeErrorrQ�span)rs�words�posr?r��begs      rA�split_quotedr��s����k�m�m�m�	���	�	�A��E�
�C�
�"�����3�'�'���e�e�g�g���#�a�&�&�=�=��L�L��4�C�4��!�!�!���S�6�V�&�&�&��L�L��4�C�4��!�!�!��#�$�$���� � �A��C�C�
�s�V�t�^�^��$�3�$��!�C��E�F�F�)�#�A��a�%�C�C���v��}�}��$�$�Q��,�,����3��3����$�$�Q��,�,���"�#F��3��#O�P�P�P��y� �!E��#��!N�O�O�O������J�S�#��$�3�$��!�C��E�#�a�%�K�.�(�1�S�T�T�7�2�A��%�%�'�'�A�+�C��#�a�&�&�=�=��L�L��O�O�O��E�"�H�LrCc��|�&|j�|��}|dd�dkr
|dd�dz}tj|��|s||�dSdS)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.
    N���z,)r�))�__name__r�info)�func�args�msg�verbose�dry_runs     rA�executer�!sk���{��
�
�t�t�,���r�s�s�8�t����a��d�)�c�/�C��H�S�M�M�M�����d������rCc�f�|���}|dvrdS|dvrdStd|�����)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.
    )�y�yes�t�true�on�1r[)�n�no�f�false�off�0rzinvalid truth value )r'rQ)�vals rA�	strtoboolr�4sH���)�)�+�+�C�
�2�2�2��q�	�5�	5�	5��q��j�S�S�:�;�;�;rCr[c�F�ddl}tjrtd���|�|dk}|�s�	ddlm}	|	d��\}
}n##t$rddlm}d|d��}}
YnwxYwtj	d|��|s�|
�tj|
d	��}
nt|d	��}
|
5|
�
d
��|
�
d�tt |����dz��|
�
d
|�d|�d|�d|�d|�d���ddd��n#1swxYwYt"j}tjg}|�|�����|�d|�d���|�|��t/||���t1tj|fd|z|���dSddlm}|D�]@}|dd�dkr�|dkr,|dkrdn|}t8j�||���}nt8j�|��}|}|rG|dt?|���|krtAd|�d|�����|t?|��d�}|r tj!�||��}tj!�"|��}|rO|stG||��r'tj	d||��|s
||||����*tj$d||����BdS)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.T)�mkstemp�.py)�mktempz$writing byte-compilation script '%s'�wz2from distutils.util import byte_compile
files = [
z,
z]
z
byte_compile(files, optimize=z, force=z,
             prefix=z, base_dir=z,
             verbose=z$, dry_run=0,
             direct=1)
z	-Wignore:z:DeprecationWarning)r�zremoving %s)r0���r)�optimizationzinvalid prefix: filename z doesn't start with zbyte-compiling %s to %sz%skipping byte-compilation of %s to %s)%�
subprocessr%�dont_write_bytecoder�tempfiler�rir�rr�r#�fdopen�open�writerV�map�reprr@�_DEPRECATION_MESSAGE�
executable�extend�"_optim_args_from_interpreter_flagsr�rr�rS�
py_compiler0�	importlib�util�cache_from_sourcer�rQrU�basenamer�debug)�py_files�optimize�forcerz�base_dirr�r��directr�r��	script_fd�script_namer��scriptr��cmdr0�file�opt�cfile�dfile�
cfile_bases                      rA�byte_compiler�Ds"��H������G�'�(E�F�F�F��~� (�A�
���Z0�	;�(�(�(�(�(�(�'.�w�u�~�~�$�Y�����	;�	;�	;�'�'�'�'�'�'�'+�V�V�E�]�]��Y�Y�Y�	;����	��7��E�E�E�� 	4��$���9�c�2�2����k�3�/�/���
4�
4��������&���U�Z�Z��D�(�(;�(;�<�<�u�D�E�E�E�����
�x�x����������'�'�'�3�4�4�4�+
4�
4�
4�
4�
4�
4�
4�
4�
4�
4�
4����
4�
4�
4�
4�8�,���~����
�
�:�@�@�B�B�C�C�C��
�
�7�s�7�7�7�8�8�8��
�
�;����
�c�7�#�#�#�#���	�K�>�=�;�+F��	!�	!�	!�	!�	!�	!�	'�&�&�&�&�&�� 	0� 	0�D��B�C�C�y�E�!�!��
�1�}�}�$��M�M�b�b�x��!��8�8��s�9�,�,���"��8�8��>�>���E��
,����V����%��/�/�$�*�"�d�d�F�F�&,�-�-�-��c�&�k�k�l�l�+���
6�����X�u�5�5����)�)�%�0�0�J��
0��0�E�$��.�.�0��H�6��j�I�I�I�"�4����e�U�3�3�3���I�E�"�J�0�0�0��? 	0� 	0s$�A�A!� A!�%A9D*�*D.�1D.c�Z�|�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	
        )rRrV)�header�linesrPs   rA�
rfc822_escaper��s*��
�L�L����E�
�C��8�8�E�?�?�rCc��|sdSddlm}m}Gd�d|��}|�|d��}|||���}|�|d�	��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� �eZdZd�Zd�Zd�ZdS)�*run_2to3.<locals>.DistutilsRefactoringToolc�*�tj|g|�R�dSrx)r�error)�selfr�r��kws    rA�	log_errorz4run_2to3.<locals>.DistutilsRefactoringTool.log_error�� ���I�c�!�D�!�!�!�!�!�!rCc�*�tj|g|�R�dSrx)rr��r�r�r�s   rA�log_messagez6run_2to3.<locals>.DistutilsRefactoringTool.log_message�s ���H�S� �4� � � � � � rCc�*�tj|g|�R�dSrx)rr�r�s   rA�	log_debugz4run_2to3.<locals>.DistutilsRefactoringTool.log_debug�r�rCN)r��
__module__�__qualname__r�r�r�r�rCrA�DistutilsRefactoringToolr��sA������	"�	"�	"�	!�	!�	!�	"�	"�	"�	"�	"rCr�z
lib2to3.fixes)�optionsT)r�)�lib2to3.refactorr�r��refactor)�files�fixer_namesr��explicitr�r�r��rs        rA�run_2to3r��s�������J�I�I�I�I�I�I�I�"�"�"�"�"�?�"�"�"���-�-�o�>�>�� � ��g�>�>�>�A��J�J�u�D�J�!�!�!�!�!rCc�2�ddlm}ddlm}ddlm}|��}	t
j��}
t
j|��	|	�	��t
j|
��n#t
j|
��wxYw|	j
|	jdd�<|rC|���D].}|�
��}|s�|	�|���/g}|	jD]�}
tj�||
��}|tj�|����|tj�||
��|d���}|dr|�|����t'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[)�updatec�`�g|]+}|����d���)|��,S)r�)r'�endswith)�.0�fns  rA�
<listcomp>z$copydir_run_2to3.<locals>.<listcomp>s3��
@�
@�
@�R�R�X�X�Z�Z�%8�%8��%?�%?�
@�b�
@�
@�
@rC)r�r�r�)�distutils.dir_utilr��distutils.file_utilr��distutils.filelistr�r#�getcwd�chdir�findall�allfilesr��
splitlinesr��process_template_linerUrV�dirnamer�r�)�src�dest�templater�r�r�r�r�r��filelistrT�line�copied�filename�outname�ress                rA�copydir_run_2to3rs���*�)�)�)�)�)�-�-�-�-�-�-�+�+�+�+�+�+��x�z�z�H�
�Y�[�[�F��H�S�M�M�M��������
������������������ �)�H�N�1�1�1���1��'�'�)�)�	1�	1�D��:�:�<�<�D��!���*�*�4�0�0�0�0�
�F��N�*�*���'�,�,�t�X�.�.����r�w���w�'�'�(�(�(��i�����S�(�3�3�W�Q�G�G�G���q�6�)�6�=�=��)�)�)���
@�
@�6�
@�
@�
@�$�g��J�J�J�J��Ms�A.�.Bc�$�eZdZdZdZdZdZd�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.Nc�D�t||j|j|j��Srx)r�r�r�r�)r�r�s  rAr�zMixin2to3.run_2to31s����t�/���t�}�M�M�MrC)r�r�r��__doc__r�r�r�r�r�rCrArr!sG������(�(��K��G��H�N�N�N�N�NrCr)rv)Nrr)rrNNr[rN)NNN)NNNN)$rr#r/�importlib.utilr�r}r%r@�distutils.errorsr�distutils.dep_utilr�distutils.spawnrrrrBrLrYrarerkrur{rr�r�r�r�r�r�r�r�r�rrr�rCrA�<module>rs����
�	�	�	�	�	�	�	�����
�
�
�
�
�
�
�
�����3�3�3�3�3�3�$�$�$�$�$�$�!�!�!�!�!�!�������6�6�6�6�6�6�N3�N3�N3�`	#�	#�	#� � � �8T�T�T�,�����69�9�9�2����+/�.�
�.�
�Z�2�2�2�8�8�8�z����&
<�
<�
<�"%&�(,�%&��	S0�S0�S0�S0�n���"�"�"�"�6<@�,0�����BN�N�N�N�N�N�N�N�N�NrC

?>