Viewing File: /opt/hc_python/lib/python3.12/site-packages/build/__pycache__/__main__.cpython-312.pyc

�

i0i�<���ddlmZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlmZmZddlmZddlmZmZddlZddlmZmZddlmZdd	lmZmZm Z dd
l!m"Z"m#Z#m$Z$ddlm%Z%dd
dddddd�Z&e'jQe&d�Z)ejTde&��Z+d1d�Z,d2d3d�Z-		d4													d5d�Z.ej^�j`dz
Z1e1dkrdZ1eejdde1��Z3dd�d6d�Z4d7d �Z5d8d9d!�Z6d:d"�Z7												d;d#�Z8	d<											d=d$�Z9																d>d%�Z:ejvd?d&��Z<d@d'�Z=				dA															dBd(�Z>				dA															dBd)�Z?dCd*�Z@dDdEd+�ZAd1d,�ZBeCd-k(reAe
j�ddd.�d/d0gZEy)F�)�annotationsN)�Iterator�Sequence)�partial)�NoReturn�TextIO�)�ProjectBuilder�_ctx)�env)�BuildBackendException�BuildException�FailedProcessError)�ConfigSettings�Distribution�StrPath)�DefaultIsolatedEnvzzzzzzz)�red�green�yellow�bold�dim�	underline�reset��_styles)�defaultc�B�dtjvrCdtjvrtjdd��tjt�n1dtjvstjj�rytjt�y)N�NO_COLOR�FORCE_COLORzLBoth NO_COLOR and FORCE_COLOR environment variables are set, disabling color�)�
stacklevel)
�os�environ�warnings�warnr�set�
_NO_COLORS�sys�stdout�isatty���=/opt/hc_python/lib/python3.12/site-packages/build/__main__.py�_init_colorsr//s`���R�Z�Z���B�J�J�&��M�M�h�uv�w����J��	�"�*�*�	$��
�
�(9�(9�(;���K�K�
�r-c�f�t|j|fitj���|d��y)NT)�file�flush)�print�formatr�get)�fmt�msgr1s   r.�_cprintr89s$��	�*�#�*�*�S�
*�G�K�K�M�
*��T�Br-c�.�tdt|��y)Nz{yellow}WARNING{reset} {})r8�str)�message�category�filename�linenor1�lines      r.�_showwarningr@=s���'��W��6r-r!�N�  )�subsequent_indent�width)�originc�P�|�G|j�^}}tdt|d���|D]}tt|d����y|ddk(rU|ddk(rd	nd
}|ddk(rtj
nd}|j�D]}tdt||��|�
��yy)Nz{bold}{}{reset}z* )�initial_indentrBr�
subprocessr	�cmdz> z< �stderrz{dim}{}{reset})r1)�
splitlinesr8�_fillr3r)rJ)r;rE�first�restr?rGr1s       r.�_logrOPs���
�~� �+�+�-�����!�5��t�#D�E��D��%��T�2�3��
���l�	"�!'���e�!3����#�A�Y�(�2�s�z�z����&�&�(�D��$�e�D��&P�W[�\�)�
#r-c�0�tt_tj�dk(r	ddl}|j
�t�tjjt�tjj|�y#t$rY�XwxYw)N�Windowsr)r@r%�showwarning�platform�system�colorama�init�ModuleNotFoundErrorr/r�LOGGERr'rO�	VERBOSITY)�	verbosityrUs  r.�
_setup_clir[^sg��'�H������I�%�	���M�M�O��N��K�K�O�O�D���N�N���y�!��
#�	��	�s�B	�		B�Bc�0�td|�t|��)z�
    Print an error message and exit. Will color the output when writing to a TTY.

    :param msg: Error message
    :param code: Error code
    z{red}ERROR{reset} {})r8�
SystemExit)r7�codes  r.�_errorr_os���"�C�(�
�T�
�r-c�2�djd�|D��S)Nz -> c3�`K�|]&}|jd�dj����(y�w)�;rN)�	partition�strip)�.0�deps  r.�	<genexpr>z$_format_dep_chain.<locals>.<genexpr>{s(����J�	��s�}�}�S�)�!�,�2�2�4�	�s�,.)�join)�	dep_chains r.�_format_dep_chainrjzs���;�;�J�	�J�J�Jr-c� �t|��5}tj||�}|j|j�|j|j||xsi��|j
|||xsi�cddd�S#1swYyxYw)N)�	installer)rr
�from_isolated_env�install�build_system_requires�get_requires_for_build�build)�srcdir�outdir�distribution�config_settingsrlr�builders       r.�_build_in_isolated_envrw~sr��
�i�	0�C� �2�2�3��?�����G�1�1�2����G�2�2�<��AV�TV�W�X��}�}�\�6�?�3H�b�I�

1�	0�	0�s�A-B�B
c���t|�}|sH|j||xsi�}|r0djd�|D��}t�t	d|���|j|||xsi�S)Nrc3�\K�|]$}|dt|dd�fD]}|s�d|z����&y�w)rr	Nz
	)rj)re�depsrfs   r.rgz(_build_in_current_env.<locals>.<genexpr>�s=����"}�G�D�PT�UV�PW�Yj�ko�pq�pr�ks�Yt�Ou��y|�6�C�<�Ou�<�G�s�,�,zMissing dependencies:)r
�check_dependenciesrhr8r_rq)rrrsrtru�skip_dependency_checkrv�missing�dependenciess        r.�_build_in_current_envr�sl���V�$�G� ��,�,�\�?�;P�b�Q����7�7�"}�G�"}�}�L��I��*�<�.�9�:��=�=��v��/D�"�E�Er-c�B�|rt|||||�St|||||�S�N)rwr)�	isolationrrrsrtrur|rls       r.�_buildr��s/���%�f�f�l�O�U^�_�_�$�V�V�\�?�Ti�j�jr-c#�K�	d��y#ttf$r}tt|��Yd}~yd}~wt$r�}t|jtj�rt�tt|��|jrRtj|jd|jd|jdd��}dj|�}ntjd�}td|jd��tt|��Yd}~yd}~wt $rM}tj�jd�}td|�tt|��Yd}~yd}~wwxYw�w)	Nrr	r!���)�limitrz
{dim}{}{reset}
�
)rrr_r:r
�
isinstance�	exceptionrH�CalledProcessErrorr8�exc_info�	traceback�format_exceptionrh�
format_excrd�	Exception)�e�tb_lines�tbs   r.�_handle_build_errorr��s�����
���.�/���s�1�v���� ���a�k�k�:�#@�#@�A��I��3�q�6�N��:�:� �1�1��
�
�1�
��
�
�1�
��
�
�1�
��	�H�����"�B��%�%�b�)�B��$�b�h�h�t�n�5��s�1�v������
�
!�
!�
#�
)�
)�$�
/���$�b�)��s�1�v�����sL�F�	�F�E?�1�F�E?�C$D&�!F�&E?�2AE:�5F�:E?�?Fc��t|�dk(r
d}t|��t|�dk(r|dSdjdj|dd�|d�S)Nrzno elementsr	z	{} and {}z, r�)�len�
IndexErrorr4rh)�elementsr7s  r.�_natural_language_listr��s_��
�8�}�������o��	�X��!�	���{���!�!��I�I�h�s��m�$��R�L�
�	
r-c
��g}|D]A}t|||||||�}	|jtjj	|	���C|S)a�
    Run the build process.

    :param srcdir: Source directory
    :param outdir: Output directory
    :param distribution: Distribution to build (sdist or wheel)
    :param config_settings: Configuration settings to be passed to the backend
    :param isolation: Isolate the build in a separate environment
    :param skip_dependency_check: Do not perform the dependency check
    )r��appendr#�path�basename)
rrrs�
distributionsrur�r|rl�builtrt�outs
          r.�
build_packager��sM��&�E�%���Y����o�Od�fo�p��
���R�W�W�%�%�c�*�+�&��Lr-c���ddlm}d|vr
d}t|��t|||d|||�}	tj
j
|	�}
tjd��}g}|r�|jj|	�5}
|
j|�	tjdt|��d��tj
j||
d	t!d
��}|D]A}t|||||||�}|j#tj
j
|���C	t%j&|d��	d	d	d	�|
g|�S#t%j&|d��wxYw#1swY�*xYw)
a�
    Build a sdist and then the specified distributions from it.

    :param srcdir: Source directory
    :param outdir: Output directory
    :param distribution: Distribution to build (only wheel)
    :param config_settings: Configuration settings to be passed to the backend
    :param isolation: Isolate the build in a separate environment
    :param skip_dependency_check: Do not perform the dependency check
    r	)�tarfile�sdistz=Only binary distributions are allowed but sdist was specifiedzbuild-via-sdist-)�prefixz	Building z from sdistNz.tar.gzT)�
ignore_errors)�_compatr��
ValueErrorr�r#r�r��tempfile�mkdtemp�TarFile�open�
extractallr�logr�rhr�r��shutil�rmtree)rrrsr�rur�r|rlr�r7r��
sdist_name�	sdist_outr��trtr�s                r.�build_package_via_sdistr��sC��&!��-��M����o���9�f�f�g��H]�_h�i�E����!�!�%�(�J�� � �(:�;�I��E��
�_�_�
!�
!�%�
(�A�
�L�L��#�
=����9�%;�M�%J�$K�;�W�X������i��<M�s�9�~�o�1N�O��$1�L� ��F�F�L�/�[p�r{�|�C��L�L����!1�!1�#�!6�7�%2��
�
�i�t�<�)�
�������
�
�i�t�<��)�
(�s%�=E'�BE�&E'�E$�$E'�'E0c��ttjttd���}t
jdk\r
t|d��}ttjtjtjd�j�d�|��}t
jdk\rt|dd�	�}|�}|jd
tdtj�d�
�|jddddt j"�ddj%t j&��d���|jdddddd��|jdddd d!d"�#�|jd$d%dd d&d'�#�|jd(d)td*tj(�d+�d,�-�|jd.d/d0d1�2�|j+�}|jd3d4d0d5�2�|jd6t,j.d7�8�|j+�}|jd9d:d;d<d=d>�?�|jd@dAdBdC�D�|S)Ez$
    Construct the main parser.
    �)rD)��T)�colora�
                A simple, correct Python build frontend.

                By default, a source distribution (sdist) is built from {srcdir}
                and a binary distribution (wheel) is built from the sdist.
                This is recommended as it will ensure the sdist can be used
                to build wheels.

                Pass -s/--sdist and/or -w/--wheel to build a specific distribution.
                If you do this, the default behavior will be disabled, and all
                artifacts will be built from {srcdir} (even if you combine
                -w/--wheel with -s/--sdist, the wheel will be built from {srcdir}).
                z    )�description�formatter_class)�suggest_on_errorr�rr�?z0source directory (defaults to current directory))�type�nargsr�helpz	--versionz-V�versionzbuild z (�,�))�actionr�z	--verbosez-vrZ�countrzincrease verbosity)�destr�rr�z--sdistz-sr��append_constr�z;build a source distribution (disables the default behavior))r�r��constr�z--wheelz-w�wheelz-build a wheel (disables the default behavior)z--outdirz-oz&output directory (defaults to {srcdir}zdist)�PATH)r�r��metavarz--skip-dependency-checkz-x�
store_truez2do not check that build dependencies are installed)r�r�z--no-isolationz-nz�disable building the project in an isolated virtual environment. Build dependencies must be installed separately when this option is usedz--installerz1Python package installer to use (defaults to pip))�choicesr�z--config-settingz-Crur�z�settings to pass to the backend.  Multiple settings can be provided. Settings beginning with a hyphen will erroneously be interpreted as options to build if separated by a space character; use ``--config-setting=--my-setting -C--my-other-setting``zKEY[=VALUE])r�r�r�r�z
--config-json�config_jsonz�settings to pass to the backend as a JSON object. This is an alternative to --config-setting that allows complex nested structures. Cannot be used together with --config-setting�JSON_STRING)r�r�r�)r�argparse�RawDescriptionHelpFormatter�min�_max_terminal_widthr)�version_info�ArgumentParser�textwrap�indent�dedentrd�add_argumentr:r#�getcwdrq�__version__rh�__path__�sep�add_mutually_exclusive_group�_env�
INSTALLERS)r��make_parser�parser�	env_group�config_groups     r.�main_parserr�!s����h�B�B�#�Na�cf�Jg�h�O�
���7�"�!�/��>�������O�O��O�O��
��e�g��!
�((�-�K�0���7�"��k�D��M��
�]�F�
����
���	�	��
?�����������*�*�+�2�c�h�h�u�~�~�.F�-G�q�I�	�������
���
!�
�������
���
J�
�������
���
<�
�������
�7����x�u�
E�������!���
A�	���3�3�5�I�
������S�	���������
@���
�6�6�8�L������
��[���	�����
�8��
���Mr-c�H�t�}|r||_|j|�}t|j��i}|j
r<	t
j|j
�}t|t�std�nl|jr`|jD]Q}|jd�\}}}	||vr|	||<�"t||t�s	||g||<||j|	��S|j �*t"j$j'|j(d�n|j }
|j*}|rt,}n	t.}dg}t1�5||j(|
|||j2|j4|j6�}
t9|
D�cgc]'}dj:|fit<j?�����)c}�}tAd	|�ddd�y#tj$r}td|���Yd}~��d}~wwxYwcc}w#1swYyxYw)
z�
    Parse the CLI arguments and invoke the build process.

    :param cli_args: CLI arguments
    :param prog: Program name to show in help text
    )rZzN--config-json must contain a JSON object (dict), not a list or primitive valuezInvalid JSON in --config-json: N�=�distr�z!{underline}{}{reset}{bold}{green}z){bold}{green}Successfully built {}{reset})!r��prog�
parse_argsr[rZr��json�loadsr��dictr_�JSONDecodeErrorrurc�listr�rsr#r�rhrrr�r�r�r��no_isolationr|rlr�r4rr5r8)�cli_argsr�r��argsrur��arg�setting�_�valuersr��
build_callr��artifact�
artifact_lists                r.�mainr��s����]�F��������X�&�D�����(��O����	:�"�j�j��)9�)9�:�O��o�t�4��g�h��

�	�	��'�'�C� #�
�
�c� 2��G�Q���o�-�+0���(�!�/�'�":�D�A�0?��0H�/I�O�G�,���(�/�/��6�(�37�+�+�2E�R�W�W�\�\�$�+�+�v�
.�4�;�;�F�(,�(:�(:�M��"�
�,�
� �	�
�	�	���K�K�����!�!�!��&�&��N�N�
��/�ch�i�ch�W_�
7�
0�
7�
7��
R�G�K�K�M�
R�ch�i�
�
�	�;�]�K�
�	��3�#�#�	:��4�Q�C�8�9�9��	:��H
j�
�	�s7�
:G$�AH�,H
�H�$H�7H�H�H�H!c�<�ttjdd�y)Nr	)r�r)�argvr,r-r.�
entrypointr��s������!�"��r-�__main__zpython -m buildr�r�)�return�None)rrN)r6r:r7r:r1�
TextIO | Noner�r�)NN)r;z
Warning | strr<z
type[Warning]r=r:r>�intr1rr?�
str | Noner�r�)r;r:rEztuple[str, ...] | Noner�r�)rZrr�r�)r	)r7r:r^rr�r)ri�
Sequence[str]r�r:)rrrrsrrtrru�ConfigSettings | Nonerl�_env.Installerr�r:)F)rrrrsrrtrrurr|�boolr�r:)r�rrrrrsrrtrrurr|rrlrr�r:)r�zIterator[None])r�rr�r:)NTF�pip)rrrrsrr�zSequence[Distribution]rurr�rr|rrlrr�r)r�zargparse.ArgumentParserr�)r�rr�rr�r�)F�
__future__rr��
contextlib�contextvarsr�r#rSr�rHr)r�r�r�r%�collections.abcrr�	functoolsr�typingrrrqrr
rrr��_exceptionsr
rr�_typesrrrr�_COLORSr��fromkeysr(�
ContextVarrr/r8r@�get_terminal_size�columnsr��fillrLrOr[r_rjrwrr��contextmanagerr�r�r�r�r�r�r��__name__r��__all__r,r-r.�<module>rsU��#�����	��
��
�����.��#��"��R�R�9�9�#��
�����
����]�]�7�B�
'�
�!�+�
 �
 ��G�
<���C���
7�
�7��7��7�
�	7�
�7��
7�
�7�/�f�.�.�0�8�8�1�<���!����	��
�
��=P�Q��<@�]�"�"�K�
J��
J��
J��
J�+�	
J�
�
J�	�

J�*#(�F��F��F��F�+�	F�
 �F�	�
F�&k��k��k�
�k��	k�
+�k� �
k��k�	�k�������8

�".2��"'� %������*��+�	�
�� �
�����<.2��"'� %�* ��* ��* �*�* �+�	* �
�* � �
* ��* ��* �Zx�v<L�~��z������!�"��(�)����r-
Back to Directory File Manager