xilinx/programmer: fix programmer

This commit is contained in:
Florent Kermarrec 2018-05-01 00:44:13 +02:00
parent c001b8eaf6
commit 39ffa532b0
1 changed files with 12 additions and 1 deletions

View File

@ -112,7 +112,18 @@ def _run_vivado(path, ver, cmds):
if sys.platform == "win32" or sys.platform == "cygwin":
vivado_cmd = "vivado -mode tcl"
else:
settings = common.settings(path, "", ver, first="name")
# For backwards compatibility with ISE paths, also
# look for a version in a subdirectory named "Vivado"
# under the current directory.
paths_to_try = [path, os.path.join(path, "Vivado")]
for p in paths_to_try:
try:
settings = common.settings(p, ver)
except OSError:
continue
break
else:
raise OSError("Unable to locate Vivado directory or settings.")
vivado_cmd = "bash -c \"source " + settings + "&& vivado -mode tcl\""
with subprocess.Popen(vivado_cmd, stdin=subprocess.PIPE, shell=True) as process:
process.stdin.write(cmds.encode("ASCII"))