From 25a9d345d9e5599759a7247fb3b6d92ffb46ef67 Mon Sep 17 00:00:00 2001 From: Robert Jordens Date: Fri, 15 Jul 2016 15:31:27 +0200 Subject: [PATCH] artiq_flash: fix openocd scripts path (#513) --- artiq/frontend/artiq_flash.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/artiq/frontend/artiq_flash.py b/artiq/frontend/artiq_flash.py index 252f1cba0..43fae49ba 100755 --- a/artiq/frontend/artiq_flash.py +++ b/artiq/frontend/artiq_flash.py @@ -5,7 +5,7 @@ import argparse import os import subprocess import tempfile -import site +import shutil from artiq import __artiq_dir__ as artiq_dir from artiq.frontend.bit2bin import bit2bin @@ -77,11 +77,12 @@ def main(): raise SystemExit("Binaries directory '{}' does not exist" .format(opts.dir)) - conda_prefix_path = site.getsitepackages()[0] + scripts_path = ["share", "openocd", "scripts"] if os.name == "nt": - scripts_path = os.path.join(conda_prefix_path, "Library", "share", "openocd", "scripts") - else: - scripts_path = os.path.join(conda_prefix_path, "share", "openocd", "scripts") + scripts_path.insert(0, "Library") + scripts_path = os.path.abspath(os.path.join( + os.path.dirname(shutil.which("openocd")), + "..", *scripts_path)) conv = False