From a92badca32381b97a8743e7097d6ff90208dfd48 Mon Sep 17 00:00:00 2001 From: Elias Kunnas Date: Sun, 24 Mar 2013 10:38:43 +0200 Subject: [PATCH] Skip stand-alone npm installation by default Node.js has included npm for a while now and it makes little sense to install it separately by default. Hence, --without-npm has been changed to --with-npm along with the related logic. Associated parameter 'sanity checks' that don't make sense anymore have been dropped as well. --- nodeenv.py | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/nodeenv.py b/nodeenv.py index 3213d1f..3aab76e 100644 --- a/nodeenv.py +++ b/nodeenv.py @@ -89,8 +89,7 @@ def parse_args(): parser.add_option('-r', '--requirement', dest='requirements', default='', metavar='FILENAME', - help='Install all the packages listed in the given requirements file. ' - 'Not compatible with --without-npm option.') + 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') @@ -111,9 +110,10 @@ def parse_args(): action='store_true', default=False, help='Enable profiling for node.js') - parser.add_option('--without-npm', dest='without_npm', + parser.add_option('--with-npm', dest='with_npm', action='store_true', default=False, - help='Build without installing npm into the new virtual environment (works for node.js < 0.6.3)') + 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='latest', @@ -147,15 +147,6 @@ def parse_args(): parser.print_help() sys.exit(2) - if options.requirements and options.without_npm: - print('These options are not compatible: --requirements, --without-npm') - parser.print_help() - sys.exit(2) - - if options.node < "0.6.3" and options.without_npm: - print("Option --without-npm works only for node.js < 0.6.3. See --help.") - sys.exit(2) - return options, args @@ -416,7 +407,7 @@ def create_environment(env_dir, opt): # before npm install, npm use activate # for install install_activate(env_dir, opt) - if opt.node < "0.6.3" or not opt.without_npm: + if opt.node < "0.6.3" or opt.with_npm: install_npm(env_dir, src_dir, opt) if opt.requirements: install_packages(env_dir, opt)