U eg@s dZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlZddlZddlZz0ddlmZddlZe dZddlZejZWnHek rddlmZddlmZe dZddlZej jZYnXddl!m"Z"dZ#ej$j%Z%ej$j&Z&da'ej(dd kZ)e*d kZ+e*,d Z-d a.d dZ/Gddde0Z1e2ddee3e1De1_4ddZ5ddZ6ddZ7ddZ8e8Z9ddZ:dlddZ;d d!Zdnd&d'Z?d(d)Z@d*d+ZAd,d-ZBd.d/ZCd0d1ZDejEd2d3ZFdod4d5ZGd6d7ZHd8d9ZIdpd:d;ZJdd?ZLd@dAZMdBdCZNdDdEZOdFdGZPdHdIZQdJdKZRdLdMZSdNdOZTdPdQZUdRdSZVdTdUZWdVdWZXdXdYZYdZd[ZZd\d]Z[d^d_d`Z\dadbd`Z]dcZ^ddZ_deZ`dfZadgZbdhZcdiZddjZeefdkkre[dS)qz nodeenv ~~~~~~~ Node.js virtual environment :copyright: (c) 2014 by Eugene Kalinin :license: BSD, see LICENSE for more details. N)SafeConfigParser iteritems) ConfigParseritems) parse_versionz1.8.0Windows)ZCYGWINZMSYSFcCs|rtr |Sz |dWStk rz|d|WYStk rz|ddWYYStk rzYnXYnXYnX|S)z:Convert given text to UTF-8 encoding (as far as possible).utf8cp1252)is_PY3encodeUnicodeDecodeErrordecode)textr5/opt/hc_python/lib/python3.8/site-packages/nodeenv.pyto_utf8Cs   rc@sVeZdZdZdZdZdZdZdZdZ dZ dZ dZ dZ dZed dd Zed d ZdS) Configz" Configuration namespace. latestF2makeTNc Cst|D]}tj|}tj|s&qt}||d}||sFqtt |D]n\}}| dsR| ||srqRt |t r|||}n |||}|rtdtj|||t|||qRqtjdrtdd }t|d|ddW5QRXd S) 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) clsZ configfilesverboseZ configfileZini_filesectionattrvalZv_filerrr_loadis6           z Config._loadc Cs4tdtddddttt|DdS)z0 Print defaults for the README. z [nodeenv]z z css(|] \}}|dsd||fVqdS)rz%s = %sNr$).0kvrrr s zConfig._dump..N)r*joinsortedrr#)r1rrr_dumpsz Config._dump)F)__name__ __module__ __qualname____doc__rnpmwith_npmjobs without_ssldebugprofilerprebuiltignore_ssl_certsmirror classmethodr6r>rrrrrWs  $rccs$|]\}}|ds||fVqdS)rNr7)r8r4r5rrrr;s r;cCs|dddS)z Remove new-lines and utf-8 )rreplace)outrrr clear_outputsrRcCs||ddS)zC Remove bin directory of the current environment from PATH :rO)rP)envZ env_bin_dirrrrremove_env_bin_from_pathsrUcCsD|jdkr:tjddgtjd\}}tt|ddSt|jS)z7 Parse the node version from the argparse args systemr --version)stdoutr:rO)r subprocessPopenPIPE communicaterrRrP)argsrQerrrrrnode_version_from_argss r_cCs^td}|tjdd}|tj_t}|tjtjdd}||| ||S)z& Create logger for diagnostic rcSs>||}t|ddrdnd}|j|t||dS)N continuedFz%sz%s )r+getattrstreamwriterflush)selfrecordmsgfsrrremits zcreate_logger..emitz %(message)s)fmt) logging getLoggersetLevelINFO StreamHandlerriDEBUG Formatter setFormatter addHandler)Zloggrrich formatterrrr create_loggers      rvcCs6tjdd}|jddtd|jdddd tjd d |jd d dtjddts|jdddtjdd|jdddd|jdddtj dd|jdd dtj d!d|jd"d#dtj d$d|jd%d&d'd(d)tj d*|jd+d,d-tj d.d|jd/d0dd1d2d3d|jd4d5dd6d2d7d|jd8d9d:d;dd?d@dAdBdC|jdDdEdFd|jdGdHdIdd2dJd|jdKdLdd2dMd|jdNdOdtjdPd|jdQdRdStjdTd |jdUdVdd2dWd|jdXdYdZdd2d[d|jd\d]d^dd2d_d|jd`dadd2dbd|jdcd,dtj ddd|jdedfdtjdgd|jdhdidjdkdl|S)mz. Make a command line argument parser. z%(prog)s [OPTIONS] DEST_DIR)usagerWversion)actionrxz-nz--noderZNODE_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--mirrorstorerKz1Set mirror server of nodejs.org to download from.)ryrzr|r}z-jz--jobsrEzOSets number of parallel commands at node.js compilation. The default is 2 jobs.)rzr|r}z--load-averageZ load_averagezQSets maximum load average for executing parallel commands at node.js compilation.)rzr} --without-sslrF store_truez!Build node.js without SSL support)rzryr|r}--debugrGz"Build debug variant of the node.js --profilerHzEnable profiling for node.jsz--makez-m make_pathZ MAKE_PATHzPath to make command)rzr{r}r|z--sourcerI store_falsezInstall node.js from the sourcez-vz --verboser2Fz 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 requirementsrOZFILENAMEz?Install all the packages listed in the given requirements file.)rzr|r{r}z--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-npmrDzBuild 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--npmrCZNPM_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_certsrJz5Ignore certificates for package downloads. - UNSAFE -ZDEST_DIRenv_dir?zDestination directory)r{rznargsr})argparseArgumentParser add_argumentnodeenv_versionrrrKis_WINrErFrGrHrrIrDrCrJ)parserrrr make_parsersx rTcCst}|}|jdkr&dddg|_n8|js4g|_n*tj|jsT|d|j|jg|_|sf|S|js|j s|j s|d|S)z] Parses command line arguments. Set `check` to False to skip validation checks. Nz ./tox.iniz ./setup.cfgz ~/.nodeenvrcz Config file '{0}' doesn't exist!z}t |j}d |fd d ||D}|||W5QRXdS)z Download source code .TrrnamelistcSs|Srr)rrrrdz#download_node_src..)fileobj getmembersnamez0node-v%s[^/]*/(README\.md|CHANGELOG\.md|LICENSE)cs$g|]}t|dkr|qSr)rematch)r8member member_nameZ rexp_stringrr nsz%download_node_src..N)rrrrrrzipfileZipFileoperator methodcallerr attrgetterr escaper extractall) rsrc_dirr]Z dl_contentsctxmembersarchiveZnode_verZ extract_listrrrdownload_node_srcYs&        rcCsRd}ddt|fi}t|d|}trHttj}tj|_tj ||dSt |S)Nz$https://github.com/ekalinin/nodeenv/z User-Agentznodeenv/%s (%s))context) rurllib2RequestrJssl SSLContext PROTOCOL_TLS CERT_NONE verify_moder)urlZhome_urlheadersreqrrrrrvs rc Cst|D]}tj||}tj||}tj|rpzt||||Wqtk rlt||||YqXq tj|rtj|st t ||q t ||q dSr) rlistdirrr<isdirshutilcopytreerislinksymlinkreadlinkcopy2)srcdstsymlinksignoreitemrdrrrr+s   r+cCstjdtdddtr,t|d}t|n.trVt|d}t|tt|ddtn|}|t d|}t |\}t ||dtrd D]$}t|d|}t j |rt|qtjdtdddd S) z1 Copy prebuilt binaries into environment rTrrScriptsbinrz /node-v%s*)rCZnpxnode.exeN)rrrrr<rrr CYGWIN_NODErglobr+rrr r)rrZ node_versionrzZsrc_folder_tplZ src_folderrrrrcopy_node_from_prebuilts$        r;c si}ddg}tfdd|}ddt||D}ttjdtjdd krz&td d gjd ||\}} | d} Wn ttfk rtd YnXt d| t |d} t | d} t | t j| stdd| | gd| t jdd|d<ddt|g} jr| dj r&| djr8| dj}t| jd ||t jdtd ddt|g|jd ||t jdtd ddt|dgjd ||dS)Nz load-averagerEcst|ddS)N-r)rarP)xr]rrrrz%build_node_from_src..cSs:g|]2\}}|dk rt|dkr,d||nd|qS)Nrz --{0}={1}z--{0})rr+)r8r valuerrrrs  z'build_node_from_src..majorrwhichpython2TzbPython >=3.0 virtualenv detected, but no python2 command (required for building node.js) was foundz$ * Temporarily pointing python to %sZtmpbinpythonlnz-sz{}:{}PATHrOz ./configurez --prefix=%srrrrrrz install)mapziprar version_inforr2r IndexErrorrrGr<rrrr r+rr)pipesquoterFrrHrrr)rr node_src_dirr]rTZmake_param_namesZmake_param_valuesZ make_optsrZwhich_python2_outputZ python2_pathZnode_tmpbin_dirZnode_tmpbin_linkZconf_cmdZmake_cmdrr>rbuild_node_from_srcs^            rNcCs6zt|||Wn tk r0tdYnXdS)z` Download source code for node.js, unpack it and install it in virtual environment. rON)install_node_wrapped BaseExceptionrr)rrr]rrr install_nodes  rQcCs t|}t|td|j}|jr&dnd}tjd||jftddd|jrZt|j}n t |j}t j |szt |||WnBtjk rd|krt |dd ||ntd |YnXtjd tddd|jrt|||jnt||||td dS) Nznode-v%srIsourcez * Install %s node (%s) TrrrrzFailed to download from %srz done.)abspathr<rrrIrrrrrrrr rr HTTPErrorrPrr;rN)rrr]rMZsrc_typerrrrrOs0    rOc Cstjd|jtdddttj|jr*dnd|jd}tjdd d t t |d d |jf|tj tj tjd }|\}}|jrt|tddS)\ Download source code for npm, unpack it and install it in virtual environment.  * Install npm.js (%s) ... Trrnoyes)cleanZ npm_installbashrz. {0} && npm install -g npm@{1}r7activate)rTrrXrrN)rrrCrrrrrYrZr+rKrLr<r[rr\r2)rZ_src_dirr]rTrrQrrrr install_npms2    r\c Cstjd|jtdddd|j}tt|}t|d}t|dd}t j |rbt |t j t|d rt t|d t j t|d rt t|d t|d }||W5QRXd |j}t t|||t t||d d t|d t t||d d t|d trt t|d t|d d t t|dt|d dd} d| |j} tt|d dt| dS)rUrVTrrz*https://github.com/npm/cli/archive/v%s.zipr6 node_modulesrCznpm.cmdz npm-cli.jsrzcli-%sr7z)https://raw.githubusercontent.com/npm/cliz {}/{}/bin/npmN)rrrCrrrrr!r<rrr r*rmtreeremoverrrr+rrr+r) rrr]Znpm_urlZ npm_contentsZbin_pathZnode_modules_pathZzipfZnpm_verZ npm_gh_urlZ npm_bin_urlrrrinstall_npm_win<sB           r`cCstjdtdddddt|jD}t|dd}|jd d krN|jn|jd }|jd ksj|d kr~dt |d}ndt |dd}|D]$}|sqt |d|ig|j ddqtddS)z* Install node.js packages via npm z * Install node.js packages ... TrrcSsg|] }|qSr)r0)r8packagerrrrlsz$install_packages..r7r[rrAz.0rz1.0.0z. z && npm install -g %(pack)sz && npm install %(pack)sz && npm activate %(pack)spack)rrrrN) rrrr.rr/r<rCcountrKrLrr2)rr]packagesZ activate_pathZ real_npm_verrrarrrinstall_packagesfs6      recCshtr0tttd}t|d}t|d}t|d}n*tttd}t|d}t|d}t|d}trft ||j d krxt|d<td d }|j pd t j t j |}|j d krt j}|d t|d |idD]4} tjd| gtj|d\} } t| }|rqq|std|D]\} } t|| }| d|} | dt j |} | d|} | dt j |} | d|} trtddt j |gddd\} }| d|d} n | dd} d}|jrt| d}t | d}|| |} t!|}t"|| |dqt j #|sdtrXztd |dgd!d!Wn t$k rTt%&d"YnXn t 'd|d#S)$z7 Install virtual environment activation script )z activate.batzdeactivate.batz Activate.ps1r6r8z nodejs.exe)r[ activate.fishZshimr7rnodejsrVlibr]z(%s)rF)rgrrB)rXrTz-Did not find nodejs or node system executableZ__NODE_VIRTUAL_PROMPT__Z__NODE_VIRTUAL_ENV__Z __SHIM_NODE__Z __BIN_NAME__Z __MOD_NAME__Zcygpathz-wF)rrZ__NPM_CONFIG_PREFIX__rz$NODE_VIRTUAL_ENVrO)rZmklinkTz'Error: Failed to create nodejs.exe linkN)(r ACTIVATE_BATDEACTIVATE_BAT ACTIVATE_PS1r< ACTIVATE_SH ACTIVATE_FISHSHIMrrrrrrr,rSrrrrUrYrZr[r\rRAssertionErrorrrPrrDISABLE_PROMPTr) ENABLE_PROMPTr'rr rrrr-)rr]filesbin_dirZ shim_nodeZ shim_nodejsZmod_dirrrT candidateZwhich_node_outputrr r file_pathZ cyg_bin_dirZ need_appendZdisable_promptZ enable_promptrrrinstall_activates                   rvc Cs0ts,tt|ddd}|tW5QRXdS)Nr7Z predeactivatea)rr.r<rcPREDEACTIVATE_SH)rhookrrrset_predeactivate_hooksrzcCstj|r.|js.td||js.tdt t t |d}t ||j dkr`t|||n,t t |dt t |dt t |ddt||t|tdks|jrtstrtnt}|||||jrt|||jrt||jrt|d S) z3 Creates a new environment in ``env_dir``. z! * Environment already exists: %srAr0rVr7rhr]z0.6.3N)rrr rrrrrexitrrSr<rrrQrvr_rrDrrr`r\rrerzrr*r^)rr]rZinstfuncrrrcreate_environments*      r|cCs tdt}t|dS)Nz %s/index.jsonzUTF-8)rrjsonloadsr!r)responserrr_get_versions_jsons rcCsddtDdddS)NcSsg|]}|ddqS)rxr:lstrip)r8dctrrrrsz%get_node_versions..)rrrrrget_node_versionssrcsBtfddtdtdD}|D]}td|q(dS)z; Prints into stdout all available node.js versions csg|]}||dqS)r)r8posversionsrrr sz'print_node_versions..rr N)rrangerrrr<)Z chunks_of_8chunkrrrprint_node_versionss  rcCstdddS)z, Return last stable node.js version rrxr:)rrrrrrget_last_stable_node_versionsrcCstddtDdS)z7 Return the last node.js version marked as LTS css$|]}|dr|ddVqdS)ltsrxr:Nr)r8r:rrrr;sz,get_last_lts_node_version..N)nextrrrrrget_last_lts_node_versions rcCsl|jr^ttdrtj}qdttdr6tjtjkr6tj}qddtjkrHtj}qdtdt dn|j }t |S)N real_prefix base_prefixZ CONDA_PREFIXz!No python virtualenv is availablerA) rhasattrrprefixrrrrrr{rr)r]resrrr get_env_dirs    rcCsdtjkrtdStdd}t|j|jt}|j dkrZt rZt dt d|jad}|jrd|jkr||jaq|j}ntstrd }nd }tdkrd |a|jr|j d krt|_n|j d krt|_|jrtn.|jrt|}t||nt|}t||dS)z Entry point z--dump-config-defaultsNF)rrVz4Installing system node.js on win32 is not supported!rz://zunofficial-builds.nodejs.orgz nodejs.orgzhttps://%s/download/releaserr)rargvrr>rr6rr2rrrrrr{rJrKrrrrrrrrrrer|)r]Z src_domainrrrrmain0s>       rz # 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[rfz' unset NODE_VIRTUAL_ENV_DISABLE_PROMPT z( set -e NODE_VIRTUAL_ENV_DISABLE_PROMPT z#!/usr/bin/env bash 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" ah # This file must be used with "source bin/activate" *from bash* # 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)FN)grB contextlibrr}rrr r rrkrrrYrrKrrr*rr:rrrrrhttplibr ImportError configparserurllib.requestrequesthttpclient pkg_resourcesrrrr<rSrrIr rVrr$rrJrobjectrrr#_defaultrRrUr_rvrrrrrrrrrrrrcontextmanagerrrrrr+r;rNrQrOr\r`rervrzr|rrrrrrrrprqrnrirjrkrlrmrxr9r?rrrrs         B     % E!  8 #*S! 9 /