xilinx_ise: do not attempt to source settings file on Windows

This commit is contained in:
Sebastien Bourdeauducq 2013-04-16 22:55:24 +02:00
parent 31b1960188
commit 29eaf068f3
1 changed files with 11 additions and 8 deletions

View File

@ -1,4 +1,4 @@
import os, struct, subprocess
import os, struct, subprocess, sys
from decimal import Decimal
from migen.fhdl.structure import *
@ -85,16 +85,19 @@ def _build_files(device, sources, named_sc, named_pc, build_name):
-p %s""" % (build_name, build_name, device)
tools.write_to_file(build_name + ".xst", xst_contents)
def _run_ise(build_name, ise_path, source):
def is_valid_version(v):
def _is_valid_version(path, v):
try:
Decimal(v)
return os.path.isdir(os.path.join(ise_path, v))
return os.path.isdir(os.path.join(path, v))
except:
return False
def _run_ise(build_name, ise_path, source):
if sys.platform == "win32" or sys.platform == "cygwin":
source = False
build_script_contents = "# Autogenerated by mibuild\nset -e\n"
if source:
vers = [ver for ver in os.listdir(ise_path) if is_valid_version(ver)]
vers = [ver for ver in os.listdir(ise_path) if _is_valid_version(ise_path, ver)]
tools_version = max(vers)
bits = struct.calcsize("P")*8
xilinx_settings_file = '%s/%s/ISE_DS/settings%d.sh' % (ise_path, tools_version, bits)