summaryrefslogtreecommitdiff
path: root/lib/python/qmk/cli/generate
diff options
context:
space:
mode:
authorNick Brassel <nick@tzarc.org>2022-02-04 07:36:02 +1100
committerGitHub <noreply@github.com>2022-02-04 07:36:02 +1100
commitdb43e450771f4eefe27821a88cc86df46c1006c1 (patch)
treebca051808d9aaacd969ea7bc94ac7ffaae1c0d99 /lib/python/qmk/cli/generate
parent57a78b68de4e8202655ab33f549f7b0349fbdf78 (diff)
Ensure `version.h` is recreated each build. (#16188)
Diffstat (limited to 'lib/python/qmk/cli/generate')
-rw-r--r--lib/python/qmk/cli/generate/version_h.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/python/qmk/cli/generate/version_h.py b/lib/python/qmk/cli/generate/version_h.py
index b8e52588c4..69341e36f0 100644
--- a/lib/python/qmk/cli/generate/version_h.py
+++ b/lib/python/qmk/cli/generate/version_h.py
@@ -20,6 +20,9 @@ def generate_version_h(cli):
version_h = create_version_h(cli.args.skip_git, cli.args.skip_all)
if cli.args.output:
+ cli.args.output.parent.mkdir(parents=True, exist_ok=True)
+ if cli.args.output.exists():
+ cli.args.output.replace(cli.args.output.parent / (cli.args.output.name + '.bak'))
cli.args.output.write_text(version_h)
if not cli.args.quiet: