xilinx_ise: do not attempt to source settings file on Windows
authorSebastien Bourdeauducq <sebastien@milkymist.org>
Tue, 16 Apr 2013 20:55:24 +0000 (22:55 +0200)
committerSebastien Bourdeauducq <sebastien@milkymist.org>
Tue, 16 Apr 2013 20:55:24 +0000 (22:55 +0200)
mibuild/xilinx_ise.py

index 0d7a663bec1a7900a8523018ae32a62c09ade4f4..fa1eb1b3240c2e028e1c34563a35351cc2bd4dfd 100644 (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 _is_valid_version(path, v):
+       try: 
+               Decimal(v)
+               return os.path.isdir(os.path.join(path, v))
+       except:
+               return False
+
 def _run_ise(build_name, ise_path, source):
-       def is_valid_version(v):
-               try: 
-                       Decimal(v)
-                       return os.path.isdir(os.path.join(ise_path, v))
-               except:
-                       return False
+       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)