Skip to content

Bug in scripts/file_utils.py / move_modified_files routine #744

@climbfuji

Description

@climbfuji

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.

Metadata

Metadata

Assignees

Labels

capgenbugs, requests, etc. that involve ccpp_capgen

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions