forked from M-Labs/artiq
artiq_flash: improve openocd not found error message
This commit is contained in:
parent
67d474e6cf
commit
935e18c1be
|
@ -79,13 +79,18 @@ Prerequisites:
|
||||||
help="actions to perform, default: flash everything")
|
help="actions to perform, default: flash everything")
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
def which_openocd():
|
||||||
|
openocd = shutil.which("openocd")
|
||||||
|
if not openocd:
|
||||||
|
raise FileNotFoundError("OpenOCD is required but was not found in PATH. Is it installed?")
|
||||||
|
return openocd
|
||||||
|
|
||||||
def scripts_path():
|
def scripts_path():
|
||||||
p = ["share", "openocd", "scripts"]
|
p = ["share", "openocd", "scripts"]
|
||||||
if os.name == "nt":
|
if os.name == "nt":
|
||||||
p.insert(0, "Library")
|
p.insert(0, "Library")
|
||||||
p = os.path.abspath(os.path.join(
|
p = os.path.abspath(os.path.join(
|
||||||
os.path.dirname(os.path.realpath(shutil.which("openocd"))),
|
os.path.dirname(os.path.realpath(which_openocd())),
|
||||||
"..", *p))
|
"..", *p))
|
||||||
return p
|
return p
|
||||||
|
|
||||||
|
@ -93,7 +98,7 @@ def scripts_path():
|
||||||
def proxy_path():
|
def proxy_path():
|
||||||
p = ["share", "bscan-spi-bitstreams"]
|
p = ["share", "bscan-spi-bitstreams"]
|
||||||
p = os.path.abspath(os.path.join(
|
p = os.path.abspath(os.path.join(
|
||||||
os.path.dirname(os.path.realpath(shutil.which("openocd"))),
|
os.path.dirname(os.path.realpath(which_openocd())),
|
||||||
"..", *p))
|
"..", *p))
|
||||||
return p
|
return p
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue