Avoid inconsistent Python lookup

When executing a Python script from within Python, rather than looking for
`python3` in /usr/local/bin and falling back to the script’s shebang line,
_always_ use the same Python that is executing the caller.

I don’t know why this script doesn’t just run `bitcoin_util_test.py`
directly (always using the shebang line), but I assume that is
intentional (but that should be documented). Otherwise, I’d prefer that
approach.
This commit is contained in:
Greg Pfeil 2022-11-14 06:37:51 -10:00
parent 14cce06163
commit c12fb6ad5b
1 changed files with 1 additions and 5 deletions

View File

@ -137,12 +137,8 @@ def ensure_no_dot_so_in_depends():
return exit_code == 0
def util_test():
python = []
if os.path.isfile('/usr/local/bin/python3'):
python = ['/usr/local/bin/python3']
return subprocess.call(
python + [repofile('src/test/bitcoin-util-test.py')],
[sys.executable, repofile('src/test/bitcoin-util-test.py')],
cwd=repofile('src'),
env={'PYTHONPATH': repofile('src/test'), 'srcdir': repofile('src')}
) == 0