mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
24a6642b6f
excludes: - d6ef3543ae16847d5a91fa9271acee9bd2164b32
23 lines
649 B
Python
Executable File
23 lines
649 B
Python
Executable File
#!/usr/bin/env python3
|
|
# Copyright (c) 2021 The Bitcoin Core developers
|
|
# Distributed under the MIT software license, see the accompanying
|
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
'''
|
|
Common utility functions
|
|
'''
|
|
import shutil
|
|
import sys
|
|
import os
|
|
from typing import List
|
|
|
|
|
|
def determine_wellknown_cmd(envvar, progname) -> List[str]:
|
|
maybe_env = os.getenv(envvar)
|
|
maybe_which = shutil.which(progname)
|
|
if maybe_env:
|
|
return maybe_env.split(' ') # Well-known vars are often meant to be word-split
|
|
elif maybe_which:
|
|
return [ maybe_which ]
|
|
else:
|
|
sys.exit(f"{progname} not found")
|