MCPcopy Index your code
hub / github.com/nodejs/node / make_bin_override

Function make_bin_override

configure.py:2742–2775  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2740 o['variables']['node_section_ordering_info'] = ""
2741
2742def make_bin_override():
2743 if sys.platform == 'win32':
2744 raise Exception('make_bin_override should not be called on win32.')
2745 # If the system python is not the python we are running (which should be
2746 # python 3.10+), then create a directory with a symlink called `python` to our
2747 # sys.executable. This directory will be prefixed to the PATH, so that
2748 # other tools that shell out to `python` will use the appropriate python
2749
2750 which_python = shutil.which('python')
2751 if (which_python and
2752 os.path.realpath(which_python) == os.path.realpath(sys.executable)):
2753 return
2754
2755 bin_override = Path('out', 'tools', 'bin').resolve()
2756 try:
2757 bin_override.mkdir(parents=True)
2758 except OSError as e:
2759 if e.errno != errno.EEXIST:
2760 raise e
2761
2762 python_link = bin_override / 'python'
2763 try:
2764 python_link.unlink()
2765 except OSError as e:
2766 if e.errno != errno.ENOENT:
2767 raise e
2768 os.symlink(sys.executable, python_link)
2769
2770 # We need to set the environment right now so that when gyp (in run_gyp)
2771 # shells out, it finds the right python (specifically at
2772 # https://github.com/nodejs/node/blob/d82e107/deps/v8/gypfiles/toolchain.gypi#L43)
2773 os.environ['PATH'] = str(bin_override) + ':' + os.environ['PATH']
2774
2775 return bin_override
2776
2777output = {
2778 'variables': {},

Callers 1

configure.pyFile · 0.85

Calls 6

strFunction · 0.85
realpathMethod · 0.45
resolveMethod · 0.45
mkdirMethod · 0.45
unlinkMethod · 0.45
symlinkMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…