mibuild: force shell script generation to unix format (will be executed with cygwin...
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Mon, 14 Apr 2014 15:19:53 +0000 (17:19 +0200)
committerSebastien Bourdeauducq <sb@m-labs.hk>
Thu, 17 Apr 2014 17:43:56 +0000 (19:43 +0200)
mibuild/altera_quartus.py
mibuild/tools.py
mibuild/xilinx_ise.py

index d2265b086e1df890383e0b90263145045ab3c4ff..36d76c373123a4a120aebc856d1e075d9abff0e2 100644 (file)
@@ -73,7 +73,7 @@ quartus_sta {build_name}.qpf
 
 """.format(build_name=build_name)
        build_script_file = "build_" + build_name + ".sh"
-       tools.write_to_file(build_script_file, build_script_contents)
+       tools.write_to_file(build_script_file, build_script_contents, force_unix=True)
 
        r = subprocess.call(["bash", build_script_file])
        if r != 0:
index 1c2493e4e5744a4a09fcbeba6c8968d6b3d5904c..35efca74b8275f4fddf1a94011dae3d74eb50e56 100644 (file)
@@ -14,7 +14,10 @@ def language_by_filename(name):
                return "vhdl"
        return None
 
-def write_to_file(filename, contents):
-       f = open(filename, "w")
+def write_to_file(filename, contents, force_unix=False):
+       newline = None
+       if force_unix:
+               newline = "\n"
+       f = open(filename, "w", newline=newline)
        f.write(contents)
        f.close()
index 8bab531a0be6eecdcb5015fb5f60356a8333e1db..8018a1fe2d85da2a0ff2904c602b7e5e819d14e3 100644 (file)
@@ -157,7 +157,7 @@ bitgen {bitgen_opt} {build_name}.ncd {build_name}.bit
                        par_opt=par_opt, map_opt=map_opt)
        build_script_contents += ise_commands.format(build_name=build_name)
        build_script_file = "build_" + build_name + ".sh"
-       tools.write_to_file(build_script_file, build_script_contents)
+       tools.write_to_file(build_script_file, build_script_contents, force_unix=True)
 
        r = subprocess.call(["bash", build_script_file])
        if r != 0: