
    !                        S r SSKJr  SSKJr  SSKJr  SSKr\R
                  " 5       rSSKrSSKrSSK	r	SSK
r
SSKJr  SSKJr  SSKJr  SS	KJr  SS
KJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJ r   SSKJ!r!  SSK"r"\ RF                  " 5         \RH                  " 5       RJ                  (       d/  \RL                  RN                  RP                  RS                  S5        S r*S r+S r,SS jr-\R\                  SS j5       r/\0S:X  a	   \/" 5         gg! \1 a    \ Rd                  " 5          gf = f)zgcloud command line tool.    )absolute_import)division)unicode_literalsN)base)cli)crash_handling)yaml_command_translator)config)log)metrics)
properties)creds_context_managers)devshell)survey_check)local_state)keyboard_interrupt)	platformsTc                     SSK Jn   UR                  R                  U S9  g ! [         a    [
        R                  " SSS9   g f = f)Nr   )update_manager)command_pathzFailed to perform update check.Texc_info)googlecloudsdk.core.updaterr   UpdateManagerPerformUpdateCheck	Exceptionr   debug)r   unused_kwargsr   s      !lib/googlecloudsdk/gcloud_main.pyUpdateCheckr    ;   sD    8@  333N 
 @II/$?@s   " AAc                     [         R                  R                  R                  R	                  5       (       a  g[
        R                  " 5       (       a  gS/nU H  nU R                  U5      (       d  M    g   g)z+Decides if survey prompt should be checked.Fzgcloud.components.post-processT)r   VALUESsurveydisable_promptsGetBool
c_devshellIsDevshellEnvironment
startswith)r   exempt_commandsexempt_commands      r   _ShouldCheckSurveyPromptr+   E   sk    --5577 %%'' '/ (n~.. ( 
    c                     [        U 5      (       d  g [        R                  " 5       R                  5         g! [         a    [
        R                  " SSS9   gf = f)z!Checks for in-tool survey prompt.NzFailed to check survey prompt.Tr   )r+   r   SurveyPrompterPromptr   r   r   )r   r   s     r   SurveyPromptCheckr0   Y   sJ    	!,	/	/
?!((* 
 ?II.>?s   #7 AAc           
        ^	 U	4S jnS n[         R                  R                  [         R                  R                  [        R                  5      5      n[
        R                  " S[         R                  R                  US5      SUUU=(       d    [        R                  " 5       S9nUR                  [        R                  R                  [         R                  R                  USS5      SS9  UR                  [        R                  R                  [         R                  R                  USS	5      S	S9  UR                  [        R                  R                  [         R                  R                  USS
5      S
S9  U  H  u  pgUR!                  XgSS9  M     UR!                  S[         R                  R                  USSS5      5        UR!                  S[         R                  R                  USSSS5      5        UR!                  S[         R                  R                  USSS5      5        SnUR#                  [$        US9  UR#                  [&        5        UR)                  5       m	T	$ )ak  Generates the gcloud CLI from 'surface' folder with extra surfaces.

Args:
  surfaces: list(tuple(dot_path, dir_path)), extra commands or subsurfaces to
    add, where dot_path is calliope command path and dir_path path to command
    group or command.
  translator: yaml_command_translator.Translator, an alternative translator.

Returns:
  calliope cli object.
c                  *   > T R                  S/5        g )Nversion)Execute)generated_clis   r   VersionFuncCreateCLI.<locals>.VersionFuncs   s    9+&r,   c                  ,    [         R                  " SS9  g )NF)is_crash)r   ReportError r,   r   HandleKnownErrorFunc'CreateCLI.<locals>.HandleKnownErrorFuncv   s    .r,   gcloudsurfaceT)namecommand_root_directoryallow_non_existing_modulesversion_funcknown_error_handlerr	   alpha)	componentbetapreviewNzcontainer.hub	containerfleetzbigtable.tablesbigtable	instancestableszcompute.migration	migrationvmsz&gcloud\.components\..*|gcloud\.version)exclude_commands)ospathdirnamer?   __file__r   	CLILoaderjoinr	   
TranslatorAddReleaseTrackr   ReleaseTrackALPHABETAPREVIEW	AddModuleRegisterPostRunHookr    r0   Generate)
surfaces
translatorr6   r<   pkg_rootloaderdot_pathdir_pathrP   r5   s
            @r   	CreateCLIrf   f   s   '/ WW__RWW__W-=-=>?(==WW\\(I>!%.)  D6AAC& 	
ggll8Y0   	
ggll8Y/   	
ggll8Y	2  
 %h
X48 %
 	ggll8YW=? 	ggll8Y
KJ 	277<<)[%P ?[;KL.///#-	r,   c                 v   [         R                  " [        R                  5        [        R
                  " 5       R                  5       (       d  [        R                  " S5        [        R                  " [        5        [        R                  " S[        R                  R                  S5      5        U c  [        / 5      n [         R"                  " U5          U R%                  5         [        R&                  R)                  5         S S S 5        g ! [*         a  nUR,                  [,        R.                  :X  ak  [0        R2                  " [0        R4                  [0        R6                  5      n[0        R8                  " U[        R&                  R;                  5       5         S nANe S nAff = f! , (       d  f       g = f)N   r>   core)atexitregisterr   Shutdownr   PythonVersionIsCompatiblesysexitStarted
START_TIME
Executionsr   InstallationStateVersionForInstalledComponentrf   r   CredentialProvidersManagerr4   stdoutflushIOErrorerrnoEPIPErQ   opendevnullO_WRONLYdup2fileno)
gcloud_clicredential_providerserrr}   s       r   mainr      s   //'""#		 	 	"	/	/	1	1HHQK	//*	##@@HJ 2J889MN( 
jj ON  "  
ekk	! ''"**bkk2
**,--E" ONs7   F*.D
F'BF"F*!F""F''F**
F8__main__)N)NN)3__doc__
__future__r   r   r   timerr   rj   rz   rQ   ro   googlecloudsdk.callioper   r   googlecloudsdk.command_libr   $googlecloudsdk.command_lib.util.apisr	   googlecloudsdk.corer
   r   r   r   googlecloudsdk.core.credentialsr   r   r&   googlecloudsdk.core.surveyr   r   r   googlecloudsdk.core.utilr   r   r?   InstallHandlerPathssdk_rootr"   component_managerdisable_update_checkSetr    r+   r0   rf   CrashManagerr   __name__KeyboardInterruptHandleInterruptr;   r,   r   <module>r      s  "   &  ' YY[
   	 
 ( ' 5 H & # ' * B B 3 3 7 .   ! ! #||~%%::>>tD@(	?GT 4 4n z)F  
 )&&()s   D$ $D>=D>