From 9efc37a3ad672d88f76f2c82289bbc479251e7d0 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 12 Jul 2015 20:13:05 +0200 Subject: [PATCH] Fix topic generation logic for different board targets --- Tools/px_generate_uorb_topic_headers.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Tools/px_generate_uorb_topic_headers.py b/Tools/px_generate_uorb_topic_headers.py index 92d7dc1ef1..221aa3ae38 100755 --- a/Tools/px_generate_uorb_topic_headers.py +++ b/Tools/px_generate_uorb_topic_headers.py @@ -149,14 +149,16 @@ def copy_changed(inputdir, outputdir, prefix=''): shutil.copy(fni, fno) print("{0}: new header file".format(f)) continue - # The file exists in inputdir and outputdir - # only copy if contents do not match - if not filecmp.cmp(fni, fno): - shutil.copy(fni, fno) - print("{0}: updated".format(f)) - continue - print("{0}: unchanged".format(f)) + if os.path.getmtime(fni) > os.path.getmtime(fno): + # The file exists in inputdir and outputdir + # only copy if contents do not match + if not filecmp.cmp(fni, fno): + shutil.copy(fni, fno) + print("{0}: updated".format(f)) + continue + + #print("{0}: unchanged".format(f)) def convert_dir_save(inputdir, outputdir, templatedir, temporarydir, prefix): @@ -165,11 +167,9 @@ def convert_dir_save(inputdir, outputdir, templatedir, temporarydir, prefix): Unchanged existing files are not overwritten. """ # Create new headers in temporary output directory - if (convert_dir(inputdir, temporarydir, templatedir)): - # Copy changed headers from temporary dir to output dir - copy_changed(temporarydir, outputdir, prefix) - else: - print('No changes.') + convert_dir(inputdir, temporarydir, templatedir) + # Copy changed headers from temporary dir to output dir + copy_changed(temporarydir, outputdir, prefix) if __name__ == "__main__": parser = argparse.ArgumentParser(