pax_global_header00006660000000000000000000000064125710370400014511gustar00rootroot0000000000000052 comment=8904043769ab4d9d5f2ba0f9e0503d3b3d8312c6 nodeenv-0.13.4/000077500000000000000000000000001257103704000132345ustar00rootroot00000000000000nodeenv-0.13.4/.coveragerc000066400000000000000000000011031257103704000153500ustar00rootroot00000000000000[run] branch = True source = . omit = .tox/* /usr/* */tmp* setup.py # Don't complain if non-runnable code isn't run */__main__.py [report] exclude_lines = # Have to re-enable the standard pragma \#\s*pragma: no cover # Don't complain if tests don't hit defensive assertion code: ^\s*raise AssertionError\b ^\s*raise NotImplementedError\b ^\s*return NotImplemented\b ^\s*raise$ # Don't complain if non-runnable code isn't run: ^if __name__ == ['"]__main__['"]:$ [html] directory = coverage-html # vim:ft=dosini nodeenv-0.13.4/.gitignore000066400000000000000000000004401257103704000152220ustar00rootroot00000000000000.coverage *.pyc *.pyo *.swp *.swo env /nodeenv /TODO /build/ /dist/ /bin/ /include/ /lib/ /local/ /venv*/ /*.egg-info/ .ropeproject/ .tox/ debian debian-upstream/files debian-upstream/nodeenv.substvars debian-upstream/nodeenv.*.debhelper /debian-upstream/sdist/ /debian-upstream/nodeenv/ nodeenv-0.13.4/.travis.yml000066400000000000000000000004211257103704000153420ustar00rootroot00000000000000language: python env: # These should match the tox env list - TOXENV=py26 - TOXENV=py27 - TOXENV=py33 - TOXENV=py34 - TOXENV=pypy - TOXENV=pypy3 install: pip install coveralls tox --use-mirrors script: tox after_success: - coveralls sudo: false nodeenv-0.13.4/AUTHORS000066400000000000000000000013741257103704000143110ustar00rootroot00000000000000Nodeenv is written and maintained by Eugene Kalinin. Patches and Suggestions ``````````````````````` - jhermann - ivan hilkov - Vincent Bernat - Anthony Sottile - Kyle P Davis - Elias Kunnas - Doug Turnbull - Anton Parkhomenko - Vyacheslav Levit - Travis Miller - syndbg - Spencer Rathbun - Lispython - Leonardo Fedalto - Kyle P Davis - Dennis Flanigan - Andrzej Pragacz - Alex Couper - Zenobius Jiricek - Yi-Feng Tzeng - Vladimír Gorej - Vincent Bernat - Stan Seibert - Shubhang Mani - Rik - Mrinal Wadhwa - Marc Abramowitz - Ken Struys - Jesse Dhillon - Jeremy Banks - Geoffrey Huntley - dhilipsiva - Dennis Flanigan - Dan North - Damien Nozay - cmehay - Ben Davis - Alexey Poryadin nodeenv-0.13.4/CHANGES000066400000000000000000000252671257103704000142430ustar00rootroot00000000000000Nodeenv changelog ================= Version 0.13.3 -------------- - Fixed env creation with non-ASCII chars in path. See `# 49`_ - Fixed logging with unicode chars. See `# 96`_ - Skip new lines at the end of requirements.txt. See `# 122`_ - Fixed UnicodeDecodeError at build on non UTF-8 environment. See `# 124`_ .. _# 49: https://github.com/ekalinin/nodeenv/issues/49 .. _# 96: https://github.com/ekalinin/nodeenv/issues/96 .. _# 122: https://github.com/ekalinin/nodeenv/issues/122 .. _# 124: https://github.com/ekalinin/nodeenv/pull/124 Version 0.13.2 -------------- - Fixed ``freeze`` command. See `# 121`_ .. _# 121: https://github.com/ekalinin/nodeenv/issues/121 Version 0.13.1 -------------- - Fixed bug: ``nodeenv --list is raising TypeError``. See `# 117`_, `# 118`_ .. _# 117: https://github.com/ekalinin/nodeenv/issues/117 .. _# 118: https://github.com/ekalinin/nodeenv/pull/118 Version 0.13.0 -------------- - Removed deps from ``sort``, ``egrep``, ``curl``, ``tar``. See `# 114`_, `# 116`_. .. _# 114: https://github.com/ekalinin/nodeenv/pull/114 .. _# 116: https://github.com/ekalinin/nodeenv/pull/116 Version 0.12.3 -------------- - Fixed check for installed curl/tar/etc for py3. Version 0.12.2 -------------- - Added check for installed curl/egrep/sort/tar. See `# 110`_, `# 61`_ .. _# 110: https://github.com/ekalinin/nodeenv/issues/110 .. _# 61: https://github.com/ekalinin/nodeenv/issues/61 Version 0.12.1 -------------- - Removed dep for lxml in favor of stdlib HTMLParser. See `# 109`_ - Added integration with travis-ci. See `# 109`_ - Added some tests. See `# 109`_ .. _# 109: https://github.com/ekalinin/nodeenv/pull/109 Version 0.12.0 -------------- - Added support for io.js (new option ``--iojs``) - Fixed ``get_last_stable_node_version`` for python3 Version 0.11.1 -------------- - Disallow prefix overridden by .npmrc. See `# 98`_, `# 100`_, `# 103`_ .. _# 98: https://github.com/ekalinin/nodeenv/issue/98 .. _# 100: https://github.com/ekalinin/nodeenv/pull/100 .. _# 103: https://github.com/ekalinin/nodeenv/pull/103 Version 0.11.0 -------------- - Improved dpkg rules. See `# 90`_ - Added --config-file option. See `# 91`_ - Read "./setup.cfg" in addition to "~/.nodeenvrc" by default. See `# 91`_ - Python3 compatibility. See `# 92`_, `# 93`_ .. _# 90: https://github.com/ekalinin/nodeenv/pull/90 .. _# 91: https://github.com/ekalinin/nodeenv/pull/91 .. _# 92: https://github.com/ekalinin/nodeenv/pull/92 .. _# 93: https://github.com/ekalinin/nodeenv/pull/93 Version 0.10.0 -------------- - Added support for config file. See `# 85`_ - Using of virtualenv detected via python not env variable. See `# 87`_ - Fixed ``freeze`` for zsh. See `# 88`_ - Added ``nodejs`` symlink creation. See `# 84`_ .. _# 85: https://github.com/ekalinin/nodeenv/pull/85 .. _# 87: https://github.com/ekalinin/nodeenv/pull/87 .. _# 88: https://github.com/ekalinin/nodeenv/pull/88 Version 0.9.6 ------------- - Removed ``os.symlink`` added in `# 76`_. See `# 84`_ .. _# 84: https://github.com/ekalinin/nodeenv/issues/84 Version 0.9.5 ------------- - Fixed a few spelling typos in README. See `# 74`_ - Fixed example of using --update option in README. See `# 74`_ - Improved args passing into shim script. See `# 75`_ - Try to find ``nodejs`` if used system-wide node as well. See `# 76`_ - Added ``assert`` if used system-wide node and it wasnt found. See `# 76`_ - Added ``-l`` option into ``freeze`` command. See `# 71`_ .. _# 71: https://github.com/ekalinin/nodeenv/issues/71 .. _# 74: https://github.com/ekalinin/nodeenv/issues/74 .. _# 75: https://github.com/ekalinin/nodeenv/pull/75 .. _# 76: https://github.com/ekalinin/nodeenv/pull/76 Version 0.9.4 ------------- - Fixed support for python2.6. See `# 70`_ .. _# 70: https://github.com/ekalinin/nodeenv/issues/70 Version 0.9.3 ------------- - Fixed npm when using prebuilt binaries on Mac OS X. See `# 68`_ - Fixed using ``system`` node under python3.4. See `# 43`_ - If used ``system`` node script ``bin/node`` always overwritten .. _# 68: https://github.com/ekalinin/nodeenv/issues/68 .. _# 43: https://github.com/ekalinin/nodeenv/issues/43 Version 0.9.2 ------------- - Fixed infinite loop when system-wide node used. See `# 67`_ .. _# 67: https://github.com/ekalinin/nodeenv/issues/67 Version 0.9.1 ------------- - Fixed 'shim' script if used system-wide node - Fixed shebang in the 'shim' - Added shim with name 'node' in case of using system-wide node Version 0.9.0 ------------- - Added `shim` script. See `# 59`_ .. _# 59: https://github.com/ekalinin/nodeenv/issues/59 Version 0.8.2 ------------- - Fixed prebuilt installation: - cp more choosy. See `# 64`_ - exclude top-level files in prebuilt tar. See `# 63`_ .. _# 63: https://github.com/ekalinin/nodeenv/issues/63 .. _# 64: https://github.com/ekalinin/nodeenv/issues/64 Version 0.8.1 ------------- - Fixed system's node usage. See `# 62`_ .. _# 62: https://github.com/ekalinin/nodeenv/pull/62 Version 0.8.0 ------------- - Added support for prebuilt packages. See `# 56`_ - Added support for python3. See `# 42`_ .. _# 56: https://github.com/ekalinin/nodeenv/issues/56 .. _# 42: https://github.com/ekalinin/nodeenv/issues/42 Version 0.7.3 ------------- - Fixed npm.js redirect. See `# 52`_ - Added ``--update`` option. See `# 25`_ .. _# 52: https://github.com/ekalinin/nodeenv/pull/52 .. _# 25: https://github.com/ekalinin/nodeenv/issues/25 Version 0.7.2 ------------- - Bug fixing in ``freeze``. See `# 47`_ .. _# 47: https://github.com/ekalinin/nodeenv/issues/47 Version 0.7.1 ------------- - Added ``--make`` option Version 0.7.0 ------------- - added ``--force``. See `# 37`_ - python3 support (first steps). See `# 38`_, `# 39`_ - escaping all directories used by subprocesses. See `# 40`_ - added an option to use system-wide node. See `# 41`_ .. _# 37: https://github.com/ekalinin/nodeenv/pull/37 .. _# 38: https://github.com/ekalinin/nodeenv/issues/38 .. _# 39: https://github.com/ekalinin/nodeenv/issues/39 .. _# 40: https://github.com/ekalinin/nodeenv/pull/40 .. _# 41: https://github.com/ekalinin/nodeenv/pull/41 Version 0.6.6 ------------- - Fixed incomplete package names using freeze. See `# 35`_ - Fixed packages installation type in README. See `# 33`_ .. _# 33: https://github.com/ekalinin/nodeenv/issues/33 .. _# 35: https://github.com/ekalinin/nodeenv/pull/35 Version 0.6.5 ------------- - Node's source not loaded if it already exists in FS. Version 0.6.4 ------------- - Added python3 compatibility. See `# 32`_ .. _# 32: https://github.com/ekalinin/nodeenv/pull/32 Version 0.6.3 ------------- - Fixed ``nodeenv -p``. See `issue # 31`_ .. _issue # 31: https://github.com/ekalinin/nodeenv/issues/31 Version 0.6.2 ------------- - Skipped stand-alone npm installation by default. See `pull # 30`_ - ``--without-npm`` has been changed to ``--with-npm``. See `pull # 30`_ - Fixed options for running Make instances in parallel. See `pull # 30`_ .. _pull # 30: https://github.com/ekalinin/nodeenv/pull/30 Version 0.6.1 ------------- - Used pkg_resources.parse_version to compare versions. See `pull # 29`_ - Fixed doubling prompt inside a virtualenv. See `issues # 26`_ .. _pull # 29: https://github.com/ekalinin/nodeenv/pull/29 .. _issues # 26: https://github.com/ekalinin/nodeenv/issues/26 Version 0.6.0 ------------- - Fixed typo in deactive command. See `pull # 20`_ - Not used "--insecure" to download npm. See `pull # 21`_ - Removed "src" directory after installation. See `pull # 22`_ - Added option "--clean-src" - Added integration with python's virtualenv. See `pull # 23`_ .. _pull # 20: https://github.com/ekalinin/nodeenv/pull/20 .. _pull # 21: https://github.com/ekalinin/nodeenv/pull/21 .. _pull # 22: https://github.com/ekalinin/nodeenv/pull/22 .. _pull # 23: https://github.com/ekalinin/nodeenv/pull/23 Version 0.5.3 ------------- - Bug fix. Used https, /dist/latest/. See `pull # 16`_ .. _pull # 16: https://github.com/ekalinin/nodeenv/pull/16 Version 0.5.2 ------------- - Improved installation logic for release candidate versions. See `pull # 10`_ .. _pull # 10: https://github.com/ekalinin/nodeenv/pull/10 Version 0.5.1 ------------- - Improved logic for the option '--without-npm'. See `issue # 14`_, `pull # 15`_ .. _issue # 14: https://github.com/ekalinin/nodeenv/issues/14 .. _pull # 15: https://github.com/ekalinin/nodeenv/pull/15 Version 0.5.0 ------------- - The virtual environment's path is no longer hardcoded into the activation script. See `pull # 13`_ .. _pull # 13: https://github.com/ekalinin/nodeenv/pull/13 Version 0.4.3 ------------- - Fixed metavar for ``--npm`` - ``npm install -g`` used for npm >=1.0, not noly for `latest` Version 0.4.2 ------------- - Added README.ru.rst Version 0.4.1 ------------- - Fixed bug in print_node_versions. See `pull # 11`_ - Added deps in README .. _pull # 11: https://github.com/ekalinin/nodeenv/pull/11 Version 0.4.0 ------------- - Compatibility with virtualenv (renamed deactivate to deactivate_node). See `pull # 9`_, `issue # 6`_ .. _pull # 9: https://github.com/ekalinin/nodeenv/pull/9 .. _issue # 6: https://github.com/ekalinin/nodeenv/issues/6 Version 0.3.10 -------------- - Fixed bug in url detection for node.js download Version 0.3.9 ------------- - Deleted notify method calls. See `pull # 7`_ - Updated tar url for node.js > 0.5.0. See `pull # 8`_ .. _pull # 7: https://github.com/ekalinin/nodeenv/pull/7 .. _pull # 8: https://github.com/ekalinin/nodeenv/pull/8 Version 0.3.8 ------------- - Added `NODE_PATH` variable export (for correct module search after installation via npm) Version 0.3.7 ------------- - Shows command output when error occurs - Excluded 'npm' from `freeze` list - Fixed bug with 'not only letter' names in `freeze` list - Added global installation for npm >= 1.0 (when install soft from requirement file) Version 0.3.6 ------------- - Fixed ``freeze`` output command. See `request # 5`_ - Diagnostic message fixed. See `pull # 4`_ .. _request # 5 : https://github.com/ekalinin/nodeenv/issues/5 .. _pull # 4 : https://github.com/ekalinin/nodeenv/pull/4 Version 0.3.5 ------------- - Added option ``--npm`` to install certain npm.js version. Request_ . - Fixed ``freeze`` command for npm >= 1.0.x. .. _Request: https://github.com/ekalinin/nodeenv/issues/3 Version 0.3.4 ------------- - Fixed `problem #2`_ with new npm installation script. Added ``--no-npm-clean`` option. The default to the npm 0.x cleanup. .. _problem #2: https://github.com/ekalinin/nodeenv/issues/2 Version 0.3.3 ------------- - Fixed `problem #1`_ with installation from PyPI via easy_install. Added ``MANIFEST.in`` file. .. _problem #1: https://github.com/ekalinin/nodeenv/issues/1 Version 0.3.2 ------------- - Internal improvements - Logging refactoring Version 0.3.1 ------------- - Default environment promt is folder name Version 0.3.0 -------------- - Renamed nve to nodeenv nodeenv-0.13.4/LICENSE000066400000000000000000000027741257103704000142530ustar00rootroot00000000000000Copyright (c) 2011, Eugene Kalinin. Some rights reserved. Redistribution and use in source and binary forms of the software as well as documentation, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * The names of the contributors may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE AND DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. nodeenv-0.13.4/MANIFEST.in000066400000000000000000000002641257103704000147740ustar00rootroot00000000000000include README LICENSE CHANGES AUTHORS include *.py *.rst setup.cfg Makefile graft debian prune debian/nodeenv prune debian/sdist recursive-exclude debian *.log *.substvars files nodeenv-0.13.4/Makefile000066400000000000000000000074261257103704000147050ustar00rootroot00000000000000.PHONY: default deploy deploy-github deploy-pypi update-pypi clean tests env default: : do nothing when dpkg-buildpackage runs this project Makefile deploy-github: git tag `grep "nodeenv_version =" nodeenv.py | grep -o -E '[0-9]\.[0-9]{1,2}\.[0-9]{1,2}'` git push --tags origin master deploy-pypi: python setup.py sdist upload update-pypi: python setup.py register deploy: contributors deploy-github deploy-pypi clean: @rm -rf nodeenv.egg-info/ @rm -rf dist/ @rm -rf build/ @rm -rf env/ @rm -rf nodeenv/ env: @rm -rf env && \ virtualenv --no-site-packages env && \ . env/bin/activate && \ python setup.py install test1: clean @echo " =" @echo " = test1: separate nodejs's env" @echo " =" @rm -rf env && \ virtualenv --no-site-packages env && \ . env/bin/activate && \ python setup.py install && \ rm -rf nodeenv && \ nodeenv -j 4 nodeenv test2: clean @echo " =" @echo " = test2: the same virtualenv's env, with 4 jobs" @echo " =" @rm -rf env && \ virtualenv --no-site-packages env && \ . env/bin/activate && \ python setup.py install && \ nodeenv -j 4 -p test3: clean @echo " =" @echo " = test3: the same virtualenv's env, without any params" @echo " =" @rm -rf env && \ virtualenv --no-site-packages env && \ . env/bin/activate && \ python setup.py install && \ nodeenv -p # https://github.com/ekalinin/nodeenv/issues/43 test4: clean @echo " =" @echo " = test4: separate nodejs's env for python3.4" @echo " =" @rm -rf env && \ virtualenv --no-site-packages --python=python3.4 env && \ . env/bin/activate && \ python setup.py install && \ nodeenv 4 -p --prebuilt && \ nodeenv -p --node=system test5: clean @echo " =" @echo " = test5: prebuilt nodejs's env for python2" @echo " =" @rm -rf env && \ virtualenv --no-site-packages --python=python2.7 env && \ . env/bin/activate && \ python setup.py install && \ nodeenv 4 -p --prebuilt && \ nodeenv -p --node=system test6: clean @echo " =" @echo " = test6: separate iojs's env" @echo " =" @rm -rf env && \ virtualenv --no-site-packages env && \ . env/bin/activate && \ python setup.py install && \ nodeenv -p --prebuilt --iojs test7: clean @echo " =" @echo " = test7: freeze for global installation" @echo " =" @rm -rf env && \ virtualenv --no-site-packages env && \ . env/bin/activate && \ python setup.py install && \ nodeenv -j 4 -p --prebuilt && \ . env/bin/activate && \ npm install -g sitemap && \ test "`freeze | wc -l`" = "1"; test8: clean @echo " =" @echo " = test8: unicode paths, #49" @echo " =" @rm -rf env && \ virtualenv --no-site-packages env && \ . env/bin/activate && \ python setup.py install && \ rm -rf öäü && mkdir öäü && cd öäü && \ nodeenv -j 4 --prebuilt env tests: clean test1 test2 test3 test4 test5 test6 test7 test8 clean contributors: @echo "Nodeenv is written and maintained by Eugene Kalinin." > AUTHORS @echo "" >> AUTHORS @echo "Patches and Suggestions" >> AUTHORS @echo '```````````````````````' >> AUTHORS @echo "" >> AUTHORS @git log --raw | grep "^Author: " | \ sort | uniq -c | sort -n -r | \ cut -d ':' -f 2 | sed 's/^/- /' | \ cut -d '<' -f1 | uniq | grep -v Kalinin >> AUTHORS nodeenv-0.13.4/README000077700000000000000000000000001257103704000155762README.rstustar00rootroot00000000000000nodeenv-0.13.4/README.rst000066400000000000000000000161671257103704000147360ustar00rootroot00000000000000Node.js virtual environment =========================== ``nodeenv`` (node.js virtual environment) is a tool to create isolated node.js environments. It creates an environment that has its own installation directories, that doesn't share libraries with other node.js virtual environments. Also the new environment can be integrated with the environment which was built by virtualenv_ (python). If you use nodeenv feel free to add your project on wiki: `Who-Uses-Nodeenv`_. .. _Who-Uses-Nodeenv: https://github.com/ekalinin/nodeenv/wiki/Who-Uses-Nodeenv .. image:: https://travis-ci.org/ekalinin/nodeenv.svg?branch=master :target: https://travis-ci.org/ekalinin/nodeenv Install ------- Global installation ^^^^^^^^^^^^^^^^^^^ You can install nodeenv globally with `easy_install`_:: $ sudo easy_install nodeenv or with `pip`_:: $ sudo pip install nodeenv or on Debian using `dpkg`_:: $ ln -s debian-upstream debian $ dpkg-buildpackage -uc -us -b $ sudo dpkg -i $(ls -1rt ../nodeenv_*.deb | tail -n1) .. _dpkg: https://www.debian.org/doc/manuals/debian-faq/ch-pkgtools.en.html Local installation ^^^^^^^^^^^^^^^^^^ If you're using virtualenv_ then you can install nodeenv via pip_/easy_install_ inside any virtual environment built with virtualenv:: $ virtualenv env $ . env/bin/activate (env) $ pip install nodeenv (env) $ nodeenv --version 0.6.5 If you want to work with the latest version of the nodeenv you can install it from the github `repository`_:: $ git clone https://github.com/ekalinin/nodeenv.git $ ./nodeenv/nodeenv.py --help or with `pip`_:: $ pip install -e git+https://github.com/ekalinin/nodeenv.git#egg=nodeenv .. _repository: https://github.com/ekalinin/nodeenv .. _pip: http://pypi.python.org/pypi/pip .. _easy_install: http://pypi.python.org/pypi/setuptools Dependency ---------- For nodeenv ^^^^^^^^^^^ * python (>= 2.6) * make * tail For node.js ^^^^^^^^^^^ * libssl-dev Usage ----- Basic ^^^^^ Create new environment:: $ nodeenv env Activate new environment:: $ . env/bin/activate Check versions of main packages:: (env) $ node -v v0.10.26 (env) $ npm -v 1.4.3 Deactivate environment:: (env) $ deactivate_node Advanced ^^^^^^^^ Get available node.js versions:: $ nodeenv --list 0.0.1 0.0.2 0.0.3 0.0.4 0.0.5 0.0.6 0.1.0 0.1.2 0.1.3 0.1.4 0.1.5 0.1.6 0.1.7 0.1.8 0.1.10 0.1.11 0.1.12 0.1.13 0.1.14 0.1.15 0.1.16 0.1.18 0.1.19 0.1.20 0.1.21 0.1.22 0.1.23 0.1.24 0.1.26 0.1.27 0.1.28 0.1.29 0.1.30 0.1.31 0.1.32 0.1.90 0.1.91 0.1.92 0.1.93 0.1.94 0.1.95 0.1.96 0.1.98 0.1.99 0.1.100 0.1.101 0.1.102 0.1.103 0.1.104 0.2.1 0.2.2 0.2.3 0.2.4 0.2.5 0.2.6 0.3.0 0.3.2 0.3.3 0.3.4 0.3.5 0.3.6 0.3.7 0.3.8 0.4.1 0.4.2 0.4.3 0.4.4 0.4.5 0.4.6 Install node.js "0.4.3" without ssl support with 4 parallel commands for compilation and npm.js "0.3.17":: $ nodeenv --without-ssl --node=0.4.3 --npm=0.3.17 --jobs=4 env-4.3 Install node.js from prebuilt package:: $ nodeenv --node=0.10.25 --prebuilt env-0.10.25-prebuilt It's much faster than installing & compiling node.js from source:: $ time nodeenv --node=0.10.25 --prebuilt env-0.10.25-prebuilt + Install node.js (0.10.25) ... done. real 0m6.928s user 0m0.408s sys 0m1.144s $ time nodeenv --node=0.10.25 env-0.10.25-src + Install node.js (0.10.25) ... done. real 4m12.602s user 6m34.112s sys 0m30.524s Create a new environment with the system-wide node.js:: $ nodeenv --node=system Saving the versions of all installed packages to a file:: $ . env-4.3/bin/activate (env-4.3)$ npm install -g express (env-4.3)$ npm install -g jade (env-4.3)$ freeze ../prod-requirements.txt If you want to list locally installed packages use ``-l`` option:: (env-4.3)$ freeze -l ../prod-requirements.txt Create an environment from a requirements file:: $ nodeenv --requirements=../prod-requirements.txt --jobs=4 env-copy Requirements files are plain text files that contain a list of packages to be installed. These text files allow you to create repeatable installations. Requirements file example:: $ cat ../prod-requirements.txt connect@1.3.0 express@2.2.2 jade@0.10.4 mime@1.2.1 npm@0.3.17 qs@0.0.7 If you already have the python virtualenv tool, and want to use nodeenv and virtualenv in conjunction, then you should create (or activate) the python virtual environment:: # in case of using virtualenv_wrapper $ mkvirtualenv my_env # in case of using virtualenv $ . my_env/bin/activate and add a node virtual environment to this existing new_venv:: $ nodeenv -p If you need to set the path to make used to build node:: $ nodeenv -m /usr/local/bin/gmake ENV That's all. Now, all your node.js modules will be installed into your virtual environment:: $ workon my_env $ npm install -g coffee-script $ which coffee /home/monty/virtualenvs/my_env/bin/coffee If environment's directory already exists then you can use ``--force`` option:: $ nodeenv --requirements=requirements.txt --jobs=4 --force env If you already have an environment and want to update packages from requirements file you can use ``--update`` option:: $ . env-4.3/bin/activate (env-4.3)$ nodeenv --requirements=requirements.txt --update env-4.3 If you want to call node from environment without activation then you should use `shim` script:: $ ./env-4.3/bin/shim --version v0.4.3 If you want to install iojs instead of nodejs then use ``--iojs``:: $ virtualenv env $ . env/bin/activate (env) $ nodeenv --iojs --list 1.0.0 1.0.1 (env) $ nodeenv --iojs -p --prebuilt * Install iojs (1.0.1) ... done. * Appending data to ~/tmp/env/bin/activate Configuration ------------- You can use the INI-style file ``~/.nodeenvrc`` to set default values for many options, the keys in that file are the long command-line option names. These are the available options and their defaults:: [nodeenv] debug = False jobs = 2 make = make node = latest npm = latest prebuilt = False profile = False with_npm = False without_ssl = False Alternatives ------------ There are several alternatives that create isolated environments: * `nave `_ - Virtual Environments for Node. Nave stores all environments in one directory ``~/.nave``. Can create per node version environments using `nave use envname versionname`. Can not pass additional arguments into configure (for example --without-ssl) Can't run on windows because it relies on bash. * `nvm `_ - Node Version Manager. It is necessarily to do `nvm sync` for caching available node.js version. Can not pass additional arguments into configure (for example --without-ssl) * virtualenv_ - Virtual Python Environment builder. For python only. .. _`virtualenv`: https://github.com/pypa/virtualenv LICENSE ======= BSD / `LICENSE `_ nodeenv-0.13.4/README.ru.rst000066400000000000000000000144251257103704000153560ustar00rootroot00000000000000Виртуальное окружение для Node.js ================================= ``nodeenv`` (node.js virtual environment) — утилита для создания изолированных окружений для node.js. Результатом работы утилиты является создание изолированного окружения в отдельной директории, которое (окружение) никак не зависит от других установок node.js. Так же новое окружение может быть интегрировано в уже существующее окружение, созданное ранее с помощью virtualenv_ (python). Если вы используете nodeenv, добавьте, пожалуйста, свой проект на wiki_. .. _wiki: https://github.com/ekalinin/nodeenv/wiki/Who-Uses-Nodeenv Установка --------- Глобальная ^^^^^^^^^^ Nodeenv можно установить с помощью `easy_install`_:: $ sudo easy_install nodeenv или с помощью `pip`_:: $ sudo pip install nodeenv Локальная ^^^^^^^^^ Если же используется virtualenv_, то можно установить nodeenv внутри виртуального окружения с помощью pip_/easy_install_:: $ virtualenv env $ . env/bin/activate (env) $ pip install nodeenv (env) $ nodeenv --version 0.6.5 Если есть желание поработать с последней версией nodeenv, то установить его можно напрямую из репозитория:: $ git clone https://github.com/ekalinin/nodeenv.git $ ./nodeenv/nodeenv.py --help .. _pip: http://pypi.python.org/pypi/pip .. _easy_install: http://pypi.python.org/pypi/setuptools Зависимости ----------- Для nodeenv ^^^^^^^^^^^ * make * tail Для node.js ^^^^^^^^^^^ * python * libssl-dev Использование ------------- Основы ^^^^^^ Создание нового окружения:: $ nodeenv env Активация окружения:: $ . env/bin/activate Проверка версий основных пакетов:: (env) $ node -v v0.4.6 (env) $ npm -v 0.3.18 Отключение окружения:: (env) $ deactivate_node Доп.возможности ^^^^^^^^^^^^^^^ Просмотр списка доступных версий node.js:: $ nodeenv --list 0.0.1 0.0.2 0.0.3 0.0.4 0.0.5 0.0.6 0.1.0 0.1.2 0.1.3 0.1.4 0.1.5 0.1.6 0.1.7 0.1.8 0.1.10 0.1.11 0.1.12 0.1.13 0.1.14 0.1.15 0.1.16 0.1.18 0.1.19 0.1.20 0.1.21 0.1.22 0.1.23 0.1.24 0.1.26 0.1.27 0.1.28 0.1.29 0.1.30 0.1.31 0.1.32 0.1.90 0.1.91 0.1.92 0.1.93 0.1.94 0.1.95 0.1.96 0.1.98 0.1.99 0.1.100 0.1.101 0.1.102 0.1.103 0.1.104 0.2.1 0.2.2 0.2.3 0.2.4 0.2.5 0.2.6 0.3.0 0.3.2 0.3.3 0.3.4 0.3.5 0.3.6 0.3.7 0.3.8 0.4.1 0.4.2 0.4.3 0.4.4 0.4.5 0.4.6 Установка node.js версии "0.4.3" без поддержки ssl с компиляцией в 4 параллели, а так же npm версией "0.3.17":: $ nodeenv --without-ssl --node=0.4.3 --npm=0.3.17 --jobs=4 env-4.3 Сохранение в файл «зависимостей» версий всех установленных пакетов:: $ . env-4.3/bin/activate (env-4.3)$ npm install -g express (env-4.3)$ npm install -g jade (env-4.3)$ freeze ../prod-requirements.txt Создание точной копии окружения из файла «зависимостей»:: $ nodeenv --requirement=../prod-requirements.txt --jobs=4 env-copy Файл «зависимостей» или «требований» — это простой файл, в котором перечислены пакеты, которые необходимо установить. Такой файл дает возможность полностью повторяемые установки. Пример содержания файла:: $ cat ../prod-requirements.txt connect@1.3.0 express@2.2.2 jade@0.10.4 mime@1.2.1 npm@0.3.17 qs@0.0.7 Если вы используете оригинальную версию утилиты virtualenv (для python'а), то возможно вы захотите использовать nodeenv и virtualenv вместе. В этом случае, сперва вы должны создать (или активировать) виртуальное окружение для python'а:: # если вы используете утилиту virtualenv_wrapper $ mkvirtualenv my_env и затем добавить node.js в это окружение:: $ nodeenv -p Теперь все модули node.js будут устанавливаться в созданное виртуальное окружение:: $ workon my_env $ npm install -g coffee-script $ which coffee /home/monty/virtualenvs/my_env/bin/coffee Альтернативы ------------ Существует несколько альтернативных утилит, которые так же позволяют создавать изолированные окружения: * `nave `_ - Virtual Environments for Node. Сохраняет все окружения в одной директории ``~/.nave``. Таким образом, не позволяет создавать несколько окружений для одной и той же версии node.js. Не позволяет передавать аргументы в конфигурацию (например, --without-ssl) * `nvm `_ - Node Version Manager. Требует регулярно выполнять ``nvm sync`` для кэширования доступных версий node.js Не позволяет передавать аргументы в конфигурацию (например, --without-ssl) * `virtualenv`_ Virtual Python Environment builder. Только для python. .. _`virtualenv`: https://github.com/pypa/virtualenv nodeenv-0.13.4/debian-upstream/000077500000000000000000000000001257103704000163145ustar00rootroot00000000000000nodeenv-0.13.4/debian-upstream/changelog000066400000000000000000000025601257103704000201710ustar00rootroot00000000000000nodeenv (0.11.1-1) unstable; urgency=low * dh-virtualenv issue 48: Mirror any interpreter changes caused by Python package updates; now using dh-virtualenv 0.8 [Eugene Kalinin] * Issues 98, 100, 103: Disallow prefix overridden by .npmrc * Issue 90: Improved dpkg rules * Issue 91: Added --config-file option * Issue 91: Read "./setup.cfg" in addition to "~/.nodeenvrc" by default * Issues 92, 93: Python3 compatibility -- Juergen Hermann Mon, 13 Oct 2014 15:38:01 +0200 nodeenv (0.10.0) unstable; urgency=low * Issue 85: Added support for config file * Issue 84: Added `nodejs` symlink creation [Eugene Kalinin] * Issue 87: Using of virtualenv detected via python not envvar * Issue 88: Fixed `freeze` for zsh -- Juergen Hermann Sat, 12 Jul 2014 00:00:57 +0200 nodeenv (0.9.5+git-1479d8f) unstable; urgency=low * Issue 77: Debian packaging using dh-virtualenv * Issue 76: Try to find "nodejs" as well, when using system-wide node * Issue 76: Added "assert" for checking if system-wide node is actually found [Eugene Kalinin] * Issue 74: Fixed a few spelling typos in README * Issue 74: Fixed example of using "--update" option in README * Issue 75: Improved args passing within shim script * Issue 71: Added "-l" option to "freeze" command -- Juergen Hermann Wed, 18 Jun 2014 12:32:45 +0200 nodeenv-0.13.4/debian-upstream/compat000066400000000000000000000000021257103704000175120ustar00rootroot000000000000009 nodeenv-0.13.4/debian-upstream/control000066400000000000000000000013601257103704000177170ustar00rootroot00000000000000Source: nodeenv Section: contrib/python Priority: extra Maintainer: Eugene Kalinin Build-Depends: debhelper (>= 9), python, dh-virtualenv (>= 0.8), tar Standards-Version: 3.9.5 Homepage: https://github.com/ekalinin/nodeenv Package: nodeenv Architecture: any Pre-Depends: dpkg (>= 1.16.1), python2.7-minimal | python2.6-minimal, ${misc:Pre-Depends} Depends: ${python:Depends}, ${misc:Depends} Recommends: nodejs Description: Node.js virtual environment builder . Tool to create isolated node.js environments, with its own installation directories, that doesn't share libraries with other node.js virtual environments. . These environments can be integrated with ones created by Python's virtualenv. nodeenv-0.13.4/debian-upstream/copyright000066400000000000000000000027741257103704000202610ustar00rootroot00000000000000Copyright (c) 2011, Eugene Kalinin. Some rights reserved. Redistribution and use in source and binary forms of the software as well as documentation, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * The names of the contributors may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE AND DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. nodeenv-0.13.4/debian-upstream/nodeenv.links000066400000000000000000000000651257103704000210150ustar00rootroot00000000000000usr/share/python/nodeenv/bin/nodeenv usr/bin/nodeenv nodeenv-0.13.4/debian-upstream/nodeenv.triggers000066400000000000000000000005311257103704000215210ustar00rootroot00000000000000# Register interest in Python interpreter changes (Python 2 for now); and # don't make the Python package dependent on the virtualenv package # processing (noawait) interest-noawait /usr/bin/python2.6 interest-noawait /usr/bin/python2.7 # Also provide a symbolic trigger for all dh-virtualenv packages interest dh-virtualenv-interpreter-update nodeenv-0.13.4/debian-upstream/rules000077500000000000000000000016511257103704000173770ustar00rootroot00000000000000#!/usr/bin/make -f # # Build Debian package using https://github.com/spotify/dh-virtualenv # # Note that this only works after applying # https://github.com/spotify/dh-virtualenv/pull/43 # (at least with some versions of virtualenv) # The below targets create a clean copy of the workdir via # using "sdist", else "pip" goes haywire when installing from # sourcedir ".", because that includes the debian build stage, # and a recursive explosion ensues when symlinks are followed. DH_VENV_ARGS=--with python-virtualenv --setuptools --python /usr/bin/python #-v clean: test ! -d dist || rm -rf dist test ! -d debian/sdist || rm -rf debian/sdist dh $@ $(DH_VENV_ARGS) build-arch: /usr/bin/python setup.py sdist --formats tar mkdir -p debian/sdist tar -x -C debian/sdist --strip-components=1 --exclude '*.egg-info' -f dist/*.tar dh $@ $(DH_VENV_ARGS) --sourcedir debian/sdist %: dh $@ $(DH_VENV_ARGS) --sourcedir debian/sdist nodeenv-0.13.4/nodeenv.py000066400000000000000000000745651257103704000152650ustar00rootroot00000000000000#!/usr/bin/env python # -*- coding: utf-8 -*- """ nodeenv ~~~~~~~ Node.js virtual environment :copyright: (c) 2014 by Eugene Kalinin :license: BSD, see LICENSE for more details. """ import contextlib import io import sys import os import re import stat import logging import operator import optparse import subprocess import tarfile import pipes try: # pragma: no cover (py2 only) from ConfigParser import SafeConfigParser as ConfigParser from HTMLParser import HTMLParser import urllib2 iteritems = operator.methodcaller('iteritems') except ImportError: # pragma: no cover (py3 only) from configparser import ConfigParser from html.parser import HTMLParser import urllib.request as urllib2 iteritems = operator.methodcaller('items') from pkg_resources import parse_version nodeenv_version = '0.13.4' join = os.path.join abspath = os.path.abspath src_domain = "nodejs.org" is_PY3 = sys.version_info[0] == 3 if is_PY3: from functools import cmp_to_key # --------------------------------------------------------- # Utils # https://github.com/jhermann/waif/blob/master/python/to_uft8.py def to_utf8(text): """Convert given text to UTF-8 encoding (as far as possible).""" if not text or is_PY3: return text try: # unicode or pure ascii return text.encode("utf8") except UnicodeDecodeError: try: # successful UTF-8 decode means it's pretty sure UTF-8 text.decode("utf8") return text except UnicodeDecodeError: try: # get desperate; and yes, # this has a western hemisphere bias return text.decode("cp1252").encode("utf8") except UnicodeDecodeError: pass return text # return unchanged, hope for the best class Config(object): """ Configuration namespace. """ # Defaults node = 'latest' npm = 'latest' with_npm = False jobs = '2' without_ssl = False debug = False profile = False make = 'make' prebuilt = False @classmethod def _load(cls, configfiles, verbose=False): """ Load configuration from the given files in reverse order, if they exist and have a [nodeenv] section. """ for configfile in reversed(configfiles): configfile = os.path.expanduser(configfile) if not os.path.exists(configfile): continue ini_file = ConfigParser() ini_file.read(configfile) section = "nodeenv" if not ini_file.has_section(section): continue for attr, val in iteritems(vars(cls)): if attr.startswith('_') or not \ ini_file.has_option(section, attr): continue if isinstance(val, bool): val = ini_file.getboolean(section, attr) else: val = ini_file.get(section, attr) if verbose: print('CONFIG {0}: {1} = {2}'.format( os.path.basename(configfile), attr, val)) setattr(cls, attr, val) @classmethod def _dump(cls): """ Print defaults for the README. """ print(" [nodeenv]") print(" " + "\n ".join( "%s = %s" % (k, v) for k, v in sorted(iteritems(vars(cls))) if not k.startswith('_'))) Config._default = dict( (attr, val) for attr, val in iteritems(vars(Config)) if not attr.startswith('_') ) def clear_output(out): """ Remove new-lines and """ return out.decode('utf-8').replace('\n', '') def remove_env_bin_from_path(env, env_bin_dir): """ Remove bin directory of the current environment from PATH """ return env.replace(env_bin_dir + ':', '') def node_version_from_opt(opt): """ Parse the node version from the optparse options """ if opt.node == 'system': out, err = subprocess.Popen( ["node", "--version"], stdout=subprocess.PIPE).communicate() return parse_version(clear_output(out).replace('v', '')) return parse_version(opt.node) def create_logger(): """ Create logger for diagnostic """ # create logger logger = logging.getLogger("nodeenv") logger.setLevel(logging.INFO) # monkey patch def emit(self, record): msg = self.format(record) fs = "%s" if getattr(record, "continued", False) else "%s\n" self.stream.write(fs % to_utf8(msg)) self.flush() logging.StreamHandler.emit = emit # create console handler and set level to debug ch = logging.StreamHandler() ch.setLevel(logging.DEBUG) # create formatter formatter = logging.Formatter(fmt="%(message)s") # add formatter to ch ch.setFormatter(formatter) # add ch to logger logger.addHandler(ch) return logger logger = create_logger() def parse_args(check=True): """ Parses command line arguments. Set `check` to False to skip validation checks. """ parser = optparse.OptionParser( version=nodeenv_version, usage="%prog [OPTIONS] ENV_DIR") parser.add_option( '-n', '--node', dest='node', metavar='NODE_VER', default=Config.node, help='The 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 `system` to use system-wide node.') parser.add_option( '-i', '--iojs', action='store_true', dest='io', default=False, help='Use iojs instead of nodejs.') parser.add_option( '-j', '--jobs', dest='jobs', default=Config.jobs, help='Sets number of parallel commands at node.js compilation. ' 'The default is 2 jobs.') parser.add_option( '--load-average', dest='load_average', help='Sets maximum load average for executing parallel commands ' 'at node.js compilation.') parser.add_option( '-v', '--verbose', action='store_true', dest='verbose', default=False, help="Verbose mode") parser.add_option( '-q', '--quiet', action='store_true', dest='quiet', default=False, help="Quiet mode") parser.add_option( '-C', '--config-file', dest='config_file', default=None, help="Load a different file than '~/.nodeenvrc'. " "Pass an empty string for no config (use built-in defaults).") parser.add_option( '-r', '--requirements', dest='requirements', default='', metavar='FILENAME', help='Install all the packages listed in the given requirements file.') parser.add_option( '--prompt', dest='prompt', help='Provides an alternative prompt prefix for this environment') parser.add_option( '-l', '--list', dest='list', action='store_true', default=False, help='Lists available node.js versions') parser.add_option( '--update', dest='update', action='store_true', default=False, help='Install npm packages from file without node') parser.add_option( '--without-ssl', dest='without_ssl', action='store_true', default=Config.without_ssl, help='Build node.js without SSL support') parser.add_option( '--debug', dest='debug', action='store_true', default=Config.debug, help='Build debug variant of the node.js') parser.add_option( '--profile', dest='profile', action='store_true', default=Config.profile, help='Enable profiling for node.js') parser.add_option( '--with-npm', dest='with_npm', action='store_true', default=Config.with_npm, help='Build 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.') parser.add_option( '--npm', dest='npm', metavar='NPM_VER', default=Config.npm, help='The 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`).') parser.add_option( '--no-npm-clean', dest='no_npm_clean', action='store_true', default=False, help='Skip the npm 0.x cleanup. Cleanup is enabled by default.') parser.add_option( '--python-virtualenv', '-p', dest='python_virtualenv', action='store_true', default=False, help='Use current python virtualenv') parser.add_option( '--clean-src', '-c', dest='clean_src', action='store_true', default=False, help='Remove "src" directory after installation') parser.add_option( '--force', dest='force', action='store_true', default=False, help='Force installation in a pre-existing directory') parser.add_option( '--make', '-m', dest='make_path', metavar='MAKE_PATH', help='Path to make command', default=Config.make) parser.add_option( '--prebuilt', dest='prebuilt', action='store_true', default=Config.prebuilt, help='Install node.js from prebuilt package') options, args = parser.parse_args() if options.config_file is None: options.config_file = ["./setup.cfg", "~/.nodeenvrc"] elif not options.config_file: options.config_file = [] else: # Make sure that explicitly provided files exist if not os.path.exists(options.config_file): parser.error("Config file '{0}' doesn't exist!".format( options.config_file)) options.config_file = [options.config_file] if not check: return options, args if not options.list and not options.python_virtualenv: if not args: parser.error('You must provide a DEST_DIR or ' 'use current python virtualenv') if len(args) > 1: parser.error('There must be only one argument: DEST_DIR ' '(you gave: {0})'.format(' '.join(args))) return options, args def mkdir(path): """ Create directory """ if not os.path.exists(path): logger.debug(' * Creating: %s ... ', path, extra=dict(continued=True)) os.makedirs(path) logger.debug('done.') else: logger.debug(' * Directory %s already exists', path) def writefile(dest, content, overwrite=True, append=False): """ Create file and write content in it """ content = to_utf8(content) if is_PY3: content = bytes(content, 'utf-8') if not os.path.exists(dest): logger.debug(' * Writing %s ... ', dest, extra=dict(continued=True)) with open(dest, 'wb') as f: f.write(content) logger.debug('done.') return else: with open(dest, 'rb') as f: c = f.read() if c == content: logger.debug(' * Content %s already in place', dest) return if not overwrite: logger.info(' * File %s exists with different content; ' ' not overwriting', dest) return if append: logger.info(' * Appending data to %s', dest) with open(dest, 'ab') as f: f.write(DISABLE_POMPT.encode('utf-8')) f.write(content) f.write(ENABLE_PROMPT.encode('utf-8')) return logger.info(' * Overwriting %s with new content', dest) with open(dest, 'wb') as f: f.write(content) def callit(cmd, show_stdout=True, in_shell=False, cwd=None, extra_env=None): """ Execute cmd line in sub-shell """ all_output = [] cmd_parts = [] for part in cmd: if len(part) > 45: part = part[:20] + "..." + part[-20:] if ' ' in part or '\n' in part or '"' in part or "'" in part: part = '"%s"' % part.replace('"', '\\"') cmd_parts.append(part) cmd_desc = ' '.join(cmd_parts) logger.debug(" ** Running command %s" % cmd_desc) if in_shell: cmd = ' '.join(cmd) # output stdout = subprocess.PIPE # env if extra_env: env = os.environ.copy() if extra_env: env.update(extra_env) else: env = None # execute try: proc = subprocess.Popen( cmd, stderr=subprocess.STDOUT, stdin=None, stdout=stdout, cwd=cwd, env=env, shell=in_shell) except Exception: e = sys.exc_info()[1] logger.error("Error %s while executing command %s" % (e, cmd_desc)) raise stdout = proc.stdout while stdout: line = stdout.readline() if not line: break line = line.decode('utf-8').rstrip() all_output.append(line) if show_stdout: logger.info(line) proc.wait() # error handler if proc.returncode: if show_stdout: for s in all_output: logger.critical(s) raise OSError("Command %s failed with error code %s" % (cmd_desc, proc.returncode)) return proc.returncode, all_output def get_node_src_url(version, postfix=''): node_name = '%s-v%s%s' % (get_binary_prefix(), version, postfix) tar_name = '%s.tar.gz' % (node_name) if parse_version(version) > parse_version("0.5.0"): node_url = 'http://%s/dist/v%s/%s' % (src_domain, version, tar_name) else: node_url = 'http://%s/dist/%s' % (src_domain, tar_name) return node_url @contextlib.contextmanager def tarfile_open(*args, **kwargs): """Compatibility layer because py26.""" tf = tarfile.open(*args, **kwargs) try: yield tf finally: tf.close() def download_node(node_url, src_dir, env_dir, opt): """ Download source code """ tar_contents = io.BytesIO(urlopen(node_url).read()) with tarfile_open(fileobj=tar_contents) as tarfile_obj: tarfile_obj.extractall(src_dir) logger.info(')', extra=dict(continued=True)) def get_node_src_url_postfix(opt): if not opt.prebuilt: return '' import platform postfix_system = platform.system().lower() arches = {'x86_64': 'x64', 'i686': 'x86'} postfix_arch = arches[platform.machine()] return '-{0}-{1}'.format(postfix_system, postfix_arch) def urlopen(url): headers = {'User-Agent': 'nodeenv v.' + nodeenv_version} req = urllib2.Request(url, None, headers) return urllib2.urlopen(req) # --------------------------------------------------------- # Virtual environment functions def copy_node_from_prebuilt(env_dir, src_dir): """ Copy prebuilt binaries into environment """ logger.info('.', extra=dict(continued=True)) prefix = get_binary_prefix() callit(['cp', '-a', src_dir + '/%s-v*/*' % prefix, env_dir], True, env_dir) logger.info('.', extra=dict(continued=True)) def build_node_from_src(env_dir, src_dir, node_src_dir, opt): env = {} make_param_names = ['load-average', 'jobs'] make_param_values = map( lambda x: getattr(opt, x.replace('-', '_')), make_param_names) make_opts = [ '--{0}={1}'.format(name, value) if len(value) > 0 else '--{0}'.format(name) for name, value in zip(make_param_names, make_param_values) if value is not None ] if getattr(sys.version_info, 'major', sys.version_info[0]) > 2: # Currently, the node.js build scripts are using python2.*, # therefore we need to temporarily point python exec to the # python 2.* version in this case. try: _, which_python2_output = callit( ['which', 'python2'], opt.verbose, True, node_src_dir, env ) python2_path = which_python2_output[0] except (OSError, IndexError): raise OSError( 'Python >=3.0 virtualenv detected, but no python2 ' 'command (required for building node.js) was found' ) logger.debug(' * Temporarily pointing python to %s', python2_path) node_tmpbin_dir = join(src_dir, 'tmpbin') node_tmpbin_link = join(node_tmpbin_dir, 'python') mkdir(node_tmpbin_dir) if not os.path.exists(node_tmpbin_link): callit(['ln', '-s', python2_path, node_tmpbin_link]) env['PATH'] = '{}:{}'.format(node_tmpbin_dir, os.environ.get('PATH', '')) conf_cmd = [] conf_cmd.append('./configure') conf_cmd.append('--prefix=%s' % pipes.quote(env_dir)) if opt.without_ssl: conf_cmd.append('--without-ssl') if opt.debug: conf_cmd.append('--debug') if opt.profile: conf_cmd.append('--profile') make_cmd = opt.make_path callit(conf_cmd, opt.verbose, True, node_src_dir, env) logger.info('.', extra=dict(continued=True)) callit([make_cmd] + make_opts, opt.verbose, True, node_src_dir, env) logger.info('.', extra=dict(continued=True)) callit([make_cmd + ' install'], opt.verbose, True, node_src_dir, env) def get_binary_prefix(): return to_utf8('node' if src_domain == 'nodejs.org' else 'iojs') def install_node(env_dir, src_dir, opt): """ Download source code for node.js, unpack it and install it in virtual environment. """ prefix = get_binary_prefix() logger.info(' * Install %s (%s' % (prefix, opt.node), extra=dict(continued=True)) node_url = get_node_src_url(opt.node, get_node_src_url_postfix(opt)) node_src_dir = join(src_dir, to_utf8('%s-v%s' % (prefix, opt.node))) env_dir = abspath(env_dir) # get src if not downloaded yet if not os.path.exists(node_src_dir): download_node(node_url, src_dir, env_dir, opt) logger.info('.', extra=dict(continued=True)) if opt.prebuilt: copy_node_from_prebuilt(env_dir, src_dir) else: build_node_from_src(env_dir, src_dir, node_src_dir, opt) logger.info(' done.') def install_npm(env_dir, src_dir, opt): """ Download source code for npm, unpack it and install it in virtual environment. """ logger.info(' * Install npm.js (%s) ... ' % opt.npm, extra=dict(continued=True)) npm_contents = urlopen('https://www.npmjs.org/install.sh').read() env = dict( os.environ, clean='no' if opt.no_npm_clean else 'yes', npm_install=opt.npm, ) proc = subprocess.Popen( ( 'bash', '-c', '. {0} && exec bash'.format( pipes.quote(join(env_dir, 'bin', 'activate')), ) ), env=env, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, ) out, _ = proc.communicate(npm_contents) if opt.verbose: logger.info(out) logger.info('done.') def install_packages(env_dir, opt): """ Install node.js packages via npm """ logger.info(' * Install node.js packages ... ', extra=dict(continued=True)) packages = [package.strip() for package in open(opt.requirements).readlines()] activate_path = join(env_dir, 'bin', 'activate') real_npm_ver = opt.npm if opt.npm.count(".") == 2 else opt.npm + ".0" if opt.npm == "latest" or real_npm_ver >= "1.0.0": cmd = '. ' + pipes.quote(activate_path) + \ ' && npm install -g %(pack)s' else: cmd = '. ' + pipes.quote(activate_path) + \ ' && npm install %(pack)s' + \ ' && npm activate %(pack)s' for package in packages: if not package: continue callit(cmd=[ cmd % {"pack": package}], show_stdout=opt.verbose, in_shell=True) logger.info('done.') def install_activate(env_dir, opt): """ Install virtual environment activation script """ files = {'activate': ACTIVATE_SH, 'shim': SHIM} if opt.node == "system": files["node"] = SHIM bin_dir = join(env_dir, 'bin') mod_dir = join('lib', 'node_modules') prompt = opt.prompt or '(%s)' % os.path.basename(os.path.abspath(env_dir)) mode_0755 = (stat.S_IRWXU | stat.S_IXGRP | stat.S_IRGRP | stat.S_IROTH | stat.S_IXOTH) shim_node = join(bin_dir, "node") shim_nodejs = join(bin_dir, "nodejs") if opt.node == "system": env = os.environ.copy() env.update({'PATH': remove_env_bin_from_path(env['PATH'], bin_dir)}) for candidate in ("nodejs", "node"): which_node_output, _ = subprocess.Popen( ["which", candidate], stdout=subprocess.PIPE, env=env).communicate() shim_node = clear_output(which_node_output) if shim_node: break assert shim_node, "Did not find nodejs or node system executable" for name, content in files.items(): file_path = join(bin_dir, name) content = content.replace('__NODE_VIRTUAL_PROMPT__', prompt) content = content.replace('__NODE_VIRTUAL_ENV__', os.path.abspath(env_dir)) content = content.replace('__SHIM_NODE__', shim_node) content = content.replace('__BIN_NAME__', os.path.basename(bin_dir)) content = content.replace('__MOD_NAME__', mod_dir) # if we call in the same environment: # $ nodeenv -p --prebuilt # $ nodeenv -p --node=system # we should get `bin/node` not as binary+string. # `bin/activate` should be appended if we inside # existing python's virtual environment need_append = 0 if name in ('node', 'shim') else opt.python_virtualenv writefile(file_path, content, append=need_append) os.chmod(file_path, mode_0755) if not os.path.exists(shim_nodejs): os.symlink("node", shim_nodejs) def create_environment(env_dir, opt): """ Creates a new environment in ``env_dir``. """ if os.path.exists(env_dir) and not opt.python_virtualenv: logger.info(' * Environment already exists: %s', env_dir) if not opt.force: sys.exit(2) src_dir = to_utf8(abspath(join(env_dir, 'src'))) mkdir(src_dir) if opt.node != "system": install_node(env_dir, src_dir, opt) else: mkdir(join(env_dir, 'bin')) mkdir(join(env_dir, 'lib')) mkdir(join(env_dir, 'lib', 'node_modules')) # activate script install must be # before npm install, npm use activate # for install install_activate(env_dir, opt) if node_version_from_opt(opt) < parse_version("0.6.3") or opt.with_npm: install_npm(env_dir, src_dir, opt) if opt.requirements: install_packages(env_dir, opt) # Cleanup if opt.clean_src: callit(['rm -rf', pipes.quote(src_dir)], opt.verbose, True, env_dir) class GetsAHrefs(HTMLParser): def __init__(self): # Old style class in py2 :( HTMLParser.__init__(self) self.hrefs = [] def handle_starttag(self, tag, attrs): if tag == 'a': self.hrefs.append(dict(attrs).get('href', '')) VERSION_RE = re.compile('\d+\.\d+\.\d+') def _py2_cmp(a, b): # -1 = a < b, 0 = eq, 1 = a > b return (a > b) - (a < b) def compare_versions(version, other_version): version_tuple = version.split('.') other_tuple = other_version.split('.') version_length = len(version_tuple) other_length = len(other_tuple) version_dots = min(version_length, other_length) for i in range(version_dots): a = int(version_tuple[i]) b = int(other_tuple[i]) cmp_value = _py2_cmp(a, b) if cmp_value != 0: return cmp_value return _py2_cmp(version_length, other_length) def get_node_versions(): response = urlopen('https://{0}/dist'.format(src_domain)) href_parser = GetsAHrefs() href_parser.feed(response.read().decode('UTF-8')) versions = set( VERSION_RE.search(href).group() for href in href_parser.hrefs if VERSION_RE.search(href) ) if is_PY3: key_compare = cmp_to_key(compare_versions) versions = sorted(versions, key=key_compare) else: versions = sorted(versions, cmp=compare_versions) return versions def print_node_versions(): """ Prints into stdout all available node.js versions """ versions = get_node_versions() chunks_of_8 = [ versions[pos:pos + 8] for pos in range(0, len(versions), 8) ] for chunk in chunks_of_8: logger.info('\t'.join(chunk)) def get_last_stable_node_version(): """ Return last stable node.js version """ response = urlopen('https://%s/dist/latest/' % (src_domain)) href_parser = GetsAHrefs() href_parser.feed(response.read().decode('UTF-8')) links = [] pattern = re.compile(r'''%s-v([0-9]+)\.([0-9]+)\.([0-9]+)\.tar\.gz''' % ( get_binary_prefix())) for href in href_parser.hrefs: match = pattern.match(href) if match: version = u'.'.join(match.groups()) major, minor, revision = map(int, match.groups()) links.append((version, major, minor, revision)) break return links[-1][0] def get_env_dir(opt, args): if opt.python_virtualenv: if hasattr(sys, 'real_prefix'): res = sys.prefix elif hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix: res = sys.prefix else: logger.error('No python virtualenv is available') sys.exit(2) else: res = args[0] return to_utf8(res) def is_installed(name): try: devnull = open(os.devnull) subprocess.Popen([name], stdout=devnull, stderr=devnull) except OSError as e: if e.errno == os.errno.ENOENT: return False return True def main(): """ Entry point """ # quick&dirty way to help update the README if "--dump-config-defaults" in sys.argv: Config._dump() return opt, args = parse_args(check=False) Config._load(opt.config_file, opt.verbose) opt, args = parse_args() if opt.io: global src_domain src_domain = "iojs.org" if not opt.node or opt.node.lower() == "latest": opt.node = get_last_stable_node_version() if opt.list: print_node_versions() elif opt.update: env_dir = get_env_dir(opt, args) install_packages(env_dir, opt) else: env_dir = get_env_dir(opt, args) create_environment(env_dir, opt) # --------------------------------------------------------- # Shell scripts content DISABLE_POMPT = """ # 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 """ ENABLE_PROMPT = """ unset NODE_VIRTUAL_ENV_DISABLE_PROMPT """ SHIM = """#!/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__ "$@" """ ACTIVATE_SH = """ # 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 irrelavent 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="$( cd -P "$( dirname "$SOURCE" )" && 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/__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="$NODE_VIRTUAL_ENV" npm_config_prefix="$NODE_VIRTUAL_ENV" 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 """ if __name__ == '__main__': main() nodeenv-0.13.4/requirements-dev.txt000066400000000000000000000000421257103704000172700ustar00rootroot00000000000000-e . coverage flake8 mock pytest nodeenv-0.13.4/setup.py000066400000000000000000000023011257103704000147420ustar00rootroot00000000000000# -*- coding: utf-8 -*- """ nodeenv ~~~~~~~ Node.js Virtual Environment builder. """ import codecs import os from nodeenv import nodeenv_version from setuptools import setup def read_file(file_name): return codecs.open( os.path.join( os.path.dirname(os.path.abspath(__file__)), file_name ), encoding='utf-8', ).read() ldesc = read_file('README.rst') ldesc += "\n\n" + read_file('CHANGES') setup( name='nodeenv', version=nodeenv_version, url='https://github.com/ekalinin/nodeenv', license='BSD', author='Eugene Kalinin', author_email='e.v.kalinin@gmail.com', install_requires=[], description="Node.js virtual environment builder", long_description=ldesc, py_modules=['nodeenv'], entry_points={ 'console_scripts': ['nodeenv = nodeenv:main'] }, zip_safe=False, platforms='any', classifiers=[ 'Development Status :: 4 - Beta', 'Environment :: Web Environment', 'Intended Audience :: Developers', 'License :: OSI Approved :: BSD License', 'Programming Language :: Python', 'Topic :: Software Development :: Libraries :: Python Modules' ] ) nodeenv-0.13.4/tests/000077500000000000000000000000001257103704000143765ustar00rootroot00000000000000nodeenv-0.13.4/tests/__init__.py000066400000000000000000000000001257103704000164750ustar00rootroot00000000000000nodeenv-0.13.4/tests/iojs.htm000066400000000000000000000045731257103704000160650ustar00rootroot00000000000000 Index of /dist/latest/

Index of /dist/latest/


../
doc/                                               14-Jan-2015 04:43                   -
win-x64/                                           14-Jan-2015 04:48                   -
win-x86/                                           14-Jan-2015 04:45                   -
SHASUMS256.txt                                     14-Jan-2015 05:04                1428
SHASUMS256.txt.asc                                 14-Jan-2015 05:04                1948
SHASUMS256.txt.gpg                                 14-Jan-2015 05:04                2141
iojs-v1.0.1-darwin-x64.tar.gz                      14-Jan-2015 04:38             6463647
iojs-v1.0.1-linux-armv7l.tar.gz                    14-Jan-2015 04:59             7275326
iojs-v1.0.1-linux-armv7l.tar.xz                    14-Jan-2015 04:59             4848364
iojs-v1.0.1-linux-x64.tar.gz                       14-Jan-2015 04:42             7782045
iojs-v1.0.1-linux-x64.tar.xz                       14-Jan-2015 04:42             5331880
iojs-v1.0.1-linux-x86.tar.gz                       14-Jan-2015 04:43             7584510
iojs-v1.0.1-linux-x86.tar.xz                       14-Jan-2015 04:43             5184944
iojs-v1.0.1-x64.msi                                14-Jan-2015 04:49             7313864
iojs-v1.0.1-x86.msi                                14-Jan-2015 04:46             6707654
iojs-v1.0.1.pkg                                    14-Jan-2015 04:41             8608836
iojs-v1.0.1.tar.gz                                 14-Jan-2015 04:43            19056750
iojs-v1.0.1.tar.xz                                 14-Jan-2015 04:43            11892124

nodeenv-0.13.4/tests/iojs_dist.htm000066400000000000000000000022071257103704000171000ustar00rootroot00000000000000 Index of /dist/

Index of /dist/


../
latest/                                            03-Feb-2015 23:30                   -
v1.0.0/                                            14-Jan-2015 03:59                   -
v1.0.1/                                            14-Jan-2015 05:03                   -
v1.0.2/                                            16-Jan-2015 05:37                   -
v1.0.3/                                            20-Jan-2015 07:54                   -
v1.0.4/                                            24-Jan-2015 12:13                   -
v1.1.0/                                            03-Feb-2015 23:30                   -
index.json                                         03-Feb-2015 23:30                1646
index.tab                                          03-Feb-2015 23:30                1039

nodeenv-0.13.4/tests/nodeenv_test.py000066400000000000000000000113331257103704000174460ustar00rootroot00000000000000from __future__ import absolute_import from __future__ import unicode_literals import io import os.path import subprocess import mock import pytest import nodeenv HERE = os.path.abspath(os.path.dirname(__file__)) def test_compare_versions(): assert nodeenv.compare_versions('1', '2') == -1 assert nodeenv.compare_versions('1', '2') == -1 assert nodeenv.compare_versions('0.1', '0.2') == -1 assert nodeenv.compare_versions('0.9', '0.10') == -1 assert nodeenv.compare_versions('0.2', '0.2.1') == -1 assert nodeenv.compare_versions('0.2.1', '0.2.10') == -1 assert nodeenv.compare_versions('0.2.9', '0.2.10') == -1 assert nodeenv.compare_versions('0.2.1', '0.3') == -1 def test_gets_a_hrefs_trivial(): parser = nodeenv.GetsAHrefs() parser.feed('') assert parser.hrefs == [] def test_gets_a_hrefs_nodejs_org(): # Retrieved 2015-01-15 contents = io.open(os.path.join(HERE, 'nodejs.htm')).read() parser = nodeenv.GetsAHrefs() parser.feed(contents) # Smoke test assert parser.hrefs == [ '../', 'docs/', 'x64/', 'SHASUMS.txt', 'SHASUMS.txt.asc', 'SHASUMS.txt.gpg', 'SHASUMS256.txt', 'SHASUMS256.txt.asc', 'SHASUMS256.txt.gpg', 'node-v0.10.35-darwin-x64.tar.gz', 'node-v0.10.35-darwin-x86.tar.gz', 'node-v0.10.35-linux-x64.tar.gz', 'node-v0.10.35-linux-x86.tar.gz', 'node-v0.10.35-sunos-x64.tar.gz', 'node-v0.10.35-sunos-x86.tar.gz', 'node-v0.10.35-x86.msi', 'node-v0.10.35.pkg', 'node-v0.10.35.tar.gz', 'node.exe', 'node.exp', 'node.lib', 'node.pdb', 'openssl-cli.exe', 'openssl-cli.pdb', ] def test_gets_a_hrefs_iojs_org(): # Retrieved 2015-01-15 contents = io.open(os.path.join(HERE, 'iojs.htm')).read() parser = nodeenv.GetsAHrefs() parser.feed(contents) # Smoke test assert parser.hrefs == [ '../', 'doc/', 'win-x64/', 'win-x86/', 'SHASUMS256.txt', 'SHASUMS256.txt.asc', 'SHASUMS256.txt.gpg', 'iojs-v1.0.1-darwin-x64.tar.gz', 'iojs-v1.0.1-linux-armv7l.tar.gz', 'iojs-v1.0.1-linux-armv7l.tar.xz', 'iojs-v1.0.1-linux-x64.tar.gz', 'iojs-v1.0.1-linux-x64.tar.xz', 'iojs-v1.0.1-linux-x86.tar.gz', 'iojs-v1.0.1-linux-x86.tar.xz', 'iojs-v1.0.1-x64.msi', 'iojs-v1.0.1-x86.msi', 'iojs-v1.0.1.pkg', 'iojs-v1.0.1.tar.gz', 'iojs-v1.0.1.tar.xz', ] @pytest.mark.integration def test_smoke(tmpdir): nenv_path = tmpdir.join('nenv').strpath subprocess.check_call([ # Enable coverage 'coverage', 'run', '-p', '-m', 'nodeenv', '--prebuilt', nenv_path, ]) assert os.path.exists(nenv_path) subprocess.check_call([ 'sh', '-c', '. {0}/bin/activate && nodejs --version'.format(nenv_path), ]) @pytest.yield_fixture def returns_iojs_dist(): with io.open(os.path.join(HERE, 'iojs_dist.htm'), 'rb') as iojs_dist: with mock.patch.object(nodeenv, 'urlopen', return_value=iojs_dist): yield @pytest.yield_fixture def returns_nodejs_dist(): with io.open(os.path.join(HERE, 'nodejs_dist.htm'), 'rb') as node_dist: with mock.patch.object(nodeenv, 'urlopen', return_value=node_dist): yield @pytest.yield_fixture def cap_logging_info(): with mock.patch.object(nodeenv.logger, 'info') as mck: yield mck def mck_to_out(mck): return '\n'.join(call[0][0] for call in mck.call_args_list) @pytest.mark.usefixtures('returns_iojs_dist') def test_get_node_versions_iojs(): versions = nodeenv.get_node_versions() assert versions == ['1.0.0', '1.0.1', '1.0.2', '1.0.3', '1.0.4', '1.1.0'] @pytest.mark.usefixtures('returns_nodejs_dist') def test_get_node_versions_nodejs(): versions = nodeenv.get_node_versions() # There's a lot of versions here, let's just do some sanity assertions assert len(versions) == 227 assert versions[0:3] == ['0.0.1', '0.0.2', '0.0.3'] assert versions[-3:] == ['0.11.15', '0.11.16', '0.12.0'] @pytest.mark.usefixtures('returns_iojs_dist') def test_print_node_versions_iojs(cap_logging_info): nodeenv.print_node_versions() printed = mck_to_out(cap_logging_info) assert printed == '1.0.0\t1.0.1\t1.0.2\t1.0.3\t1.0.4\t1.1.0' @pytest.mark.usefixtures('returns_nodejs_dist') def test_print_node_versions_node(cap_logging_info): nodeenv.print_node_versions() printed = mck_to_out(cap_logging_info) # There's a lot of output here, let's just assert a few things assert printed.startswith( '0.0.1\t0.0.2\t0.0.3\t0.0.4\t0.0.5\t0.0.6\t0.1.0\t0.1.1\n' ) assert printed.endswith('\n0.11.15\t0.11.16\t0.12.0') tabs_per_line = [line.count('\t') for line in printed.splitlines()] # 8 items per line = 7 tabs # The last line contains the remaning 3 items assert tabs_per_line == [7] * 28 + [2] nodeenv-0.13.4/tests/nodejs.htm000066400000000000000000000056601257103704000164010ustar00rootroot00000000000000 Index of /dist/latest/

Index of /dist/latest/


../
docs/                                              25-Dec-2014 16:16                   -
x64/                                               22-Dec-2014 21:33                   -
SHASUMS.txt                                        22-Dec-2014 21:50                1359
SHASUMS.txt.asc                                    22-Dec-2014 21:50                1649
SHASUMS.txt.gpg                                    22-Dec-2014 21:50                 845
SHASUMS256.txt                                     22-Dec-2014 21:50                1887
SHASUMS256.txt.asc                                 22-Dec-2014 21:50                2177
SHASUMS256.txt.gpg                                 22-Dec-2014 21:50                1159
node-v0.10.35-darwin-x64.tar.gz                    22-Dec-2014 21:32             5119135
node-v0.10.35-darwin-x86.tar.gz                    22-Dec-2014 21:29             4944714
node-v0.10.35-linux-x64.tar.gz                     22-Dec-2014 21:32             5674318
node-v0.10.35-linux-x86.tar.gz                     22-Dec-2014 21:32             5476680
node-v0.10.35-sunos-x64.tar.gz                     22-Dec-2014 21:38             6942340
node-v0.10.35-sunos-x86.tar.gz                     22-Dec-2014 21:38             6515411
node-v0.10.35-x86.msi                              22-Dec-2014 21:48             5808128
node-v0.10.35.pkg                                  22-Dec-2014 21:35            10279155
node-v0.10.35.tar.gz                               22-Dec-2014 21:28            14417025
node.exe                                           22-Dec-2014 21:48             5832576
node.exp                                           22-Dec-2014 21:48              186902
node.lib                                           22-Dec-2014 21:48              304702
node.pdb                                           22-Dec-2014 21:48            17574912
openssl-cli.exe                                    22-Dec-2014 21:48             1829888
openssl-cli.pdb                                    22-Dec-2014 21:48             7457792

nodeenv-0.13.4/tests/nodejs_dist.htm000066400000000000000000000706371257103704000174320ustar00rootroot00000000000000 Index of /dist/

Index of /dist/


../
latest/                                            06-Feb-2015 22:03                   -
nightlies/                                         07-Aug-2014 17:11                   -
npm/                                               23-May-2014 16:55                   -
patch/                                             30-Jul-2014 23:02                   -
v0.10.0/                                           19-Mar-2013 04:14                   -
v0.10.1/                                           21-Mar-2013 19:04                   -
v0.10.10/                                          12-Jun-2013 22:46                   -
v0.10.11/                                          13-Jun-2013 22:11                   -
v0.10.12/                                          19-Jun-2013 02:19                   -
v0.10.13/                                          13-Jul-2013 20:14                   -
v0.10.14/                                          12-Aug-2013 20:37                   -
v0.10.15/                                          12-Aug-2013 20:52                   -
v0.10.16/                                          16-Aug-2013 19:35                   -
v0.10.16-isaacs-manual/                            16-Aug-2013 16:26                   -
v0.10.17/                                          22-Aug-2013 17:23                   -
v0.10.18/                                          09-Oct-2013 03:56                   -
v0.10.19/                                          09-Oct-2013 17:15                   -
v0.10.2/                                           03-Apr-2013 05:01                   -
v0.10.20/                                          09-Oct-2013 17:25                   -
v0.10.21/                                          21-Oct-2013 19:55                   -
v0.10.22/                                          02-Dec-2013 16:59                   -
v0.10.23/                                          21-Jan-2014 18:51                   -
v0.10.24/                                          21-Jan-2014 19:01                   -
v0.10.25/                                          11-Apr-2014 20:13                   -
v0.10.26/                                          11-Apr-2014 20:34                   -
v0.10.27/                                          07-Aug-2014 17:43                   -
v0.10.28/                                          07-Aug-2014 18:35                   -
v0.10.29/                                          09-Jun-2014 17:45                   -
v0.10.3/                                           26-Apr-2013 23:11                   -
v0.10.30/                                          31-Jul-2014 19:13                   -
v0.10.31/                                          19-Aug-2014 22:12                   -
v0.10.32/                                          16-Sep-2014 23:52                   -
v0.10.33/                                          23-Oct-2014 19:12                   -
v0.10.34/                                          17-Dec-2014 21:59                   -
v0.10.35/                                          22-Dec-2014 21:51                   -
v0.10.36/                                          26-Jan-2015 19:56                   -
v0.10.4/                                           26-Apr-2013 23:41                   -
v0.10.5/                                           13-May-2013 22:31                   -
v0.10.6/                                           15-May-2013 17:35                   -
v0.10.7/                                           24-May-2013 02:36                   -
v0.10.8/                                           12-Jun-2013 19:42                   -
v0.10.9/                                           12-Jun-2013 19:51                   -
v0.11.0/                                           03-Apr-2013 18:43                   -
v0.11.1/                                           15-May-2013 17:47                   -
v0.11.10/                                          21-Jan-2014 19:19                   -
v0.11.11/                                          11-Apr-2014 20:49                   -
v0.11.12/                                          11-Apr-2014 21:06                   -
v0.11.13/                                          02-May-2014 14:53                   -
v0.11.14/                                          16-Jan-2015 16:37                   -
v0.11.15/                                          20-Jan-2015 23:42                   -
v0.11.16/                                          30-Jan-2015 17:05                   -
v0.11.2/                                           15-May-2013 18:29                   -
v0.11.3/                                           27-Jun-2013 00:26                   -
v0.11.4/                                           13-Jul-2013 19:50                   -
v0.11.5/                                           12-Aug-2013 21:07                   -
v0.11.6/                                           22-Aug-2013 17:24                   -
v0.11.7/                                           09-Oct-2013 17:56                   -
v0.11.8/                                           02-Dec-2013 18:57                   -
v0.11.9/                                           02-Dec-2013 19:16                   -
v0.12.0/                                           06-Feb-2015 22:03                   -
v0.5.1/                                            01-Apr-2012 01:55                   -
v0.5.10/                                           01-Apr-2012 01:55                   -
v0.5.2/                                            01-Apr-2012 01:55                   -
v0.5.3/                                            01-Apr-2012 01:55                   -
v0.5.4/                                            01-Apr-2012 01:55                   -
v0.5.5/                                            01-Apr-2012 01:55                   -
v0.5.6/                                            01-Apr-2012 01:55                   -
v0.5.7/                                            01-Apr-2012 01:55                   -
v0.5.8/                                            01-Apr-2012 01:55                   -
v0.5.9/                                            01-Apr-2012 01:55                   -
v0.6.0/                                            01-Apr-2012 01:55                   -
v0.6.1/                                            01-Apr-2012 01:55                   -
v0.6.10/                                           01-Apr-2012 01:55                   -
v0.6.11/                                           01-Apr-2012 01:55                   -
v0.6.12/                                           01-Apr-2012 01:55                   -
v0.6.13/                                           01-Apr-2012 01:55                   -
v0.6.14/                                           01-Apr-2012 01:55                   -
v0.6.15/                                           09-Apr-2012 18:02                   -
v0.6.16/                                           30-Apr-2012 20:25                   -
v0.6.17/                                           04-May-2012 20:29                   -
v0.6.18/                                           15-May-2012 17:01                   -
v0.6.19/                                           08-Jun-2012 18:27                   -
v0.6.2/                                            01-Apr-2012 01:55                   -
v0.6.20/                                           11-Jul-2012 00:02                   -
v0.6.21/                                           03-Aug-2012 21:38                   -
v0.6.3/                                            01-Apr-2012 01:55                   -
v0.6.4/                                            31-Mar-2012 20:17                   -
v0.6.5/                                            01-Apr-2012 01:55                   -
v0.6.6/                                            01-Apr-2012 01:55                   -
v0.6.7/                                            01-Apr-2012 01:55                   -
v0.6.8/                                            01-Apr-2012 01:55                   -
v0.6.9/                                            01-Apr-2012 01:55                   -
v0.7.0/                                            01-Apr-2012 01:55                   -
v0.7.1/                                            01-Apr-2012 01:55                   -
v0.7.10/                                           11-Jun-2012 19:34                   -
v0.7.11/                                           15-Jun-2012 22:24                   -
v0.7.12/                                           20-Jun-2012 00:14                   -
v0.7.2/                                            01-Apr-2012 01:55                   -
v0.7.3/                                            01-Apr-2012 01:55                   -
v0.7.4/                                            01-Apr-2012 01:55                   -
v0.7.5/                                            01-Apr-2012 01:55                   -
v0.7.6/                                            01-Apr-2012 01:55                   -
v0.7.7/                                            01-Apr-2012 01:55                   -
v0.7.8/                                            18-Apr-2012 17:37                   -
v0.7.9/                                            11-Jun-2012 15:53                   -
v0.8.0/                                            25-Jun-2012 15:28                   -
v0.8.1/                                            29-Jun-2012 17:07                   -
v0.8.10/                                           25-Sep-2012 22:31                   -
v0.8.11/                                           27-Sep-2012 17:17                   -
v0.8.12/                                           11-Oct-2012 23:42                   -
v0.8.13/                                           25-Oct-2012 19:50                   -
v0.8.14/                                           25-Oct-2012 21:42                   -
v0.8.15/                                           26-Nov-2012 17:11                   -
v0.8.16/                                           13-Dec-2012 16:46                   -
v0.8.17/                                           13-Jan-2013 04:59                   -
v0.8.18/                                           24-Jan-2013 22:25                   -
v0.8.19/                                           08-Feb-2013 00:20                   -
v0.8.2/                                            09-Jul-2012 17:20                   -
v0.8.20/                                           16-Feb-2013 06:22                   -
v0.8.21/                                           26-Feb-2013 20:37                   -
v0.8.22/                                           07-Mar-2013 07:19                   -
v0.8.23/                                           09-Apr-2013 00:30                   -
v0.8.24/                                           04-Jun-2013 14:12                   -
v0.8.25/                                           13-Jun-2013 20:17                   -
v0.8.26/                                           23-Jun-2014 17:02                   -
v0.8.27/                                           23-Jun-2014 17:12                   -
v0.8.28/                                           31-Jul-2014 18:36                   -
v0.8.3/                                            19-Jul-2012 17:16                   -
v0.8.4/                                            25-Jul-2012 22:24                   -
v0.8.5/                                            02-Aug-2012 21:53                   -
v0.8.6/                                            07-Aug-2012 19:00                   -
v0.8.7/                                            15-Aug-2012 23:34                   -
v0.8.8/                                            22-Aug-2012 20:37                   -
v0.8.9/                                            11-Sep-2012 18:54                   -
v0.9.0/                                            20-Jul-2012 18:49                   -
v0.9.1/                                            13-Sep-2012 19:30                   -
v0.9.10/                                           20-Feb-2013 20:23                   -
v0.9.11/                                           02-Mar-2013 21:21                   -
v0.9.12/                                           07-Mar-2013 07:54                   -
v0.9.2/                                            18-Sep-2012 01:24                   -
v0.9.3/                                            24-Oct-2012 17:06                   -
v0.9.4/                                            21-Dec-2012 20:31                   -
v0.9.5/                                            30-Dec-2012 01:22                   -
v0.9.6/                                            11-Jan-2013 19:21                   -
v0.9.7/                                            24-Jan-2013 20:49                   -
v0.9.8/                                            02-Feb-2013 19:12                   -
v0.9.9/                                            08-Feb-2013 00:21                   -
node-0.0.1.tar.gz                                  26-Aug-2011 16:22             2846972
node-0.0.2.tar.gz                                  26-Aug-2011 16:22             2847748
node-0.0.3.tar.gz                                  26-Aug-2011 16:22             2891652
node-0.0.4.tar.gz                                  26-Aug-2011 16:21             2891533
node-0.0.5.tar.gz                                  26-Aug-2011 16:22             2926727
node-0.0.6.tar.gz                                  26-Aug-2011 16:21             2952115
node-0.1.0.tar.gz                                  26-Aug-2011 16:21             3331341
node-0.1.1.tar.gz                                  26-Aug-2011 16:22             3390971
node-0.1.10.tar.gz                                 26-Aug-2011 16:22             3674389
node-0.1.11.tar.gz                                 26-Aug-2011 16:22             3683687
node-0.1.12.tar.gz                                 26-Aug-2011 16:21             3699939
node-0.1.13.tar.gz                                 26-Aug-2011 16:22             3718928
node-0.1.2.tar.gz                                  26-Aug-2011 16:21             3516421
node-0.1.3.tar.gz                                  26-Aug-2011 16:22             3527371
node-0.1.4.tar.gz                                  26-Aug-2011 16:21             3567057
node-0.1.5.tar.gz                                  26-Aug-2011 16:22             3598128
node-0.1.6.tar.gz                                  26-Aug-2011 16:22             3598051
node-0.1.7.tar.gz                                  26-Aug-2011 16:22             3599626
node-0.1.8.tar.gz                                  26-Aug-2011 16:22             3639185
node-0.1.9.tar.gz                                  26-Aug-2011 16:21             3639588
node-latest.tar.gz                                 06-Feb-2015 20:40            19096897
node-v0.1.100.tar.gz                               26-Aug-2011 16:21             3813493
node-v0.1.101.tar.gz                               26-Aug-2011 16:22             3825097
node-v0.1.102.tar.gz                               26-Aug-2011 16:21             3847409
node-v0.1.103.tar.gz                               26-Aug-2011 16:22             3843666
node-v0.1.104.tar.gz                               26-Aug-2011 16:21             3859322
node-v0.1.14.tar.gz                                26-Aug-2011 16:22             3736523
node-v0.1.15.tar.gz                                26-Aug-2011 16:21             3766716
node-v0.1.16.tar.gz                                26-Aug-2011 16:22             3827870
node-v0.1.17.tar.gz                                26-Aug-2011 16:21             3826866
node-v0.1.18.tar.gz                                26-Aug-2011 16:21             3537137
node-v0.1.19.tar.gz                                26-Aug-2011 16:22             3574916
node-v0.1.20.tar.gz                                26-Aug-2011 16:21             3575681
node-v0.1.21.tar.gz                                26-Aug-2011 16:22             3597096
node-v0.1.22.tar.gz                                26-Aug-2011 16:21             3604861
node-v0.1.23.tar.gz                                26-Aug-2011 16:22             3605321
node-v0.1.24.tar.gz                                26-Aug-2011 16:21             3649641
node-v0.1.25.tar.gz                                26-Aug-2011 16:22             3666675
node-v0.1.26.tar.gz                                26-Aug-2011 16:22             3704254
node-v0.1.27.tar.gz                                26-Aug-2011 16:22             3766114
node-v0.1.28.tar.gz                                26-Aug-2011 16:22             3804602
node-v0.1.29.tar.gz                                26-Aug-2011 16:21             3807335
node-v0.1.30.tar.gz                                26-Aug-2011 16:22             3912671
node-v0.1.31.tar.gz                                26-Aug-2011 16:22             3933441
node-v0.1.32.tar.gz                                26-Aug-2011 16:21             3984949
node-v0.1.33.tar.gz                                26-Aug-2011 16:22             4016600
node-v0.1.90.tar.gz                                26-Aug-2011 16:22             6452573
node-v0.1.91.tar.gz                                26-Aug-2011 16:21             6488023
node-v0.1.92.tar.gz                                26-Aug-2011 16:22             6535942
node-v0.1.93.tar.gz                                26-Aug-2011 16:21             6528767
node-v0.1.94.tar.gz                                26-Aug-2011 16:22             6691437
node-v0.1.95.tar.gz                                26-Aug-2011 16:21             3691396
node-v0.1.96.tar.gz                                26-Aug-2011 16:22             3697128
node-v0.1.97.tar.gz                                26-Aug-2011 16:21             3725213
node-v0.1.98.tar.gz                                26-Aug-2011 16:21             3770749
node-v0.1.99.tar.gz                                26-Aug-2011 16:22             3796156
node-v0.10.14.tar.gz                               25-Jul-2013 19:06            13782897
node-v0.2.0.tar.gz                                 26-Aug-2011 16:21             3869705
node-v0.2.1.tar.gz                                 26-Aug-2011 16:22             3874229
node-v0.2.2.tar.gz                                 26-Aug-2011 16:21             3876164
node-v0.2.3.tar.gz                                 26-Aug-2011 16:22             3877908
node-v0.2.4.tar.gz                                 26-Aug-2011 16:22             4002347
node-v0.2.5.tar.gz                                 26-Aug-2011 16:22             4008314
node-v0.2.6.tar.gz                                 26-Aug-2011 16:21             4010320
node-v0.3.0.tar.gz                                 26-Aug-2011 16:22             4054239
node-v0.3.1.tar.gz                                 26-Aug-2011 16:22             4147683
node-v0.3.2.tar.gz                                 26-Aug-2011 16:21             4433878
node-v0.3.3.tar.gz                                 26-Aug-2011 16:22             4582669
node-v0.3.4.tar.gz                                 26-Aug-2011 16:21             4610441
node-v0.3.5.tar.gz                                 26-Aug-2011 16:22             4655131
node-v0.3.6.tar.gz                                 26-Aug-2011 16:21             4727071
node-v0.3.7.tar.gz                                 26-Aug-2011 16:22             4748183
node-v0.3.8.tar.gz                                 26-Aug-2011 16:22             4779447
node-v0.4.0.tar.gz                                 26-Aug-2011 16:21             4827760
node-v0.4.1.tar.gz                                 26-Aug-2011 16:22             4855576
node-v0.4.10.tar.gz                                26-Aug-2011 16:22            12410018
node-v0.4.11.tar.gz                                26-Aug-2011 16:21            12419274
node-v0.4.12.tar.gz                                15-Sep-2011 23:48            12421469
node-v0.4.2.tar.gz                                 26-Aug-2011 16:22             4922523
node-v0.4.3.tar.gz                                 26-Aug-2011 16:22             4991966
node-v0.4.4.tar.gz                                 26-Aug-2011 16:21             4995935
node-v0.4.5.tar.gz                                 26-Aug-2011 16:22             5001301
node-v0.4.6.tar.gz                                 26-Aug-2011 16:21             5008110
node-v0.4.7.tar.gz                                 26-Aug-2011 16:22             5011520
node-v0.4.8.tar.gz                                 26-Aug-2011 16:22             4991396
node-v0.4.9.tar.gz                                 26-Aug-2011 16:21             4994552
node-v0.4.tar.gz                                   26-Aug-2011 16:21             4991396
node-v0.5.0.tar.gz                                 26-Aug-2011 16:21             5357945
node-v0.6.1.tar.gz                                 14-Nov-2011 21:57             9276847
node-v0.6.10.tar.gz                                15-Mar-2012 23:03            10545272
node-v0.6.11.tar.gz                                15-Mar-2012 23:03            10555423
node-v0.6.12.tar.gz                                15-Mar-2012 23:03            10452498
node-v0.6.13.tar.gz                                15-Mar-2012 23:04            10757157
node-v0.6.2.tar.gz                                 18-Nov-2011 23:29             9286655
node-v0.6.3.tar.gz                                 15-Mar-2012 23:07            10048403
node-v0.6.4.tar.gz                                 02-Dec-2011 02:17            10195975
node-v0.6.5.tar.gz                                 15-Mar-2012 23:04            10195654
node-v0.6.6.tar.gz                                 15-Mar-2012 23:04            10446671
node-v0.6.7.tar.gz                                 15-Mar-2012 23:04            10473188
node-v0.6.8.tar.gz                                 20-Jan-2012 02:26            10488841
node-v0.6.9.tar.gz                                 15-Mar-2012 23:03            10544243
npm-versions.txt                                   27-Feb-2014 00:01                1676

nodeenv-0.13.4/tox.ini000066400000000000000000000012151257103704000145460ustar00rootroot00000000000000[tox] # These should match the travis env list envlist = py26,py27,py33,py34,pypy,pypy3 [testenv] install_command = pip install --use-wheel {opts} {packages} deps = -rrequirements-dev.txt setenv = LANG=en_US.UTF-8 commands = coverage erase coverage run -p -m pytest {posargs:tests} # Needed because we subprocess to ourselves coverage combine coverage report --show-missing --fail-under 60 # TODO: 100 flake8 nodeenv.py tests setup.py [testenv:venv] envdir = venv-nodeenv commands = [testenv:docs] deps = {[testenv]deps} sphinx changedir = docs commands = sphinx-build -b html -d build/doctrees source build/html