File: //opt/saltstack/salt/lib/python3.10/site-packages/relenv/build/__pycache__/__init__.cpython-310.pyc
o
�N�g% � @ sx d Z ddlZddlZddlZddlZddlmZmZmZ ddl m
Z
mZ ddl mZ dd � Z
d
d� Zdd
� Zdd� ZdS )z
The ``relenv build`` command.
� N� )�linux�darwin�windows)�builds�CHECK_VERSIONS_SUPPORT� )�
build_archc C s. t jdkrtS t jdkrtS t jdkrtS dS )�:
Return the right module based on `sys.platform`.
r r �win32N)�sys�platformr r r � r r �I/opt/saltstack/salt/lib/python3.10/site-packages/relenv/build/__init__.py�platform_module s
�r c C s t tjtj �� �S )r
)�listr r r
�keysr r r r �platform_versions s r c C s� t � }| jddd�}|jtd� |jdt� |jtdd� |jdd d
dd� |jd
t� d t� tdd� |jdd d
dd� |jdd d
dd� |jddddg dd� |jdd d
dd� |jdd d
dd� |jddd d!d"� d#S )$z�
Setup the subparser for the ``build`` command.
:param subparsers: The subparsers object returned from ``add_subparsers``
:type subparsers: argparse._SubParsersAction
�buildz,Build Relenv Python Environments from source)�description)�funcz--archz,The host architecture [default: %(default)s])�default�choices�type�helpz--cleanF�
store_truezfClean up before running the build. This option will remove the logs, src, build, and previous tarball.)r �actionr z--pythonr z)The python version [default: %(default)s]z--no-cleanupz�By default the build directory is removed after the build tarball is created. Setting this option will leave the build directory in place.z--force-downloadz4Force downloading source tarballs even if they existz--step�stepsZSTEP�appendz�A step to run alone, can use multiple of this argument. When this option is used to invoke builds, depenencies of the steps are ignored. This option should be used with care, as it's easy to request a situation that has no chance of being succesful. )�dest�metavarr r r z--check-versionsz@Check for new version of python and it's depenencies, then exit.z--no-prettyzELog build output to stdout instead of displaying a simplified status.z--log-level�warning)�errorr! �info�debugz2Log level determines how verbose the logs will be.)r r r N) r �
add_parser�set_defaults�main�add_argumentr ZARCHES�strr )Z
subparsers�modZbuild_subparserr r r �setup_parser$ s~ ��� ����
��
�r+ c C s0 t �� t�d�tj�� �t_t�d�tj�� �t_tjt j vr-t
dtj� �� t�d� t j tj | j }| j
rStsDt
d� t�d� |�
� sNt�d� nt�d� |�| j� |j|jkrct
d� d}| jrpd d
� | jD �}| jrvd}nd}d
d� }t�tj|� ||| j| j| j | j|| j�� d� dS )z�
The entrypoint to the ``build`` command.
:param args: The arguments to the command
:type args: ``argparse.Namespace``
zutf-8zUnsupported platform: r z\Check versions not supported. Please install the packaging and looseversion python packages.r r zVWarning: Cross compilation support is experimental and is not fully tested or working!Nc S s g | ]}|� � �qS r )�strip)�.0�_r r r �
<listcomp>� s zmain.<locals>.<listcomp>FTc S s t �d� d S )Nr )r �exit)�signal�framer r r �signal_handler� s zmain.<locals>.signal_handler)r �arch�cleanZcleanup�force_download�show_ui� log_level)�random�seed�codecs� getwriterr �stdout�detach�stderrr
r �printr0 �pythonZcheck_versionsr Zset_archr4 r r Z no_prettyr1 �SIGINTr5 Z
no_cleanupr6 r8 �upper)�argsr r r7 r3 r r r r'