MCPcopy Index your code
hub / github.com/ekalinin/nodeenv / create_environment

Function create_environment

nodeenv.py:990–1020  ·  view source on GitHub ↗

Creates a new environment in ``env_dir``.

(env_dir, args)

Source from the content-addressed store, hash-verified

988
989
990def create_environment(env_dir, args):
991 """
992 Creates a new environment in ``env_dir``.
993 """
994 if os.path.exists(env_dir) and not args.python_virtualenv:
995 logger.info(' * Environment already exists: %s', env_dir)
996 if not args.force:
997 sys.exit(2)
998 src_dir = to_utf8(abspath(join(env_dir, 'src')))
999 mkdir(src_dir)
1000
1001 if args.node != "system":
1002 install_node(env_dir, src_dir, args)
1003 else:
1004 mkdir(join(env_dir, 'bin'))
1005 mkdir(join(env_dir, 'lib'))
1006 mkdir(join(env_dir, 'lib', 'node_modules'))
1007 # activate script install must be
1008 # before npm install, npm use activate
1009 # for install
1010 install_activate(env_dir, args)
1011 if node_version_from_args(args) < (0, 6, 3) or args.with_npm:
1012 instfunc = install_npm_win if is_WIN or is_CYGWIN else install_npm
1013 instfunc(env_dir, src_dir, args)
1014 if args.requirements:
1015 install_packages(env_dir, args)
1016 if args.python_virtualenv:
1017 set_predeactivate_hook(env_dir)
1018 # Cleanup
1019 if args.clean_src:
1020 shutil.rmtree(src_dir)
1021
1022
1023def _get_versions_json():

Callers 1

mainFunction · 0.85

Calls 7

to_utf8Function · 0.85
mkdirFunction · 0.85
install_nodeFunction · 0.85
install_activateFunction · 0.85
node_version_from_argsFunction · 0.85
install_packagesFunction · 0.85
set_predeactivate_hookFunction · 0.85

Tested by

no test coverage detected