(tools_to_activate, system=False, user=False)
| 2695 | # Looks at the current PATH and adds and removes entries so that the PATH reflects |
| 2696 | # the set of given active tools. |
| 2697 | def adjusted_path(tools_to_activate, system=False, user=False): |
| 2698 | # These directories should be added to PATH |
| 2699 | path_add = get_required_path(tools_to_activate) |
| 2700 | # These already exist. |
| 2701 | if WINDOWS and not MSYS: |
| 2702 | existing_path = win_get_environment_variable('PATH', system=system, user=user, fallback=True).split(ENVPATH_SEPARATOR) |
| 2703 | else: |
| 2704 | existing_path = os.environ['PATH'].split(ENVPATH_SEPARATOR) |
| 2705 | |
| 2706 | existing_emsdk_tools = [] |
| 2707 | existing_nonemsdk_path = [] |
| 2708 | for entry in existing_path: |
| 2709 | if to_unix_path(entry).startswith(EMSDK_PATH): |
| 2710 | existing_emsdk_tools.append(entry) |
| 2711 | else: |
| 2712 | existing_nonemsdk_path.append(entry) |
| 2713 | |
| 2714 | new_emsdk_tools = [] |
| 2715 | kept_emsdk_tools = [] |
| 2716 | for entry in path_add: |
| 2717 | if not normalized_contains(existing_emsdk_tools, entry): |
| 2718 | new_emsdk_tools.append(entry) |
| 2719 | else: |
| 2720 | kept_emsdk_tools.append(entry) |
| 2721 | |
| 2722 | whole_path = unique_items(new_emsdk_tools + kept_emsdk_tools + existing_nonemsdk_path) |
| 2723 | |
| 2724 | if MSYS: |
| 2725 | # XXX Hack: If running native Windows Python in MSYS prompt where PATH |
| 2726 | # entries look like "/c/Windows/System32", os.environ['PATH'] |
| 2727 | # in Python will transform to show them as "C:\\Windows\\System32", so need |
| 2728 | # to reconvert path delimiter back to forward slashes. |
| 2729 | whole_path = [to_msys_path(p) for p in whole_path] |
| 2730 | new_emsdk_tools = [to_msys_path(p) for p in new_emsdk_tools] |
| 2731 | |
| 2732 | separator = ':' if MSYS else ENVPATH_SEPARATOR |
| 2733 | return (separator.join(whole_path), new_emsdk_tools) |
| 2734 | |
| 2735 | |
| 2736 | def get_env_vars_to_add(tools_to_activate, system, user): |
no test coverage detected