(env_dir, src_dir, node_src_dir, args)
| 703 | |
| 704 | |
| 705 | def build_node_from_src(env_dir, src_dir, node_src_dir, args): |
| 706 | env = {} |
| 707 | make_param_names = ['load-average', 'jobs'] |
| 708 | make_param_values = map( |
| 709 | lambda x: getattr(args, x.replace('-', '_')), |
| 710 | make_param_names) |
| 711 | make_opts = [ |
| 712 | '--{0}={1}'.format(name, value) |
| 713 | if len(value) > 0 else '--{0}'.format(name) |
| 714 | for name, value in zip(make_param_names, make_param_values) |
| 715 | if value is not None |
| 716 | ] |
| 717 | |
| 718 | if getattr(sys.version_info, 'major', sys.version_info[0]) > 2: |
| 719 | # Currently, the node.js build scripts are using python2.*, |
| 720 | # therefore we need to temporarily point python exec to the |
| 721 | # python 2.* version in this case. |
| 722 | python2_path = shutil.which('python2') |
| 723 | if not python2_path: |
| 724 | raise OSError( |
| 725 | 'Python >=3.0 virtualenv detected, but no python2 ' |
| 726 | 'command (required for building node.js) was found' |
| 727 | ) |
| 728 | logger.debug(' * Temporarily pointing python to %s', python2_path) |
| 729 | node_tmpbin_dir = join(src_dir, 'tmpbin') |
| 730 | node_tmpbin_link = join(node_tmpbin_dir, 'python') |
| 731 | mkdir(node_tmpbin_dir) |
| 732 | if not os.path.exists(node_tmpbin_link): |
| 733 | callit(['ln', '-s', python2_path, node_tmpbin_link]) |
| 734 | env['PATH'] = '{}:{}'.format(node_tmpbin_dir, |
| 735 | os.environ.get('PATH', '')) |
| 736 | |
| 737 | conf_cmd = [ |
| 738 | './configure', |
| 739 | '--prefix=%s' % _quote(env_dir) |
| 740 | ] |
| 741 | if args.without_ssl: |
| 742 | conf_cmd.append('--without-ssl') |
| 743 | if args.debug: |
| 744 | conf_cmd.append('--debug') |
| 745 | if args.profile: |
| 746 | conf_cmd.append('--profile') |
| 747 | |
| 748 | make_cmd = args.make_path |
| 749 | |
| 750 | callit(conf_cmd, args.verbose, True, node_src_dir, env) |
| 751 | logger.info('.', extra=dict(continued=True)) |
| 752 | callit([make_cmd] + make_opts, args.verbose, True, node_src_dir, env) |
| 753 | logger.info('.', extra=dict(continued=True)) |
| 754 | callit([make_cmd + ' install'], args.verbose, True, node_src_dir, env) |
| 755 | |
| 756 | |
| 757 | def install_node(env_dir, src_dir, args): |
no test coverage detected