
    .                     :   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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  \R4                  " / 5      rS rS rS rS rS r S r!S r"\#S:X  a  \"" 5         gg)z#Do initial setup for the Cloud CLI.    )absolute_import)print_function)unicode_literalsN)actions)
exceptions)config)platforms_install)
properties)
console_io)python_manager)update_manager)encoding)	platforms)gcloud_mainc            	         S n [         R                  " 5       nUR                  SSU SS9  UR                  SSU SS9  UR                  SSS	S
9  UR                  SSS9  UR                  SSSU SS9  UR                  SSU SS9  UR                  SSSS9  UR                  SSSS9  UR                  SSSS9  UR                  SSSS9  UR                  S S!S[        R                  " [
        R                  R                  R                  S"5      S#S$9  UR                  S%S"U S&S9  UR                  S'S(S)S9  UR                  [        R                  " 5       S*S 5      $ )+zDParse args for the installer, so interactive prompts can be avoided.c                 (    U R                  5       S;   $ )N)true1)lower)ss    bin/bootstrapping/install.pyBoolParseArgs.<locals>.Bool'   s    779%%    z--usage-reportingNz.(true/false) Enable anonymous usage reporting.)defaulttypehelpz--screen-readerz'(true/false) Enable screen reader mode.z--universe-domainzhUniverse domain to default to. If specified, sets the [core/universe_domain] property installation-wide.)r   r   z	--rc-pathzProfile to update with PATH and completion. If given without --command-completion or --path-update in "quiet" mode, a line will be added to this profile for both command completion and path updating.)r   z--command-completionz--bash-completionz(true/false) Add a line for command completion in the profile. In "quiet" mode, if True and you do not provide--rc-path, the default profile will be updated.z--path-updatez(true/false) Add a line for path updating in the profile. In "quiet" mode, if True and you do not provide --rc-path, the default profile will be updated.z--disable-installation-options
store_truez)DEPRECATED.  This flag is no longer used.)actionr   z--override-components*zUOverride the components that would be installed by default and install these instead.)nargsr   z--additional-components+zAdditional components to install by default.  These components will either be added to the default install list, or to the override-components (if provided).z--update-installed-componentszUpdate previously installed components. Checks the install folder to make sure that there are no installed components that need to be updated. This is currently just used for updating gcloud via homebrew.--quietz-qTzgDisable all interactive prompts. If input is required, defaults will be used or an error will be raised)r   r   r   z--install-pythonz3(true/false) Attempt to install Python. MacOS only.--no-compile-pythonstore_falsezEFalse. If set, skips python compilation after component installation.   )argparseArgumentParseradd_argumentr   StoreConstPropertyr
   VALUEScoredisable_prompts
parse_argsbootstrappingGetDecodedArgv)r   parsers     r   	ParseArgsr2   $   s   & ""$&;	   	4	   	@	   	   	 	   	  
 	&6  
 	/	   	?	   	%	  	 	
''



 
 
0
0$   	@	   		   
		=779!"=	>>r   c                    U c  [         R                  " [        R                  S5       b+  [         R                  " [        R                  S5      (       + n OUb5  U[        R
                  R                  R                  R                  :w  a  Sn O_[        R                  R                  5       R                  5       (       a  Sn [        S5        O [        S5        [        R                  " SSS9n [        R                   " [        R
                  R                  R"                  U (       + [        R$                  R&                  S	9  g)
aB  Display prompts to opt out of usage reporting.

Args:
  usage_reporting: bool, If True, enable usage reporting. If None, check the
    environmental variable. If None, check if its alternate release channel.
    If not, ask.
  universe_domain: str, if specified and not 'googleapis.com', set
    usage-reporting to False.
N%CLOUDSDK_CORE_DISABLE_USAGE_REPORTINGFTzF
    Usage reporting is always on for alternate release channels.
    a  
To help improve the quality of this product, we collect anonymized usage data
and anonymized stacktraces when crashes are encountered; additional information
is available at <https://cloud.google.com/sdk/usage-statistics>. This data is
handled in accordance with our privacy policy
<https://cloud.google.com/terms/cloud-privacy-notice>. You may choose to opt in this
collection now (by choosing 'Y' at the below prompt), or at any time in the
future by running the following command:

    gcloud config set disable_usage_reporting false
z0Do you want to help improve the Google Cloud CLI)prompt_stringr   scope)r   GetEncodedValueosenvironr
   r+   r,   universe_domainr   r   InstallationConfigLoadIsAlternateReleaseChannelprintr   PromptContinuePersistPropertydisable_usage_reportingScopeINSTALLATION)usage_reportingr;   s     r   PromptsrF      s     	  JJ?	
 	
 %44
**= o
 
%!2!2!7!7!G!G!O!OO$$))+EEGG  		 	 
 
	 %33L 44/6I))+r   c                      [         R                  R                  5       n [        R                  " U SS9nUR                  5       n[        UR                  5       5      $ )NF)platform_filterwarn)r   PlatformCurrentr   UpdateManagerGetCurrentVersionsInformationlistkeys)platformmanagerinstalled_componentss      r   GetInstalledComponentsrS      sL    '')(((N' >>@	"'')	**r   c                 "   U b  U O[         R                  " 5       n[        U5      nU(       a"  [        5       =n(       a  UR	                  U5        U(       a  UR	                  U5        [        XCUS9  U(       d  [        R                  / SQ5        gg)z,Do the normal installation of the Cloud CLI.Nupdate)r#   
componentsrN   )r/   GetDefaultInstalledComponentsboolrS   extendInstallOrUpdateComponents_CLIExecute)override_componentsupdate_installed_componentsadditional_componentscompile_python
to_installrV   rR   s          r   Installrc      s     (;'F#"@@B  
& "5777*++,JvF 
LL23 
r   c                 d    [         R                  " 5       nUR                  U 5        [        XSS9  g)zDo a forced reinstallation of Google Cloud CLI.

Args:
  component_ids: [str], The components that should be automatically installed.
  compile_python: bool, False if we skip compile python
TrU   N)r/   rX   rZ   r[   )component_idsra   rb   s      r   	ReInstallrf     s,     ::<*M" M$Gr   c                     U(       d  U (       d  g[        S5        U(       a  SOSnSSU/nU(       d  UR                  S5        OUR                  S5        [        R                  X@-   5        g)	ak  Installs or updates the given components.

Args:
  component_ids: [str], The components to install or update.
  compile_python: bool, False if we skip compile python
  update: bool, True if we should run update, False to run install.  If there
    are no components to install, this does nothing unless in update mode (in
    which case everything gets updated).
Nzi
This will install all the core command line tools necessary for working with
the Google Cloud Platform.
rV   installr#   rW   r$   z--compile-python)r?   appendr\   r]   )re   ra   rV   verbexecute_arg_lists        r   r[   r[     sd     

 $t4	12./,,&r   c                     [         R                  R                  R                  R	                  S5        [        5       n U R                  bZ  [         R                  " [         R                  R                  R                  U R                  [         R                  R                  S9  U R                  bZ  [         R                  " [         R                  R                  R                  U R                  [         R                  R                  S9  [        R                  " [        R                   " 5       R"                  [$        S9  [&        R(                  " [*        R,                  S5      n U(       a&  [/        UR1                  S5      U R2                  5        g [5        U R6                  U R                  5        [8        R:                  " SSS9  [        R<                  R>                  (       d6  [A        U RB                  U RD                  U RF                  U R2                  5        [H        RJ                  " U RL                  U RN                  U RP                  [8        RR                  [8        RT                  S	9  U RV                  (       a  [X        RZ                  " 5         []        S
5        g ! [^        R`                   a+  n[]        U5        [b        Rd                  " S5         S nAg S nAff = f)NFr6   )sdk_rootcommandCLOUDSDK_REINSTALL_COMPONENTS,INSTALLr,   )component_id)completion_updatepath_updaterc_pathbin_pathrm   zl
For more information on how to get started, please visit:
  https://cloud.google.com/sdk/docs/quickstarts

r&   )3r
   r+   context_awareuse_client_certificateSetr2   screen_readerrA   accessibilityrC   rD   r;   r,   r   RestartIfUsingBundledPythonr   Pathsrm   __file__r   r8   r9   r:   rf   splitno_compile_pythonrF   rE   r/   CommandStartINSTALLATION_CONFIGdisable_updaterrc   r^   r_   r`   r	   UpdateRCcommand_completionrt   ru   BIN_DIRSDK_ROOTinstall_pythonr   PromptAndInstallPythonOnMacr?   r   ToolExceptionsysexit)pargsreinstall_componentses      r   mainr   3  s   !!88<<UC
+%
$z00>>LL$22%/%5%5%B%BD &z0055EE$44%/%5%5%B%BD ,,flln6M6M5=?!11jj13$**3/1H1HIe##U%:%:;  @''77%%--''##		
   !44''-- (( )) 
		224   
	!	! 	!HHHQKKs   (,J# DJ# #K"7!KK"__main__)$__doc__
__future__r   r   r   r/   r'   r9   r   googlecloudsdk.callioper   r   googlecloudsdk.corer   r	   r
   googlecloudsdk.core.consoler   googlecloudsdk.core.updaterr   r   googlecloudsdk.core.utilr   r   googlecloudsdkr   	CreateCLIr\   r2   rF   rS   rc   rf   r[   r   __name__ r   r   <module>r      s    * & % '   	 
 + . & 1 * 2 6 6 - . & R {?|2+j+ 4FHD/d z& r   