
    }i!                       d dl mZ d dlZd dlZd dlZd dlmZmZmZ 	 d dlm	Z	 ej                  j                  e      Ze	 	 	 	 	 	 	 	 	 	 d$d       Ze	 d%	 	 	 	 	 	 	 	 	 d&d       Ze	 d'	 	 	 	 	 	 	 	 	 d(d	       Z	 d'	 	 	 	 	 	 	 	 	 d(d
Ze	 	 	 	 	 	 	 	 d)d       Zedd	 	 	 	 	 	 	 d*d       Zedd	 	 	 	 	 	 	 d+d       Zdd	 	 	 	 	 	 	 d+dZe	 	 	 	 	 	 	 	 d,d       Ze	 d%	 	 	 	 	 	 	 d-d       Ze	 	 d.	 	 	 	 	 	 	 d/d       Z	 	 d.	 	 	 	 	 	 	 d/dZe	 	 	 	 	 	 	 	 d,d       Ze	 d%	 	 	 	 	 	 	 d-d       Ze	 	 d.	 	 	 	 	 	 	 d/d       Z	 	 d.	 	 	 	 	 	 	 d/dZe	 	 	 	 	 	 	 	 d,d       Ze	 d%	 	 	 	 	 	 	 d-d       Ze	 	 d.	 	 	 	 	 	 	 d/d       Z	 	 d.	 	 	 	 	 	 	 d/dZe	 	 	 	 	 	 	 	 d,d       Ze	 d%	 	 	 	 	 	 	 d-d       Ze	 	 d.	 	 	 	 	 	 	 d/d       Z	 	 d.	 	 	 	 	 	 	 d/dZd0d Zd0d!Zd0d"Zd0d#Zy# e
$ r
 d dlm	Z	 Y w xY w)1    )annotationsN)AnyIterableoverload)Literalc                     y N nameargsreturn_completed_processkwargss       B/usr/local/lib/python3.12/dist-packages/nodejs_wheel/executable.py_programr           03    .c                     y r	   r
   r   s       r   r   r      r   r   Fc                     y r	   r
   r   s       r   r   r   "   s     69r   c                
   t         j                  dk(  rt        n#t         j                  j	                  t        d      }t        j                  t         j                  j	                  ||       g|fi |}|r|S |j                  S )Nntbin)osr   ROOT_DIRpathjoin
subprocessrun
returncode)r   r   r   r   bin_dircomplete_processs         r   r   r   +   sd     ''T/hrww||He/LG!~~rww||GT'B&JT&JUfU&&&r   c                     y r	   r
   r   r   r   s      r   	call_noder$   8        03r   )r   c                     y r	   r
   r#   s      r   r$   r$   >   s     r   c                     y r	   r
   r#   s      r   r$   r$   D   s     69r   c                f    t         j                  dk(  rdnd}t        d|z   t        |      fd| i|S )Nr   z.exe noder   )r   r   r   list)r   r   r   suffixs       r   r$   r$   J   sD     ww$VBFT
 ": 	 r   c                     y r	   r
   r   r   r   s      r   r*   r*   V   r%   r   c                     y r	   r
   r.   s      r   r*   r*   \       
 r   c                     y r	   r
   r.   s      r   r*   r*   d       
 69r   c                F    | t         j                  dd } t        | d|i|S )a}  Call the node executable with the given arguments.

    Parameters
    ----------
    args : Optional[list[str]], default=None
        List of arguments to pass to the node executable.
        If None, the arguments are taken from sys.argv[1:].
    return_completed_process : bool, default=False
        If True, return the CompletedProcess[str | bytes] object instead of the return code.
    **kwargs : dict[str, Any]
        Other arguments passed to subprocess.call

    Returns
    -------
    int | subprocess.CompletedProcess[str | bytes]
        Return code of the node executable or the CompletedProcess[str | bytes] object.
    N   r   )sysargvr$   r.   s      r   r*   r*   l   s/    , |xx|dX5MXQWXXr   c                     y r	   r
   r.   s      r   npmr8      r%   r   c                     y r	   r
   r.   s      r   r8   r8      r0   r   c                     y r	   r
   r.   s      r   r8   r8      r2   r   c           
         | t         j                  dd } t        t        j                  j                  t        ddddd      g| d|i|S )	az  Call the npm executable with the given arguments.

    Parameters
    ----------
    args : Optional[list[str]], default=None
        List of arguments to pass to the npm executable.
        If None, the arguments are taken from sys.argv[1:].
    return_completed_process : bool, default=False
        If True, return the CompletedProcess[str | bytes] object instead of the return code.
    **kwargs : dict[str, Any]
        Other arguments passed to subprocess.call

    Returns
    -------
    int | subprocess.CompletedProcess[str | bytes]
        Return code of the npm executable or the CompletedProcess[str | bytes] object.
    Nr4   libnode_modulesr8   r   z
npm-cli.jsr   r5   r6   r$   r   r   r   r   r.   s      r   r8   r8      [    , |xx|
XuneULQ	 ": 	 r   c                     y r	   r
   r.   s      r   npxrA      r%   r   c                     y r	   r
   r.   s      r   rA   rA      r0   r   c                     y r	   r
   r.   s      r   rA   rA      r2   r   c           
         | t         j                  dd } t        t        j                  j                  t        ddddd      g| d|i|S )	a{  Call the npx executable with the given arguments.

    Parameters
    ----------
    args : Optional[list[str]], default=None
        List of arguments to pass to the npx executable.
        If None, the arguments are taken from sys.argv[1:].
    return_completed_process : bool, default=False
        If True, return the CompletedProcess[str | bytes] object instead of the return code.
    **kwargs : dict[str, Any]
        Other arguments passed to subprocess.call

    Returns
    -------
    int | subprocess.CompletedProcess[str | bytes]
        Return code of the npx executable, or the CompletedProcess[str | bytes] object.
    Nr4   r<   r=   r8   r   z
npx-cli.jsr   r>   r.   s      r   rA   rA      r?   r   c                     y r	   r
   r.   s      r   corepackrF      r%   r   c                     y r	   r
   r.   s      r   rF   rF      r0   r   c                     y r	   r
   r.   s      r   rF   rF     r2   r   c           
         | t         j                  dd } t        t        j                  j                  t        ddddd      g| d|i|S )	a  Call the corepack executable with the given arguments.

    Parameters
    ----------
    args : Optional[list[str]], default=None
        List of arguments to pass to the corepack executable.
        If None, the arguments are taken from sys.argv[1:].
    return_completed_process : bool, default=False
        If True, return the CompletedProcess[str | bytes] object instead of the return code.
    **kwargs : dict[str, Any]
        Other arguments passed to subprocess.call

    Returns
    -------
    int | subprocess.CompletedProcess[str | bytes]
        Return code of the corepack executable, or the CompletedProcess[str | bytes] object.
    Nr4   r<   r=   rF   distzcorepack.jsr   r>   r.   s      r   rF   rF   	  s`    , |xx|
e^Z	
 
	
 ":  r   c                 ,    t        t        d            NF)	close_fds)
SystemExitr*   r
   r   r   _node_entry_pointrO   +  s    
TE*
++r   c                 ,    t        t        d            rL   )rN   r8   r
   r   r   _npm_entry_pointrQ   /      
S5)
**r   c                 ,    t        t        d            rL   )rN   rA   r
   r   r   _npx_entry_pointrT   3  rR   r   c                 ,    t        t        d            rL   )rN   rF   r
   r   r   _corepack_entry_pointrV   7  s    
X.
//r   )
r   strr   Iterable[str]r   Literal[True]r   r   return(subprocess.CompletedProcess[str | bytes]).)
r   rW   r   rX   r   Literal[False]r   r   rZ   r[   )F)
r   rW   r   rX   r   boolr   r   rZ   .int | subprocess.CompletedProcess[str | bytes])r   rW   r   rY   r   r   rZ   r[   )r   rW   r   r\   r   r   rZ   int)r   rW   r   r]   r   r   rZ   r^   )r   Iterable[str] | Noner   rY   r   r   rZ   r[   )r   r`   r   r\   r   r   rZ   r_   )NF)r   r`   r   r]   r   r   rZ   r^   )rZ   None)
__future__r   r   r   r5   typingr   r   r   r   ImportErrortyping_extensionsr   dirname__file__r   r   r$   r*   r8   rA   rF   rO   rQ   rT   rV   r
   r   r   <module>rh      s   " 	  
 * ** 77??8$ 
3
3
3 ,3 	3
 .3 
3 
 033
3
3 -3 	3
 .3 
3 
 &+9
9
9 #9 	9
 49 
9 &+
'

'

' #
' 	
'
 4
' 
33*73CF3-3 
3
 
;>*8JM 

 
1699*.9BE939 
9 27		*.	BE	3	 
3
3:G3SV3-3 
3
 
 03
,  		 
 
!%%*9
9"9 9 4	9 
9 "&%*Y
Y"Y Y 4	Y6 
3
3:G3SV3-3 
3
 
 03
,  		 
 
!%%*9
9"9 9 4	9 
9 "&%*
"  4	@ 
3
3:G3SV3-3 
3
 
 03
,  		 
 
!%%*9
9"9 9 4	9 
9 "&%*
"  4	@ 
3
3:G3SV3-3 
3
 
 03
,  		 
 
!%%*9
9"9 9 4	9 
9 "&%*
"  4	D,++0[	  *))*s   G/ /G>=G>