From a933b13d25433b5d434bf2aad30c9c39b89389ac Mon Sep 17 00:00:00 2001 From: seleznevae Date: Sun, 18 Nov 2018 00:04:46 +0300 Subject: [PATCH] [A] Added check for amalgamation script has been run --- .travis.yml | 7 +++++++ amalgamate.py | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1d11860..1964902 100644 --- a/.travis.yml +++ b/.travis.yml @@ -87,6 +87,11 @@ matrix: script: + # Check library file was generated + - python amalgamate.py -o dummy.c + - diff dummy.c lib/fort.c + - rm dummy.c + # make sure CC is correctly set - if [[ "${FORT_C_COMPILER}" != "" ]]; then @@ -186,3 +191,5 @@ script: + + diff --git a/amalgamate.py b/amalgamate.py index 552052f..a310b2a 100644 --- a/amalgamate.py +++ b/amalgamate.py @@ -1,5 +1,6 @@ import os +import sys def comment_line(line): return "/* {} */ /* Commented by amalgamation script */".format(line) @@ -84,7 +85,10 @@ def is_c_source_file(file): def main(): config = {} - config["output_file"] = "./lib/fort.c" + if len(sys.argv) >= 3 and sys.argv[1] == "-o": + config["output_file"] = sys.argv[2] + else: + config["output_file"] = "./lib/fort.c" config["src_dir"] = "./src" all_files = os.listdir(config["src_dir"]) config["src_files"] = filter(is_c_source_file, all_files)