HEX
Server: Apache/2.4.68 (Debian)
System: Linux as-cs-widget-demo-us-central1 6.1.0-44-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.164-1 (2026-03-09) x86_64
User: root (0)
PHP: 8.2.32
Disabled: NONE
Upload Files
File: //lib/google-cloud-sdk/bin/bootstrapping/__pycache__/bootstrapping.cpython-312.pyc
�

��8-���dZddlmZddlmZdevrddlmZnddlZddlZddlZejej�e_
ddlZddlZddl
Z
ddlmZdd	lmZdd
lmZddlmZddlmZdd
lmZddlmZddlmZddlmZddlmZddlmZddlm Z ejjCejjEe#��Z$ejjCe$�Z%ejjCe%�Z&d�Z'd�Z(d�Z)d�Z*d%d�Z+		d&d�Z,d�Z-d�Z.d�Z/d�Z0d�Z1d�Z2d �Z3d&d!�Z4d"�Z5d#�Z6d$�Z7ejp�js�y)'z?Common bootstrapping functionality used by the wrapper scripts.�)�absolute_import)�unicode_literals�.�)�setupN)�config)�execution_utils)�metrics)�
properties)�console_attr)�store)�local_state)�update_manager)�encoding)�files)�	platforms)�inputc�t�tj�j�stjd�yy)Nr)r�
PythonVersion�IsCompatible�sys�exit���"bin/bootstrapping/bootstrapping.py�"DisallowIncompatiblePythonVersionsr@s'��	�	 �	 �	"�	/�	/�	1��H�H�Q�K�
2rc�n�tjD�cgc]}tj|���c}Scc}w�N)r�argvr�Decode)�args r�GetDecodedArgvr"Es)��.1�h�h�	7�h�s�,�
�
�c�
"�h�	7�7��	7s�2c�L�tjjt||�Sr)�os�path�join�SDK_ROOT)�tool_dir�	exec_names  r�	_FullPathr*Is��	�����h��)�	4�4rc�$�d}i}|dk(r-tjtjd�}d|d<|r|}|dk(r(tjtjd�}|r|}t	tjt||�g|��d|i�fi|��y)	z�Execute the given python script with the given args and command line.

  Args:
    tool_dir: the directory the tool is located in
    exec_name: additional path to the executable under the tool_dir
    *args: args for the command
  N�gsutil�CLOUDSDK_GSUTIL_PYTHONF�	close_fdszbq.py�CLOUDSDK_BQ_PYTHON�python)r�GetEncodedValuer$�environ�_ExecuteToolr	�ArgsForPythonToolr*)r(r)�args�py_path�extra_popen_kwargs�	gsutil_py�bq_pys       r�ExecutePythonToolr:Ms���
�'�
���(���(�(����5M�N�I�',��{�#���g��'���$�$�R�Z�Z�1E�F�E���g���'�'�
�H�i�
(�A�+/�A�8?�A��	�rc��|xsg}t||�}|r|gng}d|g|z|zt|�z}ttj|g|����y)afExecute a given jar with the given args and command line.

  Args:
    java_bin: str, path to the system Java binary
    jar_dir: str, the directory the jar is located in
    jar_name: str, file name of the jar under tool_dir
    classname: str, name of the main class in the jar
    flags: [str], flags for the java binary
    *args: args for the command
  �-cpN)r*�listr3r	�ArgsForExecutableTool)	�java_bin�jar_dir�jar_name�	classname�flagsr5�jar_path�
classname_arg�	java_argss	         r�ExecuteJarToolrGns]���+�2�%�
�w��
)�(�!*�9�+��-��h��%�'�-�7�$�t�*�D�)���+�+�H�A�y�A�Crc�Z�|xsg}|xsg}tjjt|d�}tjjt||�}|tjz|z}d|gt|�z|gzt|�z}	t
tj|g|	����y)arExecute a given java class within a directory of jars.

  Args:
    java_bin: str, path to the system Java binary
    jar_dir: str, directory of jars to put on class path
    main_jar: str, main jar (placed first on class path)
    main_class: str, name of the main class in the jar
    java_flags: [str], flags for the java binary
    main_args: args for the command
  �*r<N)	r$r%r&r'�pathsepr=r3r	r>)
r?r@�main_jar�
main_class�
java_flags�	main_args�jar_dir_path�
main_jar_path�	classpathrFs
          r�ExecuteJavaClassrR�s��� ��R�*��o�2�)������h���5�,��'�'�,�,�x��(�;�-��b�j�j�(�<�7�)��y�!��j�!�"�����i��!�)���4�4�X�J�	�J�Krc�V�ttjt||�g|����y)z�Execute the given bash script with the given args.

  Args:
    tool_dir: the directory the tool is located in
    exec_name: additional path to the executable under the tool_dir
    *args: args for the command
  N)r3r	r>r*�r(r)r5s   r�ExecuteShellToolrU�s+����+�+�I�h�	�,J�3�-1�3�4rc�V�ttjt||�g|����y)z�Execute the given batch file with the given args.

  Args:
    tool_dir: the directory the tool is located in
    exec_name: additional path to the executable under the tool_dir
    *args: args for the command
  N)r3r	�ArgsForCMDToolr*rTs   r�ExecuteCMDToolrX�s'����$�$�Y�x��%C�K�d�K�Mrc��ttj�}tj|dd�tj|dt
j�tj|dtj��|S)N�CLOUDSDK_WRAPPER�1�CLOUDSDK_VERSION�CLOUDSDK_PYTHON)	�dictr$r2r�SetEncodedValuer�CLOUD_SDK_VERSIONr	�GetPythonExecutable)�envs r�_GetToolEnvrc�sa���R�Z�Z��#�
���3� 2�C�8�
���3� 2�F�4L�4L�M�
���3� 1�*�>�>�@�B�	�*rc�l�tj|tjddzfdt	�i|��y)z�Executes a new tool with the given args, plus the args from the cmdline.

  Args:
    args: [str], The args of the command to execute.
    **extra_popen_kwargs: [dict], kwargs to be unpacked in Popen call for tool.
  rNrb)r	�Execrrrc)r5r7s  rr3r3�s9�����
�S�X�X�a�b�\��D�*�}�D�0B�Drc���tjjtd�}	t	|�5}tj|�cddd�S#1swYgSxYw#YgSxYw)z�Gets the list of components to install by default.

  Returns:
    list(str), The component ids that should be installed.  It will return []
    if there are no default components, or if there is any error in reading
    the file with the defaults.
  z.default_componentsN)r$r%r&�BOOTSTRAPPING_DIR�open�json�load)�default_components_file�fs  r�GetDefaultInstalledComponentsrm�sZ���G�G�L�L�):�)>�@��	�	
�%�	&�!�
�Y�Y�q�\�
'�	&�	&�
�)��	��	�)�s(�A�A�	A�A�A�A�A"c�z�d}|ddD]}|r	|ddk(r�||vs�|}n|du}|r�tjjd|d�d|�d��tjjd|z�tjj||d	z�td
�}|dvrtjd�yyy)aBlock certain subcommands, warn the user, and exit.

  Args:
    args: the command line arguments, including the 0th argument which is
      the program name.
    blocked_commands: a map of blocked commands to the messages that should be
      printed when they're run.
  Nrr�-z%It looks like you are trying to run "� z".
z<The "%s" command is no longer needed with Google Cloud CLI.
�
zReally run this command? (y/N) )�y�Y)r�stderr�writerr)r5�blocked_commands�bad_argr!�blocked�answers      r�WarnAndExitOnBlockedCommandrz�s���
�'�
�!�"�X�c��s�1�v��}��
����g���
�4��'���J�J����Q���*�+��J�J���+�-4�5�6��J�J���%�g�.��5�6�
�4�
5�F�
�Z��	�h�h�q�k� �
rc�d�	tjj|��y#t$rYywxYw)z�Check for updates and inform the user.

  Args:
    command_path: str, The '.' separated path of the command that is currently
      being run (i.e. gcloud.foo.bar).
  ��command_pathN)r�
UpdateManager�PerformUpdateCheck�	Exceptionr|s r�CheckUpdatesr�s2��	�� � �3�3��3�N��
�	��	�s� #�	/�/c�v�|�!|rtjj|�}tj||�y)aZLogs that the given command is being executed.

  Args:
    command_name: str, The name of the command being executed.
    component_id: str, The component id that this command belongs to.  Used for
      version information if version was not specified.
    version: str, Directly use this version instead of deriving it from
      component.
  N)r�InstallationState�VersionForInstalledComponentr
�
Executions)�command_name�component_id�versions   r�CommandStartr�s4��
�_���+�+�H�H���G�	���\�7�+rc���tjjjj	d��}tjjj
j	d��}||fS)aGet the active project name and account for the active credentials.

  For use with wrapping legacy tools that take projects and credentials on
  the command line.

  Returns:
    (str, str), A tuple whose first element is the project, and whose second
    element is the account.
  F��validate)r�VALUES�core�project�Get�account)�project_namer�s  r�GetActiveProjectAndAccountr� sY���"�"�'�'�/�/�3�3�U�3�C�,����"�"�*�*�.�.��.�>�'�
��	 � rc�j�tjjjj	d��S)z�Get the active impersonate_service_account property.

  For use with wrapping legacy tools that take impersonate_service_account on
  the command line.

  Returns:
    str, The name of the service account to impersonate.
  Fr�)rr��auth�impersonate_service_accountr�rrr�"GetActiveImpersonateServiceAccountr�/s*��
�	�	�	�	�	;�	;�	?�	?��	?�	O�Orc��tjtjjt
g|����j
�S)zBReturns file content at specified relative path wrt SDK root path.)r�ReadFileContentsr$r%r&r'�strip)�
path_partss rr�r�;s.��	�	�	������X� C�
� C�	D�	J�	J�	L�Lrr)NN):�__doc__�
__future__rr�__name__�r�gcloudr�reorder_sys_pathr%rir$�platform�googlecloudsdk.corerr	r
r�googlecloudsdk.core.consoler�googlecloudsdk.core.credentialsr
�c_store�googlecloudsdk.core.updaterrr�googlecloudsdk.core.utilrrr�	six.movesr�dirname�realpath�__file__rg�BIN_DIRr'rr"r*r:rGrRrUrXrcr3rmrzr�r�r�r�r��GceCredentialProvider�Registerrrr�<module>r�s:��F�'�'��(�?���
�
�"�6�"�"�3�8�8�,����	��&�/�'�*�4�<�3�6�-�*�.���G�G�O�O�B�G�G�$4�$4�X�$>�?��
�'�'�/�/�+�
,��
�7�7�?�?�7�#���
8�5��BC�.!%�#�L�8
4�	M�
�D��,�B	�
,� !�	P�M������(�(�*r