gSjdZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ejdkrddlmZnddlmZddlZddlZddlZddlZddlZ ddlmZddlZe j6dZddlZej<Zd Z%ejLjNZ'ejLjPZ(da)ejdd k\Z*ejVd k(Z,ejVj[d Z.d a/dZ0Gdde1Z2e3dee4e2De2_5dZ6dZ7dZ8dZ9dZ:e:Z;dZdZ?dGdZ@ dHdZAdZBdZCdZDd ZEd!ZFejd"ZHdId#ZId$ZJd%ZKdJd&ZLd'ZMd(ZNd)ZOd*ZPd+ZQd,ZRd-ZSd.ZTd/ZUd0ZVd1ZWd2ZXd3ZYd4ZZd5Z[d6Z\d7Z]d8d9d:Z^d;dZad?Zbd@ZcdAZddBZedCZfdDZgehdEk(re]yy#e$r<ddl mZddl!m"Ze j6dZddl#Z#e#jHj<ZYwxYw)Kz nodeenv ~~~~~~~ Node.js virtual environment :copyright: (c) 2014 by Eugene Kalinin :license: BSD, see LICENSE for more details. N)r)quote)SafeConfigParser iteritems) ConfigParseritemsz1.9.1rWindows)CYGWINMSYSFc |rtr|S |jdS#t$r\ |jd|cYS#t$r9 |jdjdcYcYS#t$rYnwxYwYY|SwxYwwxYw)z:Convert given text to UTF-8 encoding (as far as possible).utf8cp1252)is_PY3encodeUnicodeDecodeErrordecode)texts 6/opt/hc_python/lib/python3.12/site-packages/nodeenv.pyto_utf8rDs 6  {{6""   KK K!  {{8,33F;;%   K   sS B<B A>A*%A>&B* A63A>5A66A>9B=A>>Bc^eZdZdZdZdZdZdZdZdZ dZ dZ dZ dZ dZed dZed Zy) Configz" Configuration namespace. latestF2makeTNc Zt|D].}tjj|}tjj |sCt }|j |d}|j|srtt|D]\}}|jds|j||s*t|tr|j||}n|j||}|r9t!dj#tjj%|||t'|||1tjj drCt)dd5}t'|d|j+ddj-d d d y y #1swYy xYw) 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_zCONFIG {0}: {1} = {2}z .node-versionrnoderN)reversedospath expanduserexistsrread has_sectionrvars startswith has_option isinstancebool getbooleangetprintformatbasenamesetattropen readlinesstrip) cls configfilesverbose configfileini_filesectionattrvalv_files r_loadz Config._loadjsY#;/J++J7J77>>*-#~H MM* %G''0&tCy1 c??3'&&w5c4("--gt>/ *os+vVV%5%5a%8%;%A%A%CD,+ +++s ).F!!F*c tdtddjdttt |Dzy)z0 Print defaults for the README. z [nodeenv]z z c3RK|]\}}|jds |d|!yw)rz = Nr)).0kvs r zConfig._dump..s-%&+G41a<<$A +Gs%'N)r/joinsortedrr()r6s r_dumpz Config._dumpsA o fx}}%&+1)DI2F+G%&&& ')F)__name__ __module__ __qualname____doc__rnpmwith_npmjobs without_ssldebugprofilerprebuiltignore_ssl_certsmirror classmethodr?rIrJrrrXsj D CH DK EG DH F"E"EH''rJrc#LK|]\}}|jds||fyw)rNrB)rCr<r=s rrFrFs,!8ID# ??3  3K!8s"$cD|jdjddS)z Remove new-lines and utf-8 )rreplace)outs r clear_outputras  ::g  & &tR 00rJc,|j|dzdS)zC Remove bin directory of the current environment from PATH :r^)r_)env env_bin_dirs rremove_env_bin_from_pathrfs ;;{S(" --rJc|jddjddd}t|dk\r|djdd|d<tt t |S) z: Parse version string to a tuple of integer parts rEr^.Nr+r)r_splitlentuplemapint) version_strrEs r parse_versionrqs^ C$**3/3A 1v{tzz#q!! S! rJc|jdk(rLtjddgtjj \}}t t |St |jS)z7 Parse the node version from the argparse args systemr --version)stdout)r subprocessPopenPIPE communicaterqra)argsr`errs rnode_version_from_argsr|s[ yyH## [ !*//;;F;= S\#.//  ##rJcttjd}|jtjd}|tj_tj}|jtj tjd}|j||j||S)z& Create logger for diagnostic rc|j|}t|ddrdnd}|jj|t |z|j y)N continuedFz%sz%s )r0getattrstreamwriterflush)selfrecordmsgfss remitzcreate_logger..emitsFkk&!V[%8Tf "ws|+, rJz %(message)s)fmt) logging getLoggersetLevelINFO StreamHandlerrDEBUG Formatter setFormatter addHandler)loggrrch formatters r create_loggerrs   i (E NN7<<  "&G    BKK !!m4IOOI R LrJctjd}|jddt|jdddd tj d |jd d dtj dts|jdddtjd|jddd|jdddtjd|jdd dtjd!|jd"d#dtjd$|jd%d&d'd(d)tj*|jd+d,d-tjd.|jd/d0dd1d2d3|jd4d5dd6d2d7|jd8d9d:d;d<|jd=d>d?d@dAdBC|jdDdEdF|jdGdHdIdd2dJ|jdKdLdd2dM|jdNdOdtjdP|jdQdRdStjdT |jdUdVdd2dW|jdXdYdZdd2d[|jd\d]d^dd2d_|jd`dadd2db|jdcd,dtjdd|jdedfdtj dg|jdhdidjdkl|S)mz. Make a command line argument parser. z%(prog)s [OPTIONS] DEST_DIR)usagertversion)actionrz-nz--noderNODE_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.)destmetavardefaulthelpz--mirrorstorerWz1Set mirror server of nodejs.org to download from.)rrrrz-jz--jobsrQzOSets number of parallel commands at node.js compilation. The default is 2 jobs.)rrrz--load-average load_averagezQSets maximum load average for executing parallel commands at node.js compilation.)rr --without-sslrR store_truez!Build node.js without SSL support)rrrr--debugrSz"Build debug variant of the node.js --profilerTzEnable profiling for node.jsz--makez-m make_path MAKE_PATHzPath to make command)rrrrz--sourcerU store_falsezInstall node.js from the sourcez-vz --verboser8Fz Verbose modez-qz--quietquietz 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 requirementsr^FILENAMEz?Install all the packages listed in the given requirements file.)rrrrz--promptpromptz:Provides an alternative prompt prefix for this environmentz-lz--listlistz Lists available node.js versionsz--updateupdatez+Install npm packages from file without nodez --with-npmrPzBuild 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--npmrONPM_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-ppython_virtualenvzUse current python virtualenvz --clean-src-c clean_srcz)Remove "src" directory after installationz--forceforcez.Force installation in a pre-existing directoryz --prebuiltz/Install node.js from prebuilt package (default)z--ignore_ssl_certsrVz5Ignore certificates for package downloads. - UNSAFE -DEST_DIRenv_dir?zDestination directory)rrnargsr)argparseArgumentParser add_argumentnodeenv_versionrrrWis_WINrQrRrSrTrrUrPrOrV)parsers r make_parserrs $ $+-F I@  hVZ01 Xv}} @B  (%  &  >&  '  -););4  6  G5  7  i/  1  d'KK  !  Z &//2  4   k)U    i'5    oM4FG    R NP   IK  hVU /1  U :<  :V__AB e6::<= ~U HJ  t*=U ,.  t+U 8:  U =?  :V__ >@  #5V%<%< DF  # $& MrJct}|j}|j gd|_ny|jsg|_netjj |js*|j dj|j|jg|_|s|S|js)|js|js|j d|S)z] 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>$  +T9M N D W 5t>$  )4td7K L $  GGG  W $ A a< LL94 @  KK+,0 2   KK14 8dD!Q "  8$? $  GGG  1   "  s0;F F3F#0F/ FF #F,/F8c g}g}|D]T}t|dkDr|dddz|ddz}d|vs d|vsd|vsd |vrd |jdd z}|j|Vdj|}tj d |z|rdj|}t j} |r2tjj} |r| j|nd} t j|t jd| || | } | j$} | r| j'} | snq t(r | j+dj-} n| j+dj-} |j| |rtj1| | r| j3| j4r9|r|D]}tj7|t9d|d| j4| j4|fS#t$r4tj d} tj#d| d|wxYw#t.$r"| j+dj-} YwxYw)z' Execute cmd line in sub-shell -Nz...i r]"'z"%s"z\"z ** Running command %s)stderrstdinrucwdrdshellr zError z while executing command mbcsr cp866zCommand z failed with error code )rlr_rrGrrSrvrxr"environcopyrrwSTDOUT Exceptionsysexc_inforrureadlinerrrstriprrwait returncodecriticalOSError)cmd show_stdoutin_shellr extra_env all_output cmd_partspartcmd_descrurdproceliness rcallitr s: JI t9r>9u$tCDz1D $;$$,#+DLLe44D  xx "H LL)H45hhsm__Fjjoo  JJy !  ))fH.[[F    1{{6*113{{6*113 $  KK   IIK  " !4??45 5 ??J &&=  LLN1  aJK " 1;;w'..0D 1s!*H-AI=H=(I+*I+cBt|dkDr td|dStS)N)rz/v/)rq src_base_url)rps r get_root_urlrs [!F*(+66rJc2tjddk(S)N HOST_GNU_TYPEzx86_64-pc-linux-musl) sysconfigget_config_varrYrJris_x86_64_muslrs  # #O 48N NNrJc0tjdk(S)Nriscv64)platformmachinerYrJr is_riscv64r!s     **rJcLiddddddddddddddd dd d d d d d d d dd dddddd}tjj|tjd}tst rd|z}nt rd}nd|z}d||}t||zS)Nx86i686x86_64x64amd64AMD64armv6larmv7larmv8laarch64arm64zarm64/v8armv8zarmv8.4ppc64les390xr)rsarchz-win-%(arch)s.zipz-linux-x64-musl.tar.gzz-%(system)s-%(arch)s.tar.gzznode-v)rrslowerrr is_CYGWINrr)rarchmapsysinfopostfixrs rget_node_bin_urlr/%s3 %% % %  %  (  ( ( 7  G  7 9  9!G&//#))+((*+G%/  */'9&0H  8 ++rJc(d|z}t||zS)Nznode-v%s.tar.gz)r)rtar_names rget_node_src_urlr2Fs 7*H  8 ++rJc/Ktj|i|} ||jy#|jwxYww)z!Compatibility layer because py26.N)tarfiler3close)rzkwargstfs r tarfile_openr8Ks7 t &v &B   sA.AAAc|dkDr. tjt|jSyy#t$r;}t j dj|||dz}|dk(r|Yd}~nd}~wwxYw|dkDr|P)zMDo multiple attempts to avoid incomplete data in case of unstable networkrz*Incomplete read while reading from {} - {}r N)ioBytesIOurlopenr&IncompleteReadrwarningr0)node_url n_attemptrs r_download_node_filerAUs a- ::gh/4467 7   NN%vh2  NIA~   a-s+5 A91A44A9c tjdtdt|}tjdtdtst r.t j|}tjd}d}n6t|}tjd}tjd }|5}tj|j}d |z} ||D cgc] } tj| || | "} } |j!|| d d d y cc} w#1swYy xYw) z Download source code rhTrrnamelistc|SrrY)r s rz#download_node_src..psrJ)fileobj getmembersnamez0node-v%s[^/]*/(README\.md|CHANGELOG\.md|LICENSE)N)rrrrArr+zipfileZipFileoperator methodcallerr8 attrgetterreescapermatch extractall) r?src_dirrz dl_contentsctxmembers member_namearchivenode_ver rexp_stringmember extract_lists rdownload_node_srcr\es KK4$/K0%h/K KK4$/K0 ook*'' 3! ;/'' 5))&1 99TYY'I "'* *xx [%89A *  7L1  s/D6/%D1D61D66D?c&d}ddtd|di}tj|d|}trOt j tj }tj|_tj||Stj|S)Nz$https://github.com/ekalinin/nodeenv/z User-Agentznodeenv/z ())context) rurllib2RequestrVssl SSLContext PROTOCOL_TLS CERT_NONE verify_moder<)urlhome_urlheadersreqr_s rr<r<sm5H/8LMG //#tW -C..!1!12!mmsG44 ??3 rJcdtj|D]}tjj||}tjj||}tjj |r t j |||||tjj|rJtjj|rtjtj||t j||y#t$rt ||||YwxYwr) r"listdirr#rGisdirshutilcopytreerislinksymlinkreadlinkcopy2)srcdstsymlinksignoreitemr ds rroros 3 GGLLd # GGLLd # 77==  11h7ww~~a ww~~a(JJr{{1~q1 Q"  1Ax0 1s9DD/.D/c.tjdtdtrt |d}t |n;t r3t |d}t |tt |ddtn|}|td|zz}tj|\}t||dt r?d D]:}t |d|}tjj|s0t|<tjdtdy ) z1 Copy prebuilt binaries into environment rhTrrScriptsbinrz /node-v%s*)rOnpxnode.exeN)rrrrrGrr+r CYGWIN_NODErglobror"r#r%r)rrR node_versionrsrc_folder_tpl src_folderrs rcopy_node_from_prebuiltrs KK4$/K0 GY' d GU# d $wv. <w|l'BCCN))N+KJ Zt$2HGUH5Hww~~h')3  KK4$/K0rJci}ddg}tfd|}t||Dcgc]8\}}|1t|dkDrdj||ndj|:} }}t t j dt j ddkDrtjd } | s td tjd | t|d } t| d } t| tjj!| st#dd| | gdj| tj$j'dd|d<ddt)|zg} j*r| j-djr| j-dj.r| j-dj0}t#| j2d||tj5dt7dt#|g| zj2d||tj5dt7dt#|dzgj2d||ycc}}w)Nz load-averagerQc<t|jddS)N-r)rr_)xrzs rrEz%build_node_from_src..s'$ #s 34rJrz --{0}={1}z--{0}majorripython2zbPython >=3.0 virtualenv detected, but no python2 command (required for building node.js) was foundz$ * Temporarily pointing python to %stmpbinpythonlnz-sz{}:{}PATHr^z ./configurez --prefix=%srrrTrhrrz install)rnziprlr0rr version_infornwhichrrrSrGrr"r#r%r rr._quoterRrrTrr8rr)rrR node_src_dirrzrdmake_param_namesmake_param_valuesrHvalue make_opts python2_pathnode_tmpbin_dirnode_tmpbin_linkconf_cmdmake_cmds ` rbuild_node_from_srcrs& C&/4 /1BCDKD%   u:> 4'&~~d3 4Cs#*:*:1*=>B||I. D   ;\Jw1: oww~~./ D$ .>? @nn_%'ZZ^^FB%?AF  w'H ( zz " || $~~H 8T\\4s; KK4$/K0 H: !4<<|SI KK4$/K0 Hz ! "DLL$ cJWs=Icf t|||y#t$rtjdwxYw)z` Download source code for node.js, unpack it and install it in virtual environment. r^N)install_node_wrapped BaseExceptionrr)rrRrzs r install_noders0 Wgt4  B s  0c t|}t|td|jz}|jrdnd}t j d|d|jdtd |jrt|j}nt|j}tjj|s t|||t j d td |jrt%|||jnt'||||t j dy#tj$r=d |vrt|j!d d ||nt j#d |zYwxYw)Nznode-v%srUsourcez * Install z node (z) Trrr%rzFailed to download from %srhz done.)abspathrGrrrUrrrr/r2r"r#r%r\r` HTTPErrorr_r>rr)rrRrzrsrc_typer?s rrrs:gGdii)?!@AL!]]zH KKh BT*, }}#DII.#DII. 77>>, ' H h 6 KK4$/K0 }}$))<GWlDA KK   H("!("2"27E"B")41;hFG  Hs D==A F  F c Dtjd|jztdttj |j rdnd|j}tjdd d jtt|d d |jf|tjtjtj }|j\}}|jrtj|tjdy)\ Download source code for npm, unpack it and install it in virtual environment.  * Install npm.js (%s) ... Trrnoyes)clean npm_installbashrz. {0} && npm install -g npm@{1}r|activate)rdrrurrN)rrrOrr"rrrvrwr0rrGrxrryr8)r_src_dirrzrdrr`rs r install_npmr%s  KK-8T*,  ''dUHH C    D - 4 4tGUJ78   oo   D   FC || C KKrJcjtjd|jztdd|jz}t j t |j}t|d}t|dd}tjj|rtj|tjjt|d rtjt|d tjjt|d rtjt|d tj |d 5}|j#|d d d d |jz}tj$t|||tj&t||dd t|d tj&t||dd t|d t(rtj&t|d t|dd tj$t|dt|ddd} dj+| |j} t-t|ddt | jy y #1swY;xYw)rrTrrz*https://github.com/npm/cli/archive/v%s.zipr{ node_modulesrOznpm.cmdz npm-cli.jsrNzcli-%sr|z)https://raw.githubusercontent.com/npm/cliz {}/{}/bin/npm)rrrOrr:r;r<r&rGr"r#r%rnrmtreeremoverIrJrQrorr+r0r) rrRrznpm_url npm_contentsbin_pathnode_modules_pathzipfnpm_ver npm_gh_url npm_bin_urls rinstall_npm_winrDs  KK-8T*,:TXXEG::gg.3356LGY'HX~u= ww~~'( '( ww~~d8Y/0 $x+, ww~~d8\23 $x./ s +t   ,!G OOD'*,=> KKWgui8Xy)+ KKWgul;X|,. D<0%6 8X~6We^< >@ %,,ZB $wu-w{/C/H/H/JK , +s J((J2cFtjdtdt|jj Dcgc]}|j }}t|dd}|jjddk(r |jn|jd z}|jd k(s|d k\rd t|zd z}nd t|zdzdz}|D]#}|st|d|izg|jd%tjdycc}w)z* Install node.js packages via npm z * Install node.js packages ... Trrr|rrhriz.0rz1.0.0z. z && npm install -g %(pack)sz && npm install %(pack)sz && npm activate %(pack)spack)rrrrN) rrrr3rr4r5rGrOcountrr r8)rrzpackagepackages activate_path real_npm_verrs rinstall_packagesrns% KK2T*,T&&'11353%, 3 5%4M#xx~~c2a7488TXX_L xx8|w6VM**+,VM**())*  67# #%26,, O  KK%5sDctr7tttd}t |d}t |d}t |d}n6t t td}t |d}t |d}t |d}tr t||jd k(r t|d<t d d }|jxs?d tjjtjj|z}|jd k(rtj j#}|j%d t'|d |idD]J} t)j*d| gt(j,|j/\} } t1| }|sJn|sJd|j3D]`\} } t || }| j5d|} | j5dtjj|} | j5d|} | j5dtjj|} | j5d|} trGt7ddtjj|gdd\} }| j5d|d} n| j5dd} d}|j8r?t:j=| d}t>j=| d}|| z|z} tA|}tC|| |ctjjE|s/tr t7d |dgd!d!y#tjLd|y#y##tF$rtHjKd"Yy#wxYw)$z7 Install virtual environment activation script )z activate.batzdeactivate.batz Activate.ps1r{r~z nodejs.exe)r activate.fishshimr|rnodejsrslibrz(%s)r)rrr)rurdz-Did not find nodejs or node system executable__NODE_VIRTUAL_PROMPT____NODE_VIRTUAL_ENV__ __SHIM_NODE__ __BIN_NAME__ __MOD_NAME__cygpathz-wF)rr__NPM_CONFIG_PREFIX__rz$NODE_VIRTUAL_ENVr^)rmklinkTz'Error: Failed to create nodejs.exe linkN)'r ACTIVATE_BATDEACTIVATE_BAT ACTIVATE_PS1rG ACTIVATE_SH ACTIVATE_FISHSHIMr+rrrr"r#r1rrrrrfrvrwrxryrarr_r rDISABLE_PROMPTr. ENABLE_PROMPTr,rr%rrrrq)rrzfilesbin_dir shim_node shim_nodejsmod_dirrrd candidatewhich_node_outputrrHr file_path cyg_bin_dir need_appenddisable_prompt enable_prompts rinstall_activaters (,(  w **- 7L1 $*  w&&) 7H-  g yyHf 5.)G [[ OFRWW%5%5bggoog6N%OOF yyHjjoo F4S['JKL+I#-#3#3)$!C$11< ! q%%67I ,IIIy g$' //";VD//"8"$''//'":<///9=//."''2B2B72KL//.': #D"''//'":;!E3NA{oo&={1~NGoo&=&9;G  ! !+//b9N)--dB7M$w.>G~.K)W[99'< 77>>+ &  H+z:D$G JJv{ + ' H FG Hs5MM?>M?cts6tt|ddd5}|jtdddyy#1swYyxYw)Nr| predeactivatea)rr3rGrPREDEACTIVATE_SH)rhooks rset_predeactivate_hookrs;  $w7 = JJ' (> =  = =s >Actjj|rC|js7tj d||j stjdttt|d}t||jdk7rt|||n@tt|dtt|dtt|ddt||t!|dks |j"r"t$st&rt(nt*}|||||j,r t/|||jr t1||j2rt5j6|y y ) z3 Creates a new environment in ``env_dir``. z! * Environment already exists: %srirtrsr|rr)rrN)r"r#r%rrrrrexitrrrGrrrrr|rPrr+rrrrrrrnr)rrzrRinstfuncs rcreate_environmentrs ww~~gt'='= 7Azz HHQKgd7E234G 'N yyHWgt, d7E"# d7E"# d7E>23Wd#d#i/4==&, ?{'4( $' w' ~~ grJctdtz}tj|j j dS)Nz %s/index.jsonzUTF-8)r<rjsonloadsr&r)responses r_get_versions_jsonrs156H ::hmmo,,W5 66rJcltDcgc]}|djdc}dddScc}w)NrrErlstrip)dcts rget_node_versionsrs72D2F G2F3C N ! !# &2F G" MM Gs1ct}tdt|dDcgc] }|||dz }}|D]&}tj dj |(ycc}w)z; Prints into stdout all available node.js versions r N)rrangerlrrrG)versionspos chunks_of_8chunks rprint_node_versionsr sg!"H).q#h-)C)C#S1W)C DIIe$%sA c@tddjdS)z, Return last stable node.js version rrrErrYrJrget_last_stable_node_versionr s"   "9 - 4 4S 99rJc8tdtDdS)z7 Return the last node.js version marked as LTS c3NK|]}|dr|djdyw)ltsrrEN)r)rCrEs rrFz,get_last_lts_node_version..#s-<.Q!E(9$$S).s#%N)nextrrYrJrget_last_lts_node_versionrs& <,.<=A CCrJc|jrttdrtj}t|Sttdr/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)FN)irN contextlibr:rrr"rNrbrrrKrrvr4rpipesrrshlexrrIrnrrrrr`rLrhttplibr= ImportError configparserurllib.requestrequesthttpclientrr#rGrrrrsrr)r+rVrobjectrrr(_defaultrarfrqr|rrrrrrrr rrrr/r2contextmanagerr8rAr\r<rorrrrrrrrrrrrrr rrrrrrrrrrrrrrKrYrJrr)s f%%   0=%%%k2I++N ww|| ''//  !  !  i ' HOO  ( (); < (?'V?'D!*4 Pf> =""J,1#B'JO+,B,    2:  #$1:1Kh  F>'LT6P,f) B7 N &:C "2*r      8$- ^} @M ^   zFA/0)$%%%g.I[[//N 0s(,G11=H21H2