
    y                         S 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SSKrSSKrSSK	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rS\-   S-   r " S S\5      rS rg))Implementation of gsutil version command.    )absolute_import)print_function)division)unicode_literalsN)Command)system_util)GetFriendlyConfigFilePaths)UsingCrcmodExtension)UTF8)GetMd5)$CheckMultiprocessingAvailableAndInitz
  gsutil version
z
<B>SYNOPSIS</B>
aS  


<B>DESCRIPTION</B>
  Prints information about the version of gsutil.

<B>OPTIONS</B>
  -l          Prints additional information, such as the version of Python
              being used, the version of the Boto library, a checksum of the
              code, the path to gsutil, and the path to gsutil's configuration
              file.
c                       \ rS rSrSr\R                  " SS/\SSSSSSS9	r\R                  " SS/S	S
\
0 S9rS rS rSrg)VersionCommand;   r   versionverr   lF)command_name_aliasesusage_synopsismin_argsmax_argssupported_sub_argsfile_url_okprovider_url_okurls_start_argcommand_helpzPrint version info about gsutil)	help_namehelp_name_aliases	help_typehelp_one_line_summary	help_textsubcommand_help_textc                    SnU R                   (       a  U R                    H  u  p#US:X  d  M  SnM     SR                  [        5       5      n[        R                  n U R                  5       nXV:X  a  SnOSU-  n[        R                  R                  S[        R                  -  5        U(       Ga.  S	n[        R                  R                  UR                  UU[        R                  [        R                  R                  S
S5      [         R"                  " 5       < S[         R$                  " 5       < 3['        5       R(                  [*        R,                  " 5       [*        R.                  " 5       U[1        5       =(       d    [        R2                  [5        5       [        R6                  [        R8                  [        R:                  R=                  SSS5      S95        g! [         a    Sn GNf = f)z,Command entry point for the version command.Fz-lTz, zMISSING FILESOKz!= %szgsutil version: %s
a  checksum: {checksum} ({checksum_ok})
boto version: {boto_version}
python version: {python_version}
OS: {os_version}
multiprocessing available: {multiprocessing_available}
using cloud sdk: {cloud_sdk}
pass cloud sdk credentials to gsutil: {cloud_sdk_credentials}
config path(s): {config_paths}
gsutil path: {gsutil_path}
compiled crcmod: {compiled_crcmod}
installed via package manager: {is_package_install}
editable install: {is_editable_install}
shim enabled: {is_shim_enabled}

  GSUtiluse_gcloud_storage)checksumchecksum_okboto_versionpython_version
os_versionmultiprocessing_available	cloud_sdkcloud_sdk_credentialsconfig_pathsgsutil_pathcompiled_crcmodis_package_installis_editable_installis_shim_enabledr   )sub_optsjoinr
   gslibCHECKSUM_ComputeCodeChecksumIOErrorsysstdoutwriteVERSIONformatboto__version__r   replaceplatformsystemreleaser   is_availabler	   InvokedViaCloudSdkCloudSdkCredPassingEnabled"GetCloudSdkGsutilWrapperScriptPathGSUTIL_PATHr   IS_PACKAGE_INSTALLIS_EDITABLE_INSTALLconfiggetbool)	self	long_formo_r3   shipped_checksumcur_checksumchecksum_ok_strlong_form_outputs	            )platform/gsutil/gslib/commands/version.py
RunCommandVersionCommand.RunCommandT   s   I}}--$!9)   9979:L~~%..0l 'o"22oJJ+emm;<.  
jj

!
!#)++ [[00r:$,OO$5x7G7G7IJ68EE#668$/$J$J$L'=? - ,,24!&!9!9"'";";"kk11(2FO! " PQ( ]  %$l%s   G! !G10G1c                 P   [         R                  (       a  g[        5       n[         R                  /n[        R
                  " [         R                  5       HU  u  p4nU HI  nUR                  S5      (       d  M  UR                  [        R                  R                  X65      5        MK     MW     [        U5       H  n[        R                  (       aW  [        US5      nUR                  5       n[         R"                  " SSU5      nUR%                  U5        UR'                  5         Mo  [        US[(        S9nUR                  5       n[         R"                  " SSU5      nUR%                  UR+                  [(        5      5        UR'                  5         M     UR-                  5       $ )	aJ  Computes a checksum of gsutil code.

This checksum can be used to determine if users locally modified
gsutil when requesting support. (It's fine for users to make local mods,
but when users ask for support we ask them to run a stock version of
gsutil so we can reduce possible variables.)

Returns:
  MD5 checksum of gsutil code.
.PACKAGED_GSUTIL_INSTALLS_DO_NOT_HAVE_CHECKSUMSz.pyrbz(\r\n|\r|\n)   
r)encodingr&   )r;   rO   r   rN   oswalk	GSLIB_DIRendswithappendpathr:   sortedsixPY2openreadresubupdatecloser   encode	hexdigest)	rS   mfiles_to_checksumrootrV   filesfilepathfcontents	            r[   r=   #VersionCommand._ComputeCodeChecksum   s%    =A**+''%//2(U##

"
"277<<#?
@  3 ,-	4 &&(&&%9			3.&&(&&$8	%&		 . ;;=     N)__name__
__module____qualname____firstlineno____doc__r   CreateCommandSpec	_SYNOPSIScommand_specHelpSpec_DETAILED_HELP_TEXT	help_specr\   r=   __static_attributes__r~   r}   r[   r   r   ;   se    1 **!7
, =#);z#r}   r   c                  x   [         R                  n [        R                  " 5       (       a  [        R
                  R                  SSS5      nU R                  U5      (       aY  [        R
                  R                  U SU R                  U5       SS5      n[        R
                  R                  U5      (       a  U$ g)a  If gsutil was invoked via the Cloud SDK, find its gsutil wrapper script.

Returns:
  (str) The path to the Cloud SDK's gsutil wrapper script, or an empty string
  if gsutil was not invoked via the Cloud SDK or the wrapper script could not
  be found at its expected path.
rG   gsutilr   binr'   )
r;   rN   r	   rK   rd   ri   r:   rg   rfindexists)r4   platform_path_suffixbin_paths      r[   rM   rM      s     !!+##%%77<<
HhG011
a))*>?
@

h
 
	!	!	r}   )r   
__future__r   r   r   r   rd   rG   ro   r?   rk   rD   crcmodr;   gslib.commandr   gslib.utilsr	   gslib.utils.boto_utilr
   r   gslib.utils.constantsr   gslib.utils.hashing_helperr   &gslib.utils.parallelism_framework_utilr   r   r   r   rM   r~   r}   r[   <module>r      sx    0 & %  ' 	  	 
 
    ! # < 6 & - W	  yW yxr}   