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

Function install_packages

nodeenv.py:878–902  ·  view source on GitHub ↗

Install node.js packages via npm

(env_dir, args)

Source from the content-addressed store, hash-verified

876
877
878def install_packages(env_dir, args):
879 """
880 Install node.js packages via npm
881 """
882 logger.info(' * Install node.js packages ... ',
883 extra=dict(continued=True))
884 packages = [package.strip() for package in
885 open(args.requirements).readlines()]
886 activate_path = join(env_dir, 'bin', 'activate')
887 real_npm_ver = args.npm if args.npm.count(".") == 2 else args.npm + ".0"
888 if args.npm == "latest" or real_npm_ver >= "1.0.0":
889 cmd = '. ' + _quote(activate_path) + \
890 ' && npm install -g %(pack)s'
891 else:
892 cmd = '. ' + _quote(activate_path) + \
893 ' && npm install %(pack)s' + \
894 ' && npm activate %(pack)s'
895
896 for package in packages:
897 if not package:
898 continue
899 callit(cmd=[
900 cmd % {"pack": package}], show_stdout=args.verbose, in_shell=True)
901
902 logger.info('done.')
903
904
905def install_activate(env_dir, args):

Callers 2

create_environmentFunction · 0.85
mainFunction · 0.85

Calls 1

callitFunction · 0.85

Tested by

no test coverage detected