o
�j� � @ s� d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl Z ddl
mZ ddlm
Z
mZmZmZmZmZ ddlmZmZmZ ejd*dd
��ZG dd� de
�Zd+dd�Z d,d-dd�Zd.d d!�Zd/d"d#�Zd/d$d%�Zd0d(d)�ZdS )1z
The ``relenv create`` command.
� )�annotationsN)�Iterator� )�RelenvException�arches�archived_build�
build_arch�format_shebang�relative_interpreter)�get_default_python_version�python_versions�resolve_python_version�path�str | os.PathLike[str]�return�Iterator[None]c c s8 � t �� }zt �| � dV W t �|� dS t �|� w )z�
Context manager that changes to the specified directory and back.
:param path: The path to temporarily change to
:type path: str
N)�os�getcwd�chdir)r �cwd� r �A/opt/saltstack/salt/lib/python3.10/site-packages/relenv/create.pyr ! s �
r c @ s e Zd ZdZdS )�CreateExceptionzJ
Raised when there is an issue creating a new relenv environment.
N)�__name__�
__module__�__qualname__�__doc__r r r r r 1 s r �
subparsers�3argparse._SubParsersAction[argparse.ArgumentParser]�Nonec C s` | j ddd�}|jtd� |jddd� |jdt� ttj td d
� t � }|jd|tdd
� dS )z�
Setup the subparser for the ``create`` command.
:param subparsers: The subparsers object returned from ``add_subparsers``
:type subparsers: argparse._SubParsersAction
�createzrCreate a Relenv environment. This will create a directory of the given name with newly created Relenv environment.)�description)�func�namez#The name of the directory to create)�helpz--archz,The host architecture [default: %(default)s])�default�choices�typer$ z--pythonz>The python version (e.g., 3.10, 3.13.7) [default: %(default)s])r% r'