
    3                     d    S 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r	Sr
S	rS
 rS rS rS rg)z/Utility functions for gcloud bigtable emulator.    N)util)execution_utils)log)	platformsbigtablezGoogle Cloud Bigtable emulatorcbtemulatorc                  6    [         R                  " [        5      $ )N)r   
GetDataDirBIGTABLE     9lib/googlecloudsdk/command_lib/emulators/bigtable_util.pyr
   r
      s    		""r   c                 (   [         R                  " [        5      n[        R                  R                  U[        5      n[        R                  R                  5       [        R                  R                  L a  US-  n[        R                  " U/U Q76 $ )zBuilds the command for starting the bigtable emulator.

Args:
  args: (list of str) The arguments for the bigtable emulator, excluding the
    program binary.

Returns:
  A list of command arguments.
z.exe)r   GetEmulatorRootr   ospathjoinBIGTABLE_EXECUTABLEr   OperatingSystemCurrentWINDOWSr   ArgsForExecutableTool)argsbigtable_dirbigtable_executables      r   BuildStartArgsr   !   so     %%h/,\3FG&&(I,E,E,M,MM6!		.	./B	JT	JJr   c                 h    SU R                   R                  < SU R                   R                  < 30$ )zCReturns an environment variable mapping from an argparse.Namespace.BIGTABLE_EMULATOR_HOST:)	host_porthostport)r   s    r   GetEnvr#   2   s-     ^^(($..*=*=
>
 r   c                    [        [        R                  " U 5      5      n[        R                  R                  SR                  SR                  U5      5      5        [        R                  " U5       n[        R                  " [        U 5      [        5       5        [        R                  " U[        5        S S S 5        g ! , (       d  f       g = f)NzExecuting: {0} )r   r   BuildArgsListr   statusPrintformatr   ExecWriteEnvYamlr#   r
   PrefixOutputr   )r   bigtable_argsbigtable_processs      r   Startr/   :   s     !3!3D!9:-**#**388M+BCDyy#3fTlJL1&1  s   3AC  
C)__doc__r   $googlecloudsdk.command_lib.emulatorsr   googlecloudsdk.corer   r   googlecloudsdk.core.utilr   r   BIGTABLE_TITLEr   r
   r   r#   r/   r   r   r   <module>r5      s@    6 
 5 / # .1# #K"2r   