
    Miz                        S r SSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSK	r	SSK
r
SSKrSSKrSSKr\R                  S:  a  SSKJr  OSSKJr  SSKrSSKrSSKrSSKrSSKr SSKJr  SSKr\
R6                  " S5      rSSKr\R<                  rS	r%\RL                  RN                  r'\RL                  RP                  r(Sq)\R                  S   S
:  r*\RV                  " 5       S:H  r,\RV                  " 5       R[                  S5      r.Sq/S r0 " S S\15      r2\3" S \" \4" \25      5       5       5      \2l5        S r6S r7S r8S r9S r:\:" 5       r;S r<SGS jr=S r>S r?SHS jr@  SIS jrAS rBS rCS rDS  rES! rF\R                  S" 5       rHSJS# jrIS$ rJS% rKSKS& jrLS' rMS( rNS) rOS* rPS+ rQS, rRS- rSS. rTS/ rUS0 rVS1 rWS2 rXS3 rYSLS4 jrZS5 r[S6 r\S7 r]S8 r^S9S:S;.r_S<S=S;.r`S>raS?rbS@rcSArdSBreSCrfSDrgSErh\iSF:X  a  \^" 5         gg! \ a<    SSK Jr  SSK!J"r  \
R6                  " S5      rSSK#r#\#RH                  R<                  r GNf = f)Mz
nodeenv
~~~~~~~
Node.js virtual environment

:copyright: (c) 2014 by Eugene Kalinin
:license: BSD, see LICENSE for more details.
    N)   r   )quote)SafeConfigParser	iteritems)ConfigParseritemsz1.10.0r   Windows)CYGWINMSYSFc                 $   U (       a  [         (       a  U $  U R                  S5      $ ! [         a^     U R                  S5        U s $ ! [         a7     U R                  S5      R                  S5      s s $ ! [         a      Of = ff = f U $ f = f)z:Convert given text to UTF-8 encoding (as far as possible).utf8cp1252)is_PY3encodeUnicodeDecodeErrordecode)texts    a/var/www/eduai.edurigo.com/storigo/production/storigo_env/lib/python3.13/site-packages/nodeenv.pyto_utf8r   D   s    66
{{6"" 	KKK! 	{{8,33F;;% 	 KsV   ' 
BAB
BA61B2B6
B BBBBBBc                   h    \ rS rSrSrSrSrSrSrSr	Sr
SrSrSrSrSr\SS	 j5       r\S
 5       rSrg)ConfigX   z
Configuration namespace.
latestF2makeTNc           	         [        U5       GHL  n[        R                  R                  U5      n[        R                  R	                  U5      (       d  MI  [        5       nUR                  U5        SnUR                  U5      (       d  M~  [        [        U 5      5       H  u  pgUR                  S5      (       d  UR                  XV5      (       d  M3  [        U[        5      (       a  UR                  XV5      nOUR                  XV5      nU(       a8  [!        SR#                  [        R                  R%                  U5      Xg5      5        ['        XU5        M     GMO     [        R                  R	                  S5      (       aN  [)        SS5       n['        U SUR+                  5       R-                  5       R/                  S5      5        SSS5        gg! , (       d  f       g= f)	z
Load configuration from the given files in reverse order,
if they exist and have a [nodeenv] section.
Additionally, load version from .node-version if file exists.
nodeenv_zCONFIG {0}: {1} = {2}z.node-versionrnodevN)reversedospath
expanduserexistsr   readhas_sectionr   vars
startswith
has_option
isinstancebool
getbooleangetprintformatbasenamesetattropenreadlinestriplstrip)	clsconfigfilesverbose
configfileini_filesectionattrvalv_files	            r   _loadConfig._loadj   sa    #;/J++J7J77>>*--#~HMM*%G''00&tCy1	??3''&&w55c4(("--g<C",,w5C188((4dA B3' 2 04 77>>/**os+vVV__%6%<%<%>%E%Ec%JK ,+ +++s   9G
Gc                     [        S5        [        SSR                  S [        [        [	        U 5      5      5       5       5      -   5        g)z 
Print defaults for the README.
z    [nodeenv]z    z
    c              3   h   #    U  H(  u  pUR                  S 5      (       a  M  U< SU< 3v   M*     g7f)r   z = Nr*   ).0kr!   s      r   	<genexpr>Config._dump.<locals>.<genexpr>   s,      %&+G41<<$ A+Gs   22N)r0   joinsortedr   r)   )r8   s    r   _dumpConfig._dump   sA    
 	ofx}} %&+1)DI2F+G%& & & 	'     F)__name__
__module____qualname____firstlineno____doc__r    npmwith_npmjobswithout_ssldebugprofiler   prebuiltignore_ssl_certsmirrorclassmethodrA   rL   __static_attributes__rO   rN   r   r   r   X   sj    
 D
CHDKEGDHF"L "LH ' 'rN   r   c              #   \   #    U  H"  u  pUR                  S 5      (       a  M  X4v   M$     g7f)r   NrE   )rF   r>   r?   s      r   rH   rH      s)      !8ID??3 TK!8s   ,
,c                 D    U R                  S5      R                  SS5      $ )z
Remove new-lines and
utf-8
 )r   replace)outs    r   clear_outputrh      s      ::g&&tR00rN   c                 ,    U R                  US-   S5      $ )z;
Remove bin directory of the current environment from PATH
:re   )rf   )envenv_bin_dirs     r   remove_env_bin_from_pathrm      s     ;;{S("--rN   c                     U R                  SS5      R                  S5      SS n[        U5      S:  a  US   R                  S5      S   US'   [        [	        [
        U5      5      $ )	z2
Parse version string to a tuple of integer parts
r!   re   .Nr      +r   )rf   splitlentuplemapint)version_strr!   s     r   parse_versionrx      s^     	C$**3/3A
1v{tzz#q!!S!rN   c                     U R                   S:X  aI  [        R                  " SS/[        R                  S9R	                  5       u  p[        [        U5      5      $ [        U R                   5      $ )z/
Parse the node version from the argparse args
systemr    	--version)stdout)r    
subprocessPopenPIPEcommunicaterx   rh   )argsrg   errs      r   node_version_from_argsr      sY     yyH##[!*//;;F;= 	\#.//##rN   c                  t   [         R                  " S5      n U R                  [         R                  5        S nU[         R                  l        [         R                  " 5       nUR                  [         R                  5        [         R                  " SS9nUR                  U5        U R                  U5        U $ )z
Create logger for diagnostic
r   c                     U R                  U5      n[        USS5      (       a  SOSnU R                  R                  U[	        U5      -  5        U R                  5         g )N	continuedFz%sz%s
)r1   getattrstreamwriter   flush)selfrecordmsgfss       r   emitcreate_logger.<locals>.emit   sI    kk&!V[%88Tf"ws|+,

rN   z%(message)s)fmt)
logging	getLoggersetLevelINFOStreamHandlerr   DEBUG	FormattersetFormatter
addHandler)loggrr   ch	formatters       r   create_loggerr      s    
 i(E	NN7<< 
 "&G 
			 BKK !!m4I OOI 
RLrN   c            	      z   [         R                  " SS9n U R                  SS[        S9  U R                  SSSS	[        R
                  S
S9  U R                  SSS[        R                  SS9  [        (       d  U R                  SSS[        R                  SS9  U R                  SSSS9  U R                  SSS[        R                  SS9  U R                  SS S[        R                  S!S9  U R                  S"S#S[        R                  S$S9  U R                  S%S&S'S(S)[        R                  S*9  U R                  S+S,S-[        R                  S.S9  U R                  S/S0SS1S2S3S9  U R                  S4S5SS6S2S7S9  U R                  S8S9S:S;S<S9  U R                  S=S>S?S@SASBSC9  U R                  SDSESFS9  U R                  SGSHSISS2SJS9  U R                  SKSLSS2SMS9  U R                  SNSOS[        R                  SPS9  U R                  SQSRSS[        R                  STS9  U R                  SUSVSS2SWS9  U R                  SXSYSZSS2S[S9  U R                  S\S]S^SS2S_S9  U R                  S`SaSS2SbS9  U R                  ScS,S[        R                  SdS9  U R                  SeSfS[        R                   SgS9  U R                  ShSiSjSkSl9  U $ )mz&
Make a command line argument parser.
z%(prog)s [OPTIONS] DEST_DIR)usager{   version)actionr   z-nz--noder    NODE_VERzThe node.js version to use, e.g., --node=0.4.3 will use the node-v0.4.3 to create the new environment. The default is last stable version (`latest`). Use `lts` to use the latest LTS release. Use `system` to use system-wide node.)destmetavardefaulthelpz--mirrorstorer^   z1Set mirror server of nodejs.org to download from.)r   r   r   r   z-jz--jobsrX   zOSets number of parallel commands at node.js compilation. The default is 2 jobs.)r   r   r   z--load-averageload_averagezQSets maximum load average for executing parallel commands at node.js compilation.)r   r   --without-sslrY   
store_truez!Build node.js without SSL support)r   r   r   r   --debugrZ   z"Build debug variant of the node.js	--profiler[   zEnable profiling for node.jsz--makez-m	make_path	MAKE_PATHzPath to make command)r   r   r   r   z--sourcer\   store_falsezInstall node.js from the sourcez-vz	--verboser:   FzVerbose modez-qz--quietquietz
Quiet modez-Cz--config-fileconfig_fileNzfLoad a different file than '~/.nodeenvrc'. Pass an empty string for no config (use built-in defaults).z-rz--requirementsrequirementsre   FILENAMEz?Install all the packages listed in the given requirements file.)r   r   r   r   z--promptpromptz:Provides an alternative prompt prefix for this environmentz-lz--listlistz Lists available node.js versionsz--updateupdatez+Install npm packages from file without nodez
--with-npmrW   zBuild without installing npm into the new virtual environment. Required for node.js < 0.6.3. By default, the npm included with node.js is used. Under Windows, this defaults to true.z--npmrV   NPM_VERzThe npm version to use, e.g., --npm=0.3.18 will use the npm-0.3.18.tgz tarball to install. The default is last available version (`latest`).z--no-npm-cleanno_npm_cleanz9Skip the npm 0.x cleanup.  Cleanup is enabled by default.z--python-virtualenvz-ppython_virtualenvzUse current python virtualenvz--clean-src-c	clean_srcz)Remove "src" directory after installationz--forceforcez.Force installation in a pre-existing directoryz
--prebuiltz/Install node.js from prebuilt package (default)z--ignore_ssl_certsr]   z5Ignore certificates for package downloads. - UNSAFE -DEST_DIRenv_dir?zDestination directory)r   r   nargsr   )argparseArgumentParseradd_argumentnodeenv_versionr   r    r^   is_WINrX   rY   rZ   r[   r   r\   rW   rV   r]   )parsers    r   make_parserr      s    $$+-F I  @ hVZ0  1 Xv}}@  B
 6(% 	 	&
 	>& 	 	'
 	-););4 	 	6
 	G5 	 	7
 	i/ 	 	1
 	d'KK	 	 	! 	Z &//2 	 	4
 k)U  
 i'5  
 oM4F  G
 RN  P
 I  K hVU/  1
 U:  <
 :V__A  B e6::<  = ~UH  J
 t*=U,  .
 t+U8  :
 U=  ?
 :V__>  @
 #5V%<%<D  F
 #$  & MrN   c                    [        5       nUR                  5       nUR                  c
  / SQUl        OUR                  (       d  / Ul        Oj[        R                  R                  UR                  5      (       d*  UR                  SR                  UR                  5      5        UR                  /Ul        U (       d  U$ UR                  (       d3  UR                  (       d"  UR                  (       d  UR                  S5        U$ )zQ
Parses command line arguments.

Set `check` to False to skip validation checks.
)z	./tox.iniz./setup.cfgz~/.nodeenvrcz Config file '{0}' doesn't exist!z<You must provide a DEST_DIR or use current python virtualenv)r   
parse_argsr   r#   r$   r&   errorr1   r   r   r   )checkr   r   s      r   r   r   z  s     ]FDG ww~~d..//LL;BB  " # ,,-99%%dllLL 9 : KrN   c                    [         R                  R                  U 5      (       dH  [        R	                  SU [        SS9S9  [         R                  " U 5        [        R	                  S5        g[        R	                  SU 5        g)z
Create directory
z * Creating: %s ... Tr   extradone.z * Directory %s already existsN)r#   r$   r&   loggerrZ   dictmakedirsr$   s    r   mkdirr     sV     77>>$+T9MN
DW5t<rN   c                     [         R                  [         R                  -  [         R                  -  [         R                  -  [         R
                  -  n[        R                  " X5        g N)statS_IRWXUS_IXGRPS_IRGRPS_IROTHS_IXOTHr#   chmod)filename	mode_0755s     r   make_executabler     sD    , $-/3||<IHHX!rN   c                    [        U5      n[        (       a!  [        U[        5      (       d  [        US5      n[        R
                  R                  U 5      (       dc  [        R                  SU [        SS9S9  [        U S5       nUR                  U5        SSS5        [        U 5        [        R                  S5        g[        U S	5       nUR                  5       nSSS5        UW;   a  [        R                  S
U 5        gU(       d  [        R                  SU 5        gU(       a=  [        R                  SU 5        [        U S5       nUR                  U5        SSS5        g[        R                  SU 5        [        U S5       nUR                  U5        SSS5        g! , (       d  f       GN= f! , (       d  f       N= f! , (       d  f       g= f! , (       d  f       g= f)z%
Create file and write content in it
rc   z * Writing %s ... Tr   r   wbNr   rbz * Content %s already in placez: * File %s exists with different content;  not overwritingz * Appending data to %sabz" * Overwriting %s with new content)r   r   r,   bytesr#   r$   r&   r   rZ   r   r4   r   r   r'   info)r   content	overwriteappendfcs         r   	writefiler     sa    gGvj%00)77>>$)4td7KL$GGG W$A a<LL94@KK +,02KK148dD!Q  "8$?$GGG 1   "! s0   F F2GG 
F/2
G 
G
G"c           
      h   / n/ nU  H^  n[        U5      S:  a  USS S-   USS -   nSU;   d  SU;   d  SU;   d  S	U;   a  S
UR                  SS5      -  nUR                  U5        M`     SR                  U5      n[        R                  SU-  5        U(       a  SR                  U 5      n [        R                  n	U(       a7  [        R                  R                  5       n
U(       a  U
R                  U5        OSn
 [        R                  " U [        R                  SU	X:US9nUR$                  n	U	(       a  U	R'                  5       nU(       d  O [(        (       a   UR+                  S5      R-                  5       nO UR+                  S5      R-                  5       n UR                  U5        U(       a  [        R1                  U5        U	(       a  M  UR3                  5         UR4                  (       aB  U(       a  U H  n[        R7                  U5        M     [9        SU< SUR4                  < 35      eUR4                  U4$ ! [         a7    [        R                   " 5       S   n[        R#                  SU< SU< 35        e f = f! [.         a#    UR+                  S5      R-                  5       n GNf = f)z
Execute cmd line in sub-shell
-   N   z...i rd   "'z"%s"z\"z ** Running command %s)stderrstdinr|   cwdrk   shell   zError z while executing command mbcsr   cp866zCommand z failed with error code )rs   rf   r   rJ   r   rZ   r}   r   r#   environcopyr   r~   STDOUT	Exceptionsysexc_infor   r|   r5   r   r   rstripr   r   wait
returncodecriticalOSError)cmdshow_stdoutin_shellr   	extra_env
all_output	cmd_partspartcmd_descr|   rk   proceliness                  r   callitr    s=   
 JIt9r>9u$tCDz1D$;$$,#+DLLe44D  xx	"H
LL)H45hhsm __F jjooJJy!
))fH. [[F
 	1v{{6*113{{6*113 	$KK & 	IIK "  !4??4 5 	5 ??J&&=  LLN1aJK " 	1;;w'..0D	1s%   ;'I  *J 9J  AJ)J10J1c                 H    [        U 5      S:  a  [        < SU < S3$ [        $ )N)r      z/v/)rx   src_base_url)rw   s    r   get_root_urlr    s     [!F*(+66rN   c                  4    [         R                  " S5      S:H  $ )NHOST_GNU_TYPEzx86_64-pc-linux-musl)	sysconfigget_config_varrO   rN   r   is_x86_64_muslr    s    ##O48NNNrN   c                  2    [         R                  " 5       S:H  $ )Nriscv64)platformmachinerO   rN   r   
is_riscv64r"  !  s    **rN   c                    0 SS_SS_SS_SS_SS_SS_SS_SS_S	S
_S
S
_SS
_SS
_SS
_SS_SS_SS_n[         R                  " 5       R                  5       U[         R                  " 5       R                  5          S.n[        (       d  [
        (       a  SU-  nO[        5       (       a  SnOSU-  nSU < U< 3n[        U 5      U-   $ )Nx86i686x86_64x64amd64armv6larmv7larmv8laarch64arm64zarm64/v8armv8zarmv8.4ppc64les390xr  )rz   archz-win-%(arch)s.zipz-linux-x64-musl.tar.gzz-%(system)s-%(arch)s.tar.gzznode-v)r   rz   lowerr!  r   	is_CYGWINr  r  )r   archmapsysinfopostfixr   s        r   get_node_bin_urlr7  %  sC   %% 	% 	%	
 	% 	( 	( 	( 	7 	 	G 	 	7 	9 	  	9!G& //#))+((*0023G v%/			*/'9&0H 8++rN   c                 (    SU -  n[        U 5      U-   $ )Nznode-v%s.tar.gz)r  )r   tar_names     r   get_node_src_urlr:  F  s     7*H 8++rN   c               /      #    [         R                  " U 0 UD6n Uv   UR                  5         g! UR                  5         f = f7f)z!Compatibility layer because py26.N)tarfiler4   close)r   kwargstfs      r   tarfile_openr@  K  s6      
t	&v	&B


s   A/ AAAc                    US:  a.   [         R                  " [        U 5      R                  5       5      $ g! [         a;  n[
        R                  SR                  X5      5        US-  nUS:X  a  Ue SnAOSnAff = fUS:  a  M  g)zIDo multiple attempts to avoid incomplete data in case
of unstable networkr   z*Incomplete read while reading from {} - {}r   N)ioBytesIOurlopenr'   IncompleteReadr   warningr1   )node_url	n_attemptr  s      r   _download_node_filerI  U  s     a-		::gh/44677   	NN%vh2 NIA~ 	 a-s   ,6 
A; 1A66A;c           
         [         R                  S[        SS9S9  [        U 5      n[         R                  S[        SS9S9  [        (       d  [
        (       a0  [        R                  " U5      n[        R                  " S5      nS nO5[        US9n[        R                  " S5      n[        R                  " S	5      nU n[        R                  " UR                  5      nS
U-  n	U" U5       V
s/ s H$  n
[        R                  " X" U
5      5      b  M"  U
PM&     nn
UR!                  X5        SSS5        gs  sn
f ! , (       d  f       g= f)z
Download source code
ro   Tr   r   namelistc                     U $ r   rO   )r  s    r   <lambda>#download_node_src.<locals>.<lambda>p  s    rN   )fileobj
getmembersnamez0node-v%s[^/]*/(README\.md|CHANGELOG\.md|LICENSE)N)r   r   r   rI  r   r3  zipfileZipFileoperatormethodcallerr@  
attrgetterreescaper    match
extractall)rG  src_dirr   dl_contentsctxmembersmember_namearchivenode_verrexp_stringmemberextract_lists               r   download_node_srcre  e  s    KK4$/K0%h/K
KK4$/K0vook*''
3!;/''5))&1	99TYY'I "'*
*xx[%89 * 	 

 	71 

	 
s$   ?0D;/!D6D6D;6D;;
E	c                 4   SnSS[         < SU< S30n[        R                  " U S U5      n[        (       aM  [        R
                  " [        R                  5      n[        R                  Ul        [        R                  " X4S9$ [        R                  " U5      $ )Nz$https://github.com/ekalinin/nodeenv/z
User-Agentznodeenv/z ())context)
r   urllib2Requestr]   ssl
SSLContextPROTOCOL_TLS	CERT_NONEverify_moderD  )urlhome_urlheadersreqrh  s        r   rD  rD    sn    5H/8LMG
//#tW
-C ..!1!12!mms44??3rN   c                    [         R                  " U 5       GH  n[         R                  R                  X5      n[         R                  R                  X5      n[         R                  R	                  U5      (       a   [
        R                  " XVX#5        M  [         R                  R                  U5      (       aS  [         R                  R                  U5      (       d-  [         R                  " [         R                  " U5      U5        M  M  [
        R                  " XV5        GM     g ! [         a    [        XVX#5         GM-  f = fr   )r#   listdirr$   rJ   isdirshutilcopytreer  islinksymlinkreadlinkcopy2)srcdstsymlinksignoreitemr  ds          r   rx  rx    s    

3GGLL#GGLL#77==1h7 ww~~a  ww~~a((JJr{{1~q1 ) Q"    1x001s   >D**EEc                 D   [         R                  S[        SS9S9  [        (       a  [	        U S5      n[        U5        O@[        (       a3  [	        U S5      n[        U5        [        [	        U SS5      [        5        OU nU[        SU-  5      -   n[        R                  " U5      u  n[        XSS5        [        (       aG  S	 HA  n[	        U SU5      n[        R                  R                  U5      (       d  M6  [        U5        MC     [         R                  S[        SS9S9  g
)z)
Copy prebuilt binaries into environment
ro   Tr   r   Scriptsbinr    z
/node-v%s*)rV   npxnode.exeN)r   r   r   r   rJ   r   r3  r   CYGWIN_NODEr   globrx  r#   r$   r&   r   )r   r[  node_versionr   src_folder_tpl
src_folderr   s          r   copy_node_from_prebuiltr    s     KK4$/K0vGY'd	GU#d$wv.<w|l'BCCN))N+KJZt$y2HGUH5Hww~~h'') 3
 KK4$/K0rN   c                   ^ 0 nSS/n[        U4S jU5      n[        XV5       VVs/ s H;  u  pxUc  M
  [        U5      S:  a  SR                  Xx5      OSR                  U5      PM=     n	nn[	        [
        R                  S[
        R                  S   5      S:  a  [        R                  " S	5      n
U
(       d  [        S
5      e[        R                  SU
5        [        US5      n[        US5      n[        U5        [        R                  R!                  U5      (       d  [#        SSX/5        SR                  U[        R$                  R'                  SS5      5      US'   SS[)        U 5      -  /nTR*                  (       a  UR-                  S5        TR                  (       a  UR-                  S5        TR.                  (       a  UR-                  S5        TR0                  n[#        UTR2                  SX$5        [        R5                  S[7        SS9S9  [#        U/U	-   TR2                  SX$5        [        R5                  S[7        SS9S9  [#        US-   /TR2                  SX$5        g s  snnf )Nzload-averagerX   c                 <   > [        TU R                  SS5      5      $ )N-r   )r   rf   )xr   s    r   rM  %build_node_from_src.<locals>.<lambda>  s    '$		#s 34rN   r   z	--{0}={1}z--{0}majorrp   python2zbPython >=3.0 virtualenv detected, but no python2 command (required for building node.js) was foundz$ * Temporarily pointing python to %stmpbinpythonlnz-sz{}:{}PATHre   z./configurez--prefix=%sr   r   r   Tro   r   r   z install)ru   ziprs   r1   r   r   version_inforw  whichr  r   rZ   rJ   r   r#   r$   r&   r  r   r/   _quoterY   r   r[   r   r:   r   r   )r   r[  node_src_dirr   rk   make_param_namesmake_param_valuesrQ  value	make_optspython2_pathnode_tmpbin_dirnode_tmpbin_linkconf_cmdmake_cmds      `           r   build_node_from_srcr    s   
C&/4 /C DKD	4u:> 	4'&~~d3	4C   s#*:*:1*=>B ||I.D  	;\Jw1:oww~~.//D$?@nn_%'ZZ^^FB%?AF 	w'H (zz	"||$~~H
8T\\4;
KK4$/K0
H:	!4<<|I
KK4$/K0
Hz!"DLL$JWs
   	I*5I*c                 f     [        XU5        g! [         a    [        R                  S5        e f = f)zT
Download source code for node.js, unpack it
and install it in virtual environment.
re   N)install_node_wrappedBaseExceptionr   r   )r   r[  r   s      r   install_noder    s.    
Wt4 Bs    !0c                 2   [        U 5      n [        U[        SUR                  -  5      5      nUR                  (       a  SOSn[
        R                  SU< SUR                  < S3[        SS9S	9  UR                  (       a  [        UR                  5      nO[        UR                  5      n[        R                  R                  U5      (       d   [        XQU5        [
        R                  S[        SS9S	9  UR                  (       a  [%        XUR                  5        O['        XX25        [
        R                  S5        g ! [        R                   a?    S
U;   a  [        UR!                  S
S5      X5         N[
        R#                  SU-  5         Nf = f)Nznode-v%sr\   sourcez * Install z node (z) Tr   r   r-  r'  zFailed to download from %sro   z done.)abspathrJ   r   r    r\   r   r   r   r7  r:  r#   r$   r&   re  ri  	HTTPErrorrf   rF  r  r  )r   r[  r   r  src_typerG  s         r   r  r    s2   gGdii)?!@AL!]]zH
KKh		BT*  , }}#DII.#DII. 77>>,''	Hh6 KK4$/K0}}$))<GlA
KK    	H("!("2"27E"B")1 ;hFG	Hs   E 6F;FFc                 @   [         R                  SUR                  -  [        SS9S9  [        [        R
                  UR                  (       a  SOSUR                  S9n[        R                  " SS	S
R                  [        [        U SS5      5      UR                  5      4U[        R                  [        R                  [        R                  S9nUR                  5       u  pVUR                  (       a  [         R                  U5        [         R                  S5        g)P
Download source code for npm, unpack it
and install it in virtual environment.
 * Install npm.js (%s) ... Tr   r   noyes)cleannpm_installshr   z. {0} && npm install -g npm@{1}r  activate)rk   r   r|   r   r   N)r   r   rV   r   r#   r   r   r}   r~   r1   r  rJ   r   r   r   r:   )r   _src_dirr   rk   r  rg   r   s          r   install_npmr  %  s    
 KK-8T*  ,



''dUHHC
 $-44tGUJ78	
 oo  D FC||C
KKrN   c                    [         R                  SUR                  -  [        SS9S9  SUR                  -  n[        R
                  " [        U5      R                  5       5      n[        U S5      n[        USS5      n[        R                  R                  U5      (       a  [        R                  " U5        [        R                  R                  [        US	5      5      (       a   [        R                  " [        US	5      5        [        R                  R                  [        US
5      5      (       a   [        R                  " [        US
5      5        [        R                   " US5       nUR#                  U5        SSS5        SUR                  -  n[        R$                  " [        X5      U5        [        R&                  " [        XSS	5      [        US	5      5        [        R&                  " [        XSS
5      [        US
5      5        [(        (       a  [        R&                  " [        US
5      [        U SS
5      5        [        R$                  " [        US5      [        U SS5      5        Sn	SR+                  XR                  5      n
[-        [        U SS5      [        U
5      R                  5       5        gg! , (       d  f       GNF= f)r  r  Tr   r   z*https://github.com/npm/cli/archive/v%s.zipr  node_modulesrV   znpm.cmdz
npm-cli.jsr   Nzcli-%sr  z)https://raw.githubusercontent.com/npm/cliz{}/{}/bin/npm)r   r   rV   r   rB  rC  rD  r'   rJ   r#   r$   r&   rw  rmtreeremoverR  rS  rZ  rx  r   r3  r1   r   )r   r[  r   npm_urlnpm_contentsbin_pathnode_modules_pathzipfnpm_ver
npm_gh_urlnpm_bin_urls              r   install_npm_winr  D  s   
 KK-8T*  ,:TXXEG::gg.3356LGY'HX~u=	ww~~'(('(	ww~~d8Y/00
		$x+,	ww~~d8\233
		$x./	s	+t  
, !G
OOD*,=>
KKWui8Xy)+
KKWul;X|,. yD<0%6	8X~6We^<	>@
%,,ZB$wu-w{/C/H/H/JK  
,	+s   +J<<
Kc                 N   [         R                  S[        SS9S9  [        UR                  5      R                  5        Vs/ s H  o"R                  5       PM     nn[        U SS5      nUR                  R                  S5      S:X  a  UR                  OUR                  S	-   nUR                  S
:X  d  US:  a  S[        U5      -   S-   nOS[        U5      -   S-   S-   nU H'  nU(       d  M  [        USU0-  /UR                  SS9  M)     [         R                  S5        gs  snf )z"
Install node.js packages via npm
z  * Install node.js packages ... Tr   r   r  r  ro   rp   z.0r   z1.0.0z. z && npm install -g %(pack)sz && npm install %(pack)sz && npm activate %(pack)spack)r  r  r	  r   N)r   r   r   r4   r   	readlinesr6   rJ   rV   countr  r  r:   )r   r   packagepackagesactivate_pathreal_npm_verr  s          r   install_packagesr  n  s#    KK2T*  , T&&'11353 %,3  5%4M#xx~~c2a7488TXX_Lxx8|w6VM**+, VM**())* 67##%26,,	O  KK%5s   D"c                    [         (       a7  [        [        [        S.n[	        U S5      n[	        US5      n[	        US5      nO6[
        [        [        S.n[	        U S5      n[	        US5      n[	        US5      n[        (       a  [        U5        UR                  S	:X  a	  [        US'   [	        S
S5      nUR                  =(       d?    S[        R                  R                  [        R                  R                  U 5      5      -  nUR                  S	:X  aM  [!        [        R"                  S   U5      nS H  n	[$        R&                  " XS9nUc  M    O   U(       d   S5       eUR)                  5        GHa  u  p[	        X:5      nUR+                  SU5      nUR+                  S[        R                  R                  U 5      5      nUR+                  SU5      nUR+                  S[        R                  R                  U5      5      nUR+                  SU5      n[        (       aC  [-        SS[        R                  R                  U5      /SSS9u  pUR+                  SUS   5      nOUR+                  SS5      nSnUR.                  (       a?  [0        R3                  U
S5      n[4        R3                  U
S5      nUU-   U-   n[7        U5      n[9        XUS9  GMd     [        R                  R;                  U5      (       d5  [         (       a   [-        S US/S!S!5        g[        RB                  " SU5        gg! [<         a    [>        RA                  S"5         gf = f)#z/
Install virtual environment activation script
)zactivate.batzdeactivate.batzActivate.ps1r  r  z
nodejs.exe)r  activate.fishshimr  r    nodejsrz   libr  z(%s)r  )r  r    r   Nz-Did not find nodejs or node system executable__NODE_VIRTUAL_PROMPT____NODE_VIRTUAL_ENV____SHIM_NODE____BIN_NAME____MOD_NAME__cygpathz-wF)r  r	  __NPM_CONFIG_PREFIX__r   z$NODE_VIRTUAL_ENVre   )r   mklinkTz'Error: Failed to create nodejs.exe link)"r   ACTIVATE_BATDEACTIVATE_BATACTIVATE_PS1rJ   ACTIVATE_SHACTIVATE_FISHSHIMr3  r   r    r   r#   r$   r2   r  rm   r   rw  r  r   rf   r  r   DISABLE_PROMPTr/   ENABLE_PROMPTr-   r   r&   r  r   r   rz  )r   r   filesbin_dir	shim_nodeshim_nodejsmod_dirr   path_var	candidaterQ  r   	file_pathr   cyg_bin_dirneed_appenddisable_promptenable_prompts                     r   install_activater    s    v(,(

 w	**-	7L1 $*

 w&&)	7H-ygyyHf5.)G[[OFRWW%5%5bggoog6N%OOFyyH+BJJv,>H+IY>I$ , IIIy'	//";VD//"8"$''//'":<///9=//."''2B2B72KL//.':9#D"''//'":;!E3NA oo&={1~NGoo&=&9;G !!+//b9N)--dB7M$w.>G~.K)[99 '< 77>>+&&6H+z:D$G JJv{+ '  HFGHs   	L3 3MMc                     [         (       d6  [        [        U SS5      S5       nUR                  [        5        S S S 5        g g ! , (       d  f       g = f)Nr  predeactivatea)r   r4   rJ   r   PREDEACTIVATE_SH)r   hooks     r   set_predeactivate_hookr    s=    6$w7=JJ'( >= ==s   A
Ac                 `   [         R                  R                  U 5      (       aN  UR                  (       d=  [        R                  SU 5        UR                  (       d  [        R                  " S5        [        [        [        U S5      5      5      n[        U5        UR                  S:w  a  [        XU5        O@[        [        U S5      5        [        [        U S5      5        [        [        U SS5      5        [        X5        [!        U5      S:  d  UR"                  (       a+  [$        (       d  [&        (       a  [(        O[*        nU" XU5        UR,                  (       a  [/        X5        UR                  (       a  [1        U 5        UR2                  (       a  [4        R6                  " U5        g	g	)
z+
Creates a new environment in ``env_dir``.
z! * Environment already exists: %srp   r}  rz   r  r  r  )r      r   N)r#   r$   r&   r   r   r   r   r   exitr   r  rJ   r   r    r  r  r   rW   r   r3  r  r  r   r  r  r   rw  r  )r   r   r[  instfuncs       r   create_environmentr    s    
ww~~gt'='=7AzzHHQKgd7E234G	'NyyHWt,d7E"#d7E"#d7E>23 W#d#i/4==&,f		?{4('w'~~g rN   c                      [        S[        -  5      n [        R                  " U R	                  5       R                  S5      5      $ )Nz%s/index.jsonzUTF-8)rD  r  jsonloadsr'   r   )responses    r   _get_versions_jsonr    s1    56H::hmmo,,W566rN   c                  p    [        5        V s/ s H  o S   R                  S5      PM     sn S S S2   $ s  sn f )Nr   r!   )r  r7   )dcts    r   get_node_versionsr    s5    2D2FG2F3	N!!#&2FG"MMGs   3c                      [        5       n [        S[        U 5      S5       Vs/ s H	  oXS-    PM     nnU H'  n[        R	                  SR                  U5      5        M)     gs  snf )z3
Prints into stdout all available node.js versions
r      	N)r  rangers   r   r   rJ   )versionsposchunks_of_8chunks       r   print_node_versionsr    sc     !"H).q#h-)C)C#1W)C   DIIe$% s   A#c                    ^ ^ [        [        5       [        5       T S.5        U 4S jm[        U4S j[	        5        5       S5      $ )z1
Return last node.js version matching the filter
)r$  riscltsc                    > T(       a  U S   (       d  g[        5       (       a
  SU S   ;  a  g[        5       (       a
  SU S   ;  a  gg)Nr  Fzlinux-x64-muslr  zlinux-riscv64T)r  r"  )r!   r  s    r   version_filter._get_last_node_version.<locals>.version_filter  s?    qx 0'
 B\\oQwZ?rN   c              3   j   >#    U  H(  nT" U5      (       d  M  US    R                  S5      v   M*     g7f)r   r!   N)r7   )rF   r!   r  s     r   rH   )_get_last_node_version.<locals>.<genexpr>%  s4      E.Q.2C *9$$S)).s   33N)r0   r  r"  nextr  )r  r  s   `@r   _get_last_node_versionr    sD     
."JL
EF	  E,.EFJL LrN   c                      [        5       $ )z$
Return last stable node.js version
r  rO   rN   r   get_last_stable_node_versionr  )  s     "##rN   c                      [        SS9$ )z/
Return the last node.js version marked as LTS
T)r  r  rO   rN   r   get_last_lts_node_versionr  0  s     "d++rN   c                     U R                   (       a  [        [        S5      (       a  [        R                  nO[        [        S5      (       a3  [        R                  [        R                  :w  a  [        R                  nOS[
        R                  ;   a  [        R                  nO`S[
        R                  ;   a  [
        R                  S   nO8[        R                  S5        [        R                  " S5        OU R                  n[        W5      $ )Nreal_prefixbase_prefixCONDA_PREFIXVIRTUAL_ENVz!No python virtualenv is availablerp   )r   hasattrr   prefixr"  r#   r   r   r   r  r   r   )r   ress     r   get_env_dirr(  7  s    3&&**CS-((S__

-J**Crzz)**Cbjj(**]+CLL<=HHQKll3<rN   c                     S[         R                  ;   a  [        R                  5         g[	        SS9n [        R                  U R                  U R                  5        [	        5       n U R                  R                  5       S:X  a+  [        (       a   [        R                  S5        [        S5        U R                  qSnU R                  (       a*  SU R                  ;   a  U R                  qO0U R                  nO#[#        5       (       d  [%        5       (       a  S	nOS
n[         c  SU-  qU R                  (       a  U R                  R                  5       S:X  a  ['        5       U l        O-U R                  R                  5       S:X  a  [)        5       U l        U R*                  (       a  [-        5         gU R.                  (       a  [1        U 5      n[3        X 5        g[1        U 5      n[5        X 5        g)z
Entry point
z--dump-config-defaultsNF)r   rz   z4Installing system node.js on win32 is not supported!r   z://zunofficial-builds.nodejs.orgz
nodejs.orgzhttps://%s/download/releaser   r  )r   argvr   rL   r   rA   r   r:   r    r2  r   r   r   r  r]   r^   r  r  r"  r  r  r   r  r   r(  r  r  )r   
src_domainr   s      r   mainr,  J  sI   
  388+E"D
LL!!4<<0<DyyH$KLQ
 ,,J{{DKK;;LJ			Z\\3
!
4zA99		)X502			e	#-/	yy	d#'d#7)rN   z
# disable nodeenv's prompt
# (prompt already changed by original virtualenv's script)
# https://github.com/ekalinin/nodeenv/issues/26
NODE_VIRTUAL_ENV_DISABLE_PROMPT=1
z
# disable nodeenv's prompt
# (prompt already changed by original virtualenv's script)
# https://github.com/ekalinin/nodeenv/issues/26
set NODE_VIRTUAL_ENV_DISABLE_PROMPT 1
)r  r  z'
unset NODE_VIRTUAL_ENV_DISABLE_PROMPT
z(
set -e NODE_VIRTUAL_ENV_DISABLE_PROMPT
z#!/usr/bin/env sh
export NODE_PATH='__NODE_VIRTUAL_ENV__/lib/node_modules'
export NPM_CONFIG_PREFIX='__NODE_VIRTUAL_ENV__'
export npm_config_prefix='__NODE_VIRTUAL_ENV__'
exec '__SHIM_NODE__' "$@"
aQ  
@echo off
set "NODE_VIRTUAL_ENV=__NODE_VIRTUAL_ENV__"
if not defined PROMPT (
    set "PROMPT=$P$G"
)
if defined _OLD_VIRTUAL_PROMPT (
    set "PROMPT=%_OLD_VIRTUAL_PROMPT%"
)
if defined _OLD_VIRTUAL_NODE_PATH (
    set "NODE_PATH=%_OLD_VIRTUAL_NODE_PATH%"
)
set "_OLD_VIRTUAL_PROMPT=%PROMPT%"
set "PROMPT=__NODE_VIRTUAL_PROMPT__ %PROMPT%"
if defined NODE_PATH (
    set "_OLD_VIRTUAL_NODE_PATH=%NODE_PATH%"
    set NODE_PATH=
)
if defined _OLD_VIRTUAL_PATH (
    set "PATH=%_OLD_VIRTUAL_PATH%"
) else (
    set "_OLD_VIRTUAL_PATH=%PATH%"
)
set "PATH=%NODE_VIRTUAL_ENV%\Scripts;%PATH%"
:END

aV  @echo off
if defined _OLD_VIRTUAL_PROMPT (
    set "PROMPT=%_OLD_VIRTUAL_PROMPT%"
)
set _OLD_VIRTUAL_PROMPT=
if defined _OLD_VIRTUAL_NODE_PATH (
    set "NODE_PATH=%_OLD_VIRTUAL_NODE_PATH%"
    set _OLD_VIRTUAL_NODE_PATH=
)
if defined _OLD_VIRTUAL_PATH (
    set "PATH=%_OLD_VIRTUAL_PATH%"
)
set _OLD_VIRTUAL_PATH=
set NODE_VIRTUAL_ENV=
:END
aj  
function global:deactivate ([switch]$NonDestructive) {
    # Revert to original values
    if (Test-Path function:_OLD_VIRTUAL_PROMPT) {
        copy-item function:_OLD_VIRTUAL_PROMPT function:prompt
        remove-item function:_OLD_VIRTUAL_PROMPT
    }
    if (Test-Path env:_OLD_VIRTUAL_NODE_PATH) {
        copy-item env:_OLD_VIRTUAL_NODE_PATH env:NODE_PATH
        remove-item env:_OLD_VIRTUAL_NODE_PATH
    }
    if (Test-Path env:_OLD_VIRTUAL_PATH) {
        copy-item env:_OLD_VIRTUAL_PATH env:PATH
        remove-item env:_OLD_VIRTUAL_PATH
    }
    if (Test-Path env:NODE_VIRTUAL_ENV) {
        remove-item env:NODE_VIRTUAL_ENV
    }
    if (!$NonDestructive) {
        # Self destruct!
        remove-item function:deactivate
    }
}

deactivate -nondestructive
$env:NODE_VIRTUAL_ENV="__NODE_VIRTUAL_ENV__"

# Set the prompt to include the env name
# Make sure _OLD_VIRTUAL_PROMPT is global
function global:_OLD_VIRTUAL_PROMPT {""}
copy-item function:prompt function:_OLD_VIRTUAL_PROMPT
function global:prompt {
    Write-Host -NoNewline -ForegroundColor Green '__NODE_VIRTUAL_PROMPT__ '
    _OLD_VIRTUAL_PROMPT
}

# Clear NODE_PATH
if (Test-Path env:NODE_PATH) {
    copy-item env:NODE_PATH env:_OLD_VIRTUAL_NODE_PATH
    remove-item env:NODE_PATH
}

# Add the venv to the PATH
copy-item env:PATH env:_OLD_VIRTUAL_PATH
$env:PATH = "$env:NODE_VIRTUAL_ENV\Scripts;$env:PATH"
a  

# This file must be used with "source bin/activate" *from sh*
# you cannot run it directly

deactivate_node () {
    # reset old environment variables
    if [ -n "${_OLD_NODE_VIRTUAL_PATH:-}" ] ; then
        PATH="${_OLD_NODE_VIRTUAL_PATH:-}"
        export PATH
        unset _OLD_NODE_VIRTUAL_PATH

        NODE_PATH="${_OLD_NODE_PATH:-}"
        export NODE_PATH
        unset _OLD_NODE_PATH

        NPM_CONFIG_PREFIX="${_OLD_NPM_CONFIG_PREFIX:-}"
        npm_config_prefix="${_OLD_npm_config_prefix:-}"
        export NPM_CONFIG_PREFIX
        export npm_config_prefix
        unset _OLD_NPM_CONFIG_PREFIX
        unset _OLD_npm_config_prefix
    fi

    # This should detect bash and zsh, which have a hash command that must
    # be called to get it to forget past commands.  Without forgetting
    # past commands the $PATH changes we made may not be respected
    if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
        hash -r
    fi

    if [ -n "${_OLD_NODE_VIRTUAL_PS1:-}" ] ; then
        PS1="${_OLD_NODE_VIRTUAL_PS1:-}"
        export PS1
        unset _OLD_NODE_VIRTUAL_PS1
    fi

    unset NODE_VIRTUAL_ENV
    if [ ! "${1:-}" = "nondestructive" ] ; then
    # Self destruct!
        unset -f deactivate_node
    fi
}

freeze () {
    local NPM_VER=`npm -v | cut -d '.' -f 1`
    local re="[a-zA-Z0-9\.\-]+@[0-9]+\.[0-9]+\.[0-9]+([\+\-][a-zA-Z0-9\.\-]+)*"
    if [ "$NPM_VER" = '0' ]; then
        NPM_LIST=`npm list installed active 2>/dev/null | \
                  cut -d ' ' -f 1 | grep -v npm`
    else
        local npmls="npm ls -g"
        if [ "${1:-}" = "-l" ]; then
            npmls="npm ls"
            shift
        fi
        NPM_LIST=$(eval ${npmls} | grep -E '^.{4}\w{1}'| \
                                   grep -o -E "$re"| grep -v npm)
    fi

    if [ -z "$@" ]; then
        echo "$NPM_LIST"
    else
        echo "$NPM_LIST" > $@
    fi
}

# unset irrelevant variables
deactivate_node nondestructive

# find the directory of this script
# http://stackoverflow.com/a/246128
if [ "${BASH_SOURCE:-}" ] ; then
    SOURCE="${BASH_SOURCE[0]}"

    while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
    DIR="$( command cd -P "$( dirname "$SOURCE" )" > /dev/null && pwd )"

    NODE_VIRTUAL_ENV="$(dirname "$DIR")"
else
    # dash not movable. fix use case:
    #   dash -c " . node-env/bin/activate && node -v"
    NODE_VIRTUAL_ENV="__NODE_VIRTUAL_ENV__"
fi

# NODE_VIRTUAL_ENV is the parent of the directory where this script is
export NODE_VIRTUAL_ENV

_OLD_NODE_VIRTUAL_PATH="$PATH"
PATH="$NODE_VIRTUAL_ENV/lib/node_modules/.bin:$NODE_VIRTUAL_ENV/__BIN_NAME__:$PATH"
export PATH

_OLD_NODE_PATH="${NODE_PATH:-}"
NODE_PATH="$NODE_VIRTUAL_ENV/__MOD_NAME__"
export NODE_PATH

_OLD_NPM_CONFIG_PREFIX="${NPM_CONFIG_PREFIX:-}"
_OLD_npm_config_prefix="${npm_config_prefix:-}"
NPM_CONFIG_PREFIX="__NPM_CONFIG_PREFIX__"
npm_config_prefix="__NPM_CONFIG_PREFIX__"
export NPM_CONFIG_PREFIX
export npm_config_prefix

if [ -z "${NODE_VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then
    _OLD_NODE_VIRTUAL_PS1="${PS1:-}"
    if [ "x__NODE_VIRTUAL_PROMPT__" != x ] ; then
        PS1="__NODE_VIRTUAL_PROMPT__ ${PS1:-}"
    else
    if [ "`basename \"$NODE_VIRTUAL_ENV\"`" = "__" ] ; then
        # special case for Aspen magic directories
        # see http://www.zetadev.com/software/aspen/
        PS1="[`basename \`dirname \"$NODE_VIRTUAL_ENV\"\``] ${PS1:-}"
    else
        PS1="(`basename \"$NODE_VIRTUAL_ENV\"`) ${PS1:-}"
    fi
    fi
    export PS1
fi

# This should detect bash and zsh, which have a hash command that must
# be called to get it to forget past commands.  Without forgetting
# past commands the $PATH changes we made may not be respected
if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
    hash -r
fi
a  

# This file must be used with "source bin/activate.fish" *from fish*
# you cannot run it directly

function deactivate_node -d 'Exit nodeenv and return to normal environment.'
    # reset old environment variables
    if test -n "$_OLD_NODE_VIRTUAL_PATH"
        set -gx PATH $_OLD_NODE_VIRTUAL_PATH
        set -e _OLD_NODE_VIRTUAL_PATH
    end

    if test -n "$_OLD_NODE_PATH"
        set -gx NODE_PATH $_OLD_NODE_PATH
        set -e _OLD_NODE_PATH
    else
        set -e NODE_PATH
    end

    if test -n "$_OLD_NPM_CONFIG_PREFIX"
        set -gx NPM_CONFIG_PREFIX $_OLD_NPM_CONFIG_PREFIX
        set -e _OLD_NPM_CONFIG_PREFIX
    else
        set -e NPM_CONFIG_PREFIX
    end

    if test -n "$_OLD_npm_config_prefix"
        set -gx npm_config_prefix $_OLD_npm_config_prefix
        set -e _OLD_npm_config_prefix
    else
        set -e npm_config_prefix
    end

    if test -n "$_OLD_NODE_FISH_PROMPT_OVERRIDE"
        # Set an empty local `$fish_function_path` to allow the removal of
        # `fish_prompt` using `functions -e`.
        set -l fish_function_path

        # Prevents error when using nested fish instances
        if functions -q _node_old_fish_prompt
            # Erase virtualenv's `fish_prompt` and restore the original.
            functions -e fish_prompt
            functions -c _node_old_fish_prompt fish_prompt
            functions -e _node_old_fish_prompt
        end
        set -e _OLD_NODE_FISH_PROMPT_OVERRIDE
    end

    set -e NODE_VIRTUAL_ENV

    if test (count $argv) = 0 -o "$argv[1]" != "nondestructive"
        # Self destruct!
        functions -e deactivate_node
    end
end

function freeze -d 'Show a list of installed packages - like `pip freeze`'
    set -l NPM_VER (npm -v | cut -d '.' -f 1)
    set -l RE "[a-zA-Z0-9\.\-]+@[0-9]+\.[0-9]+\.[0-9]+([\+\-][a-zA-Z0-9\.\-]+)*"

    if test "$NPM_VER" = "0"
        set -g NPM_LIST (npm list installed active >/dev/null ^/dev/null |                          cut -d ' ' -f 1 | grep -v npm)
    else
        set -l NPM_LS "npm ls -g"
        if test (count $argv) -gt 0 -a "$argv[1]" = "-l"
            set NPM_LS "npm ls"
            set -e argv[1]
        end
        set -l NPM_LIST (eval $NPM_LS | grep -E '^.{4}\w{1}' |                                         grep -o -E "$re" |                                         grep -v npm)
    end

    if test (count $argv) = 0
        echo $NPM_LIST
    else
        echo $NPM_LIST > $argv[1]
    end
end

# unset irrelevant variables
deactivate_node nondestructive

# find the directory of this script
begin
    set -l SOURCE (status filename)
    while test -L "$SOURCE"
        set SOURCE (readlink "$SOURCE")
    end
    set -l DIR (dirname (realpath "$SOURCE"))

    # NODE_VIRTUAL_ENV is the parent of the directory where this script is
    set -gx NODE_VIRTUAL_ENV (dirname "$DIR")
end

set -gx _OLD_NODE_VIRTUAL_PATH $PATH
# The node_modules/.bin path doesn't exists and it will print a warning, and
# that's why we redirect stderr to /dev/null :)
set -gx PATH "$NODE_VIRTUAL_ENV/lib/node_modules/.bin" "$NODE_VIRTUAL_ENV/__BIN_NAME__" $PATH ^/dev/null

if set -q NODE_PATH
    set -gx _OLD_NODE_PATH $NODE_PATH
    set -gx NODE_PATH "$NODE_VIRTUAL_ENV/__MOD_NAME__" $NODE_PATH
else
    set -gx NODE_PATH "$NODE_VIRTUAL_ENV/__MOD_NAME__"
end

if set -q NPM_CONFIG_PREFIX
    set -gx _OLD_NPM_CONFIG_PREFIX $NPM_CONFIG_PREFIX
end
set -gx NPM_CONFIG_PREFIX "__NPM_CONFIG_PREFIX__"

if set -q npm_config_prefix
    set -gx _OLD_npm_config_prefix $npm_config_prefix
end
set -gx npm_config_prefix "__NPM_CONFIG_PREFIX__"

if test -z "$NODE_VIRTUAL_ENV_DISABLE_PROMPT"
    # Copy the current `fish_prompt` function as `_node_old_fish_prompt`.
    functions -c fish_prompt _node_old_fish_prompt

    function fish_prompt
        # Save the current $status, for fish_prompts that display it.
        set -l old_status $status

        # Prompt override provided?
        # If not, just prepend the environment name.
        if test -n "__NODE_VIRTUAL_PROMPT__"
            printf '%s%s ' "__NODE_VIRTUAL_PROMPT__" (set_color normal)
        else
            printf '%s(%s) ' (set_color normal) (basename "$NODE_VIRTUAL_ENV")
        end

        # Restore the original $status
        echo "exit $old_status" | source
        _node_old_fish_prompt
    end

    set -gx _OLD_NODE_FISH_PROMPT_OVERRIDE "$NODE_VIRTUAL_ENV"
end
zA
if type -p deactivate_node > /dev/null; then deactivate_node;fi
z#!/bin/sh

if [ -r "$1" ]; then
    SCRIPT_PATH=$(cygpath -w "$1")
    shift
    set - $SCRIPT_PATH $@
    unset SCRIPT_PATH
fi

exec $(dirname "$0")/node.exe "$@"
__main__)T)TF)TFNN)r   )FNrP   )jrU   
contextlibrB  r   r   r#   rW  rk  r   r   rT  r   r}   r<  r  pipesr   r  shlexr   rR  rw  r  r  r   r   ri  rU  r   httplibrE  ImportErrorconfigparserurllib.requestrequesthttpclientr   r$   rJ   r  r  r   rz   r   r*   r3  r]   r   objectr   r   r)   _defaultrh   rm   rx   r   r   r   r   r   r   r   r   r  r  r  r"  r7  r:  contextmanagerr@  rI  re  rD  rx  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r(  r,  r  r  r  r  r  r  r  r  r  r  rQ   rO   rN   r   <module>r;     s    	  
 	 	 
      f%%     0=%%k2I++N 	ww||
''//			!		!		i	'OO(();<	 (?'V ?'D  !*4<!8 1.	$> 
Pf>	=""J ,1#B'JO+,B,
   2:
  #$1:1Kh
 F>'LT6L,^)B7
N	&L*$,&2*r 	8$-^}@M^ 
 zF e/  0)$%%g.I[[//N0s   ),G= =>H?>H?