
    $g                        d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZ G d dej                  ej                        Z
 ej                  e      Z ej                  dd       ddd	d
Zd Zd Zd Zd Zedk(  r e        yy)    Nc                       e Zd Zy)_CombinedFormatterN)__name__
__module____qualname__     _/var/www/dash_apps/app1/venv/lib/python3.12/site-packages/dash/development/update_components.pyr   r      s     	r	   r   z3%(asctime)s,%(msecs)03d %(levelname)s - %(message)sz%H:%M:%S)fmtdatefmtdcchtml
dash_table)zdash-core-componentszdash-html-componentsz
dash-tablec                 t    	 t        | fi | y # t        $ r t        | j                  dd      fi | Y y w xY w)Nasciiignore)printUnicodeEncodeErrorencode)msgkwargss     r
   status_printr      s;    7cV 7cjj(+6v67s    %77c                    t         j                  dk(  }| dk7  r| nd}d| d| d| }t        j                  ||       }t	        |       t        j                  |t
        j                  t
        j                  |      5 }|j                         \  }}	|j                         }
d d d        	r0t	        
rd	nd
|	j                         z   t         j                         
ss8t	        d| d|
 dt         j                         t        j                  d       y t	        d| dt         j                         y # 1 sw Y   xY w)Nwin32all6{dash-core-components,dash-html-components,dash-table}npx lerna exec --concurrency 
 --scope='z	' -- npm posixstdoutstderrshell   🛑  fileu@   🚨 Failed installing npm dependencies for component packages: 	 (status=   ) 🚨   uB   🟢 Finished installing npm dependencies for component packages: u    🟢)sysplatformshlexsplitr   
subprocessPopenPIPEcommunicatepolldecoder#   exit)components_sourceconcurrencyinstall_type
is_windowssource_globcmdstrcmdprocouterrstatuss              r
   bootstrap_componentsrB   $   s)   (J % 	E  -[MK=PYZfYghF
++f
N
3C			JOOJOO:
 	##%S	 gR3::<?cjjQSN{m[dekdllrs	
 	PQ\P]]bc	
! s    $D::Ec           	      D   t         j                  dk(  }| dk7  r| nd}d| d| d}t        j                  ||       }t	        |       t        j                  |t
        j                  t
        j                  |      5 }|j                         \  }}|j                         }	d d d        r0t	        	rd	nd
|j                         z   t         j                         	ss7t	        d| d|	 dt         j                         t        j                  d       d|v r&|j                  d      d   j                  d      d   }|j                  d      D ]w  }
t        j                  j                  d|
|
j!                  dd      j#                  d            }t$        j'                  |
      xs |
}t        j                  j                  d|      }t        j                  j)                  |      s	 t        j*                  |       t        j                  j)                  |      s(t	        dd|
 dz          t        j                  d       t	        d| d       t3        j4                  |       t3        j6                  ||       t9        t        j                  j                  |d      d d!"      5  	 d d d        t	        d#| d$       z y # 1 sw Y   .xY w# t,        $ r/ t.        j1                  d|       t        j                  d       Y w xY w# 1 sw Y   dxY w)%Nr   r   r   r   r   z' -- npm run buildr   r!   r%   r&   r'   u+   🚨 Finished updating component packages: r)   r*   r+   {}r   ,
components-_z/\dashu"   🚨 Having issues manipulating %suQ   🚨 Could not locate build artifacts. Check that the npm build process completedz successfully for package: u    🚨u!   🚚 Moving build artifacts from u    to Dash 🚚z.gitkeepwzutf-8)encodingu*   🟢 Finished moving build artifacts from u    to Dash 🟢)r,   r-   r.   r/   r   r0   r1   r2   r3   r4   r5   r#   r6   ospathjoinreplacerstripdest_dir_mapgetexistsmakedirsOSErrorlogger	exceptionshutilrmtreecopytreeopen)r7   r8   r:   r;   r<   r=   r>   r?   r@   rA   packagebuild_directorydest_dir	dest_paths                 r
   build_componentsra   H   s   (J % 	E  -[MK=PbcF
++f
N
3C			JOOJOO:
 	##%S	 gR3::<?cjjQS9+iPVxW]^	
 	
k!'',Q/55c:1=$$S) '',,'7??3#<#C#CE#J
  ##G,7GGLL2	ww~~i(I&
 ww~~o.@/y>?
 HHQK<_<M][\MM)$OOOY7bggll9j93Q <_<M][;' >    !EyQ s*   >$K/K1LK4LLL	c                  
   t        j                  dt        d      } | j                  ddd       | j                  dt        d	d
       | j                  ddd       | j                         }t        j                  dk(  r1|j                  j                  dd      j                  dd      |_        t        |j                  |j                  |j                  dk(  rdnd       t        |j                  |j                         y )Nzdash-update-componentszUpdate the specified subcomponent libraries within Dash by copying over build artifacts, dependencies, and dependency metadata.)progformatter_classdescriptionr7   zA glob string that matches the Dash component libraries to be updated (eg.'dash-table' // 'dash-core-components|dash-html-components' // 'all'). The default argument is 'all'.r   )helpdefaultz--concurrency   zAMaximum concurrent steps, up to 3 (ie all components in parallel))typerg   rf   z--ciz!For clean-install use '--ci True'Falser   "r&   'Truecii)argparseArgumentParserr   add_argumentint
parse_argsr,   r-   r7   rP   rB   r8   rn   ra   )parserargss     r
   clirw      s	   $$%*SF *    P	   0   D
||w!%!7!7!?!?R!H!P!P"
  0 0$''V:K$QT T++T-=-=>r	   __main__)r,   r0   r.   rM   rp   rY   loggingcoloredlogsArgumentDefaultsHelpFormatterRawDescriptionHelpFormatterr   	getLoggerr   rW   installrR   r   rB   ra   rw   r   r	   r
   <module>r      s    
   	    	**H,P,P	 
		8	$   =z
 ""7!
H@F$?N zE r	   