Description
ccpp_capgen.py writes output files (caps, etc) to a temporary directory if the output root already exists. Then, it compares the files and moves (or, better, is supposed to move) them if they are different. This is to prevent unnecessary recompiling when using build tools like CMake.
However, the logic is reversed here:
|
fmove = filecmp.cmp(src_path, dest_path, shallow=False) |
Python's filecmp.cmp returns false if the files differ, i.e. when fmove should be true. The correct code is therefore
fmove = not filecmp.cmp(src_path, dest_path, shallow=False)
(note the not)
To reproduce
I found this when I was adding Capgen to NEPTUNE. Rerunning the ccpp_capgen.py command with different --kind-type flags resulted in no changes to the ccpp_kinds.F90 file.
Description
ccpp_capgen.pywrites output files (caps, etc) to a temporary directory if the output root already exists. Then, it compares the files and moves (or, better, is supposed to move) them if they are different. This is to prevent unnecessary recompiling when using build tools like CMake.However, the logic is reversed here:
ccpp-framework/scripts/file_utils.py
Line 289 in b0f9673
Python's
filecmp.cmpreturnsfalseif the files differ, i.e. whenfmoveshould betrue. The correct code is therefore(note the
not)To reproduce
I found this when I was adding Capgen to NEPTUNE. Rerunning the
ccpp_capgen.pycommand with different--kind-typeflags resulted in no changes to theccpp_kinds.F90file.