diff --git a/git-version.py b/git-version.py index 1dee47591..0cec96c9f 100644 --- a/git-version.py +++ b/git-version.py @@ -50,8 +50,16 @@ fp.write('const char* grbl_version = \"' + grbl_version + '\";\n') fp.write('const char* git_info = \"' + git_info + '\";\n') -if not (os.path.exists(final) and filecmp.cmp(provisional, final)): +if not os.path.exists(final): + # No version.cpp so rename version.cxx to version.cpp + os.rename(provisional, final) +elif not filecmp.cmp(provisional, final): + # version.cxx differs from version.cpp so get rid of the + # old .cpp and rename .cxx to .cpp os.remove(final) os.rename(provisional, final) else: + # The existing version.cpp is the same as the new version.cxx + # so we can just leave the old version.cpp in place and get + # rid of version.cxx os.remove(provisional)