
                         ,   S r SSKJr  SSKJr  SSKJr  SSKrSSKrSSKr\R                  R                  \
5      r\R                  R                  \S5      r\\R                  ;  a  \R                  R                  S\5        \R                  R                  \5      (       a  \R                  R                  S\5        S rS rS	 rS
r\R(                  R+                  S5      (       a  SOSrS r\R0                  S 5       rS r\S:X  a  \" 5         gg)zgcloud command line tool.    )absolute_import)division)unicode_literalsNthird_partyc                      S[         R                  ;  a  gSSKn  [        U 5        g! [         a    SSKnUR                  U 5         gf = f)a  Reloads the google module to prefer our vendored copy.

When python is not invoked with the -S option, it can preload google module
via .pth file setting its __path__. After this happens, our vendored google
package may not in the __path__. After our vendored dependency directory is
put at the first place in the sys.path, google module should be reloaded,
so that our vendored copy can be preferred.
googleNr   )sysmodulesr   reload	NameError	importlib)r   r   s     lib/gcloud.py_fix_google_moduler   )   sB     S[[ 

6N	 Vs   ' A	A	c                     S[         R                  ;   aP  / n/ nU  H3  nSU;   a  SU;  a  UR                  U5        M"  UR                  U5        M5     UR                  U5        U$ U $ )a\  If site packages are enabled reorder them.

Make sure bundled_python site-packages appear first in the sys.path.

Args:
  sys_path: list current sys path

Returns:
  modified syspath if CLOUDSDK_PYTHON_SITEPACKAGES is on, prefer bundled
  python site packages over all other. Note the returns syspath has the same
  elements but a different order.
CLOUDSDK_PYTHON_SITEPACKAGESzsite-packageszplatform/bundledpythonunix)osenvironappendextend)sys_pathnew_pathother_site_packagespaths       r   reorder_sys_pathr   <   sh     $rzz1H	D	 %A%M""4(	 
 OO'(OO    c                  "    SSK n U R                  $ )z(Returns reference to gcloud_main module.r   N)googlecloudsdk.gcloud_maingcloud_main)googlecloudsdks    r   _import_gcloud_mainr    W   s     $		#	##r   )   	   )ENABLE_MAX_GCLOUD_PYTHON_VERSION_OVERRIDE)r!      )r!      c                 2    SR                  U S   U S   5      $ )Nz{}.{}r      )format)python_versions    r   python_version_stringr*   f   s    	q)>!+<	==r   c            	   #     #     Sv   g! [          GaR    [        R                  SS n U [        :  d
  U [        :  aG  SnU [        :  a  SnOSnSR                  [        U 5      U[        [        5      [        [        5      S9nO;SnS	R                  [        R                  [        [        5      [        [        5      S
9n[        R                  R                  SR                  US95        U(       a]  SSK
n[        R                  R                  SR                  SR                  UR                  5       R                  5       5      5      5        [        R                  " S5         gf = f7f)z<Handles exceptions from gcloud to provide a helpful message.N   Fz!not currently supported by gcloudzno longer supported by gcloudzYou are running gcloud with Python {python_version}, which is {support_message}.
Install a compatible version of Python {min_python_version}-{max_python_version} and set the CLOUDSDK_PYTHON environment variable to point to it.)r)   support_messagemin_python_versionmax_python_versionTa\  This usually indicates corruption in your gcloud installation or problems with your Python interpreter.

Please verify that the following is the path to a working Python {min_python_version}-{max_python_version} executable:
    {executable}

If it is not, please set the CLOUDSDK_PYTHON environment variable to point to a working Python executable.)
executabler.   r/   zERROR: gcloud failed to load. {error_message}

If you are still experiencing problems, please reinstall the Google Cloud CLI using the instructions here:
    https://cloud.google.com/sdk/docs/install
)error_messager   z

{}

r'   )	Exceptionr	   version_infoMIN_SUPPORTED_PY3_VERSIONMAX_SUPPORTED_PY3_VERSIONr(   r*   r0   stderrwrite	tracebackjoin
format_exc
splitlinesexit)r)   valid_python_versionr-   r1   r9   s        r   gcloud_exception_handlerr?   j   sT    8		 6 %%bq)N2222"	3	3=9A BH2>B-!6+"-!6+"- BH B.	  "  !6+"-!6+"-	   . " JJ: &}&
- 	jjz((
))I((*557
8: ;HHQKm6s&   E)	 E)EE&#E)%E&&E)c                  8   [        5          [        [        R                  5      [        l        SSKJn   S S S 5        W R                  [        R                  S5      (       a   SSK	J
n  UR                  5         g [        5          [        5         [        5       nS S S 5        [        R                  " WR!                  5       5        g ! , (       d  f       N= f! [         a(    U R                  [        R                  S5      S:X  a  e  Nf = f! , (       d  f       Ny= f)Nr   )encoding_ARGCOMPLETE)lookup_ARGCOMPLETE_TRACEstatic)r?   r   r	   r   googlecloudsdk.core.utilrA   GetEncodedValuer   r   ,googlecloudsdk.command_lib.static_completionrC   Completer3   r   r    r=   main)rA   rC   r   s      r   rJ   rJ      s    !)CH1 "
 bjj.99Eoo  !%'K " ((;) "!  		!	!"**"6
8;C
D
D
 "!s)   )C"C D
C/DD
D__main__)__doc__
__future__r   r   r   
contextlibr   r	   r   dirname__file___GCLOUD_PY_DIRr:   _THIRD_PARTY_DIRinsertisdirr   r   r    r5   r   getr6   r*   contextmanagerr?   rJ   __name__ r   r   <module>rY      s   $   &  '  	 
*77<<> 
 !((//!^$77==!""((//!%&&6$ # zz~~3 G > : :z0 z& r   