From: Florent Kermarrec Date: Mon, 14 Apr 2014 15:19:53 +0000 (+0200) Subject: mibuild: force shell script generation to unix format (will be executed with cygwin... X-Git-Tag: 24jan2021_ls180~2099^2~363 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8c03cb049156a5f6b6519ca1d59b258141385fed;p=litex.git mibuild: force shell script generation to unix format (will be executed with cygwin's bash on windows) --- diff --git a/mibuild/altera_quartus.py b/mibuild/altera_quartus.py index d2265b08..36d76c37 100644 --- a/mibuild/altera_quartus.py +++ b/mibuild/altera_quartus.py @@ -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: diff --git a/mibuild/tools.py b/mibuild/tools.py index 1c2493e4..35efca74 100644 --- a/mibuild/tools.py +++ b/mibuild/tools.py @@ -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() diff --git a/mibuild/xilinx_ise.py b/mibuild/xilinx_ise.py index 8bab531a..8018a1fe 100644 --- a/mibuild/xilinx_ise.py +++ b/mibuild/xilinx_ise.py @@ -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: