build/ise: make method default args consistent across platforms
authorSebastien Bourdeauducq <sb@m-labs.hk>
Wed, 4 Nov 2015 04:55:52 +0000 (12:55 +0800)
committerSebastien Bourdeauducq <sb@m-labs.hk>
Wed, 4 Nov 2015 04:56:27 +0000 (12:56 +0800)
migen/build/xilinx/ise.py

index 0d0709cdacf4237c7e097a2ffa217588b94cfddb..eb64b37da809b9a3e1ee22de1527ed6a0d2bb35a 100644 (file)
@@ -122,19 +122,6 @@ bitgen {bitgen_opt} {build_name}.ncd {build_name}.bit
         raise OSError("Subprocess failed")
 
 
-def _default_ise_path():
-    if sys.platform == "win32":
-        return "C:\\Xilinx"
-    elif sys.platform == "cygwin":
-        return "/cygdrive/c/Xilinx"
-    else:
-        return "/opt/Xilinx"
-
-
-def _default_source():
-    return sys.platform != "win32"
-
-
 class XilinxISEToolchain:
     def __init__(self):
         self.xst_opt = """-ifmt MIXED
@@ -148,13 +135,21 @@ class XilinxISEToolchain:
         self.ise_commands = ""
 
     def build(self, platform, fragment, build_dir="build", build_name="top",
-            ise_path=_default_ise_path(), source=_default_source(), run=True, mode="xst"):
+            ise_path=None, source=None, run=True, mode="xst"):
         if not isinstance(fragment, _Fragment):
             fragment = fragment.get_fragment()
-        platform.finalize(fragment)
+        if ise_path is None:
+            if sys.platform == "win32":
+                ise_path = "C:\\Xilinx"
+            elif sys.platform == "cygwin":
+                ise_path = "/cygdrive/c/Xilinx"
+            else:
+                ise_path = "/opt/Xilinx"
+        if source is None:
+            source = sys.platform != "win32"
 
+        platform.finalize(fragment)
         ngdbuild_opt = self.ngdbuild_opt
-
         vns = None
 
         tools.mkdir_noerror(build_dir)