
    kKj'                        d Z ddlmZ ddlZddlZddlZddlmZ ddlm	Z	  e
 ee      j                         j                        Z e
 ee      j                         j                  dz        Zd
ddZddZd
dd	Zy)z5A Jupyter-aware wrapper for the yarn package manager.    )annotationsN)Path)whichzyarn.jsc                
   | xs t         j                  } | j                  d      xs t         j                  }t	        d|      }|st	        d|      }|sd}t        |      t        t        |      j                               S )zGet the full path to Node.js executable.

    Parameters
    ----------
    env: dict, optional
        The environment variables, defaults to `os.environ`.

    PATHnode)pathnodejszPlease install Node.js and npm before continuing installation. You may be able to install Node.js from your package manager, from conda, or directly from the Node.js website (https://nodejs.org).)	osenvirongetdefpathr   
ValueErrorstrr   resolve)envr	   command_with_pathmsgs       e/Users/ahmed/devFolder/Ultron/claude-voice/.venv/lib/python3.12/site-packages/jupyter_builder/jlpm.py_which_node_jsr      sz     
C776?(bjjDf40 !(6$ 	 ot%&..011    c                T   t               }t        j                  dk(  ruddl}t	        j
                  |g| dd       }|j                  |j                  |j                         |j                          t        j                  |j                         yt        j                  ||        y)z=Execute node, using Popen on Windows due to Python bug #9148.ntr   N   )r   r   namesignal
subprocessPopenSIGINTSIG_IGNwaitsysexit
returncodeexecvp)argvcmdr   ps       r   _execvp_noder)   .   su    

C	ww$c-DH-. 	fmmV^^4	
		#tr   c                X    | xs t         j                  dd } t        dt        g|        y)zRun node and return the result.r   Nr   )r"   r&   r)   	YARN_PATH)r&   s    r   mainr,   >   s*     388AB<D&)+d+,r   )N)r   zdict[str, str] | Nonereturnr   )r&   z	list[str]r-   None)r&   zlist[str] | Noner-   r.   )__doc__
__future__r   r   r   r"   pathlibr   shutilr   r   __file__r   parentHEREr+   r   r)   r,    r   r   <module>r7      sj    ;
 # 	  
  
4>!!#**+X&&(//);<	28 -r   