o
    d                     @   s   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 dejej	Z
eeZejddd dd Zd	d
 Zdd ZedkrLe  dS dS )    Nc                   @   s   e Zd ZdS )_CombinedFormatterN)__name__
__module____qualname__ r   r   g/var/www/html/visualizacion-main/env/lib/python3.10/site-packages/dash/development/update_components.pyr      s    r   z3%(asctime)s,%(msecs)03d %(levelname)s - %(message)sz%H:%M:%S)fmtdatefmtc                 C   s   t jdk}| dkr| nd}d| d| d| }tj|| d}t| tj|tjtj|d}| \}}	|	 }
W d    n1 sDw   Y  |	rZt|
rPd	nd
|	
  t jd |
s^|sstd| d|
 dt jd t d d S td| dt jd d S )Nwin32all4dash-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splitprint
subprocessPopenPIPEcommunicatepolldecoder   exit)components_sourceconcurrencyinstall_type
is_windowssource_globcmdstrcmdprocouterrstatusr   r   r   bootstrap_components   s6   



r3   c              	   C   s  t jdk}| dkr| nd}d| d| d}tj|| d}t| tj|tjtj|d}| \}}|	 }	W d    n1 sBw   Y  |rXt|	rNd	nd
|
  t jd |	s\|sotd| d|	 dt jd t d |dD ]}
tjd|
|
ddd}|
dkrdn|
dkrdnd}tjd|}tj|szt| W n ty   td| t d Y nw tj|stdd|
 d  t d qttd| d  t| t|| ttj|d!d"d#d$ W d    n1 sw   Y  td%| d& qtd S )'Nr
   r   r   r   r   z)* -- npm run buildr   r   r   r   r   u+   🚨 Finished updating component packages: r   r   r   |
components-_z/\zdash-core-componentsdcczdash-html-componentshtml
dash_table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    r!   r"   r#   r$   r%   r&   r   r'   ospathjoinreplacerstripexistsmakedirsOSErrorlogger	exceptionshutilrmtreecopytreeopen)r(   r)   r+   r,   r-   r.   r/   r0   r1   r2   packagebuild_directorydest_dir	dest_pathr   r   r   build_components;   sp   




rP   c                  C   sz   t jdtdd} | jdddd | jdtd	d
d | jdddd |  }t|j|j|j	dkr1dnd t
|j|j d S )Nzdash-update-componentszUpdate the specified subcomponent libraries within Dash by copying over build artifacts, dependencies, and dependency metadata.)progformatter_classdescriptionr(   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))typerU   rT   z--ciz!For clean-install use '--ci True'FalseTruecii)argparseArgumentParserr   add_argumentint
parse_argsr3   r(   r)   rZ   rP   )parserargsr   r   r   cli   s4   rc   __main__)r   r!   r   r>   r\   rH   loggingcoloredlogsArgumentDefaultsHelpFormatterRawDescriptionHelpFormatterr   	getLoggerr   rF   installr3   rP   rc   r   r   r   r   <module>   s*    

$D"
