
                             S SK r S SKrS SKrSSKJr  \R
                  R                  SS5      rSr\R                  " \
5      rSS jrS rS	 rSS
 jrg)    N   )IS_WINDOWS_PLATFORMz.dockerzconfig.jsonz
.dockercfgc                    [        [        S U [        5       [        R                  R                  [        5       [        5      [        R                  R                  [        5       [        5      /5      5      n[        R                  S[        U5       35        U HC  n[        R                  R                  U5      (       d  M)  [        R                  SU 35        Us  $    [        R                  S5        g )NzTrying paths: zFound file at path: zNo config file found)listfilterconfig_path_from_environmentospathjoinhome_dirDOCKER_CONFIG_FILENAMELEGACY_DOCKER_CONFIG_FILENAMElogdebugreprexists)config_pathpathsr
   s      &lib/third_party/docker/utils/config.pyfind_config_filer      s    $&
XZ!78
XZ!>?	  E IItE{m,-77>>$II,TF34K 
 II$%    c                      [         R                  R                  S5      n U (       d  g [         R                  R	                  U [         R                  R                  [        5      5      $ )NDOCKER_CONFIG)r	   environgetr
   r   basenamer   )
config_dirs    r   r   r   !   s?    0J77<<
BGG$4$45K$LMMr   c                      [         (       a   [        R                  R                  SS5      $ [        R                  R                  S5      $ )z
Get the user's home directory, using the same logic as the Docker Engine
client - use %USERPROFILE% on Windows, $HOME/getuid on POSIX.
USERPROFILE ~)r   r	   r   r   r
   
expanduser r   r   r   r   (   s4    
 zz~~mR00ww!!#&&r   c                 6   [        U 5      nU(       d  0 $  [        U5       n[        R                  " U5      sS S S 5        $ ! , (       d  f       O5= f! [        [
        4 a  n[        R                  U5         S nAOS nAff = f[        R                  S5        0 $ )Nz4All parsing attempts failed - returning empty config)r   openjsonloadOSError
ValueErrorr   r   )r   config_filefes       r   load_general_configr-   3   sq    ";/K	+!99Q< Z   			!
 IIDEIs3   A A	A 
AA A B"A<<B)N)r&   loggingr	   	constantsr   r
   r   r   r   	getLogger__name__r   r   r   r   r-   r#   r   r   <module>r2      sQ      	 +i?  , !(N'r   