forked from M-Labs/artiq
artiq_flash: cleanup openocd handling, do not follow symlinks
Not following symlinks allows files to be added to OpenOCD via nixpkgs buildEnv.
This commit is contained in:
parent
30e5e06a33
commit
53a98acfe4
|
@ -79,28 +79,22 @@ Prerequisites:
|
||||||
help="actions to perform, default: flash everything")
|
help="actions to perform, default: flash everything")
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def which_openocd():
|
def openocd_root():
|
||||||
openocd = shutil.which("openocd")
|
openocd = shutil.which("openocd")
|
||||||
if not openocd:
|
if not openocd:
|
||||||
raise FileNotFoundError("OpenOCD is required but was not found in PATH. Is it installed?")
|
raise FileNotFoundError("OpenOCD is required but was not found in PATH. Is it installed?")
|
||||||
return openocd
|
return os.path.dirname(os.path.dirname(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(
|
return os.path.abspath(os.path.join(openocd_root(), *p))
|
||||||
os.path.dirname(os.path.realpath(which_openocd())),
|
|
||||||
"..", *p))
|
|
||||||
return p
|
|
||||||
|
|
||||||
|
|
||||||
def proxy_path():
|
def proxy_path():
|
||||||
p = ["share", "bscan-spi-bitstreams"]
|
return os.path.abspath(os.path.join(openocd_root(), "share", "bscan-spi-bitstreams"))
|
||||||
p = os.path.abspath(os.path.join(
|
|
||||||
os.path.dirname(os.path.realpath(which_openocd())),
|
|
||||||
"..", *p))
|
|
||||||
return p
|
|
||||||
|
|
||||||
|
|
||||||
def find_proxy_bitfile(filename):
|
def find_proxy_bitfile(filename):
|
||||||
|
|
Loading…
Reference in New Issue