diff options
| author | Joel Challis <git@zvecr.com> | 2021-02-28 20:19:07 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-28 20:19:07 +0000 |
| commit | 59c7deab0931207016315636ae1ef74c2c54dd18 (patch) | |
| tree | 4ebcb8c97c2bee8c3ea6ee3496851184f821729f /lib | |
| parent | 1a7f2c8f453d4da6ed8622e52d5b788bc6dad480 (diff) | |
| download | qmk_firmware-59c7deab0931207016315636ae1ef74c2c54dd18.tar.gz qmk_firmware-59c7deab0931207016315636ae1ef74c2c54dd18.zip | |
Fix generated file output while target exists (#12062)
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/python/qmk/cli/c2json.py | 2 | ||||
| -rwxr-xr-x | lib/python/qmk/cli/generate/config_h.py | 4 | ||||
| -rwxr-xr-x | lib/python/qmk/cli/generate/layouts.py | 4 | ||||
| -rw-r--r-- | lib/python/qmk/cli/generate/rgb_breathe_table.py | 2 | ||||
| -rwxr-xr-x | lib/python/qmk/cli/generate/rules_mk.py | 4 | ||||
| -rwxr-xr-x | lib/python/qmk/cli/json2c.py | 2 |
6 files changed, 9 insertions, 9 deletions
diff --git a/lib/python/qmk/cli/c2json.py b/lib/python/qmk/cli/c2json.py index 8f9d8dc38..b9d55ebdb 100644 --- a/lib/python/qmk/cli/c2json.py +++ b/lib/python/qmk/cli/c2json.py | |||
| @@ -47,7 +47,7 @@ def c2json(cli): | |||
| 47 | if cli.args.output: | 47 | if cli.args.output: |
| 48 | cli.args.output.parent.mkdir(parents=True, exist_ok=True) | 48 | cli.args.output.parent.mkdir(parents=True, exist_ok=True) |
| 49 | if cli.args.output.exists(): | 49 | if cli.args.output.exists(): |
| 50 | cli.args.output.replace(cli.args.output.name + '.bak') | 50 | cli.args.output.replace(cli.args.output.parent / (cli.args.output.name + '.bak')) |
| 51 | cli.args.output.write_text(json.dumps(keymap_json, cls=InfoJSONEncoder)) | 51 | cli.args.output.write_text(json.dumps(keymap_json, cls=InfoJSONEncoder)) |
| 52 | 52 | ||
| 53 | if not cli.args.quiet: | 53 | if not cli.args.quiet: |
diff --git a/lib/python/qmk/cli/generate/config_h.py b/lib/python/qmk/cli/generate/config_h.py index 7ddad745d..e6d49ea4d 100755 --- a/lib/python/qmk/cli/generate/config_h.py +++ b/lib/python/qmk/cli/generate/config_h.py | |||
| @@ -82,7 +82,7 @@ def generate_config_h(cli): | |||
| 82 | """ | 82 | """ |
| 83 | # Determine our keyboard(s) | 83 | # Determine our keyboard(s) |
| 84 | if not cli.config.generate_config_h.keyboard: | 84 | if not cli.config.generate_config_h.keyboard: |
| 85 | cli.log.error('Missing paramater: --keyboard') | 85 | cli.log.error('Missing parameter: --keyboard') |
| 86 | cli.subcommands['info'].print_help() | 86 | cli.subcommands['info'].print_help() |
| 87 | return False | 87 | return False |
| 88 | 88 | ||
| @@ -142,7 +142,7 @@ def generate_config_h(cli): | |||
| 142 | if cli.args.output: | 142 | if cli.args.output: |
| 143 | cli.args.output.parent.mkdir(parents=True, exist_ok=True) | 143 | cli.args.output.parent.mkdir(parents=True, exist_ok=True) |
| 144 | if cli.args.output.exists(): | 144 | if cli.args.output.exists(): |
| 145 | cli.args.output.replace(cli.args.output.name + '.bak') | 145 | cli.args.output.replace(cli.args.output.parent / (cli.args.output.name + '.bak')) |
| 146 | cli.args.output.write_text(config_h) | 146 | cli.args.output.write_text(config_h) |
| 147 | 147 | ||
| 148 | if not cli.args.quiet: | 148 | if not cli.args.quiet: |
diff --git a/lib/python/qmk/cli/generate/layouts.py b/lib/python/qmk/cli/generate/layouts.py index 15b289522..a738edfe6 100755 --- a/lib/python/qmk/cli/generate/layouts.py +++ b/lib/python/qmk/cli/generate/layouts.py | |||
| @@ -25,7 +25,7 @@ def generate_layouts(cli): | |||
| 25 | """ | 25 | """ |
| 26 | # Determine our keyboard(s) | 26 | # Determine our keyboard(s) |
| 27 | if not cli.config.generate_layouts.keyboard: | 27 | if not cli.config.generate_layouts.keyboard: |
| 28 | cli.log.error('Missing paramater: --keyboard') | 28 | cli.log.error('Missing parameter: --keyboard') |
| 29 | cli.subcommands['info'].print_help() | 29 | cli.subcommands['info'].print_help() |
| 30 | return False | 30 | return False |
| 31 | 31 | ||
| @@ -92,7 +92,7 @@ def generate_layouts(cli): | |||
| 92 | if cli.args.output: | 92 | if cli.args.output: |
| 93 | cli.args.output.parent.mkdir(parents=True, exist_ok=True) | 93 | cli.args.output.parent.mkdir(parents=True, exist_ok=True) |
| 94 | if cli.args.output.exists(): | 94 | if cli.args.output.exists(): |
| 95 | cli.args.output.replace(cli.args.output.name + '.bak') | 95 | cli.args.output.replace(cli.args.output.parent / (cli.args.output.name + '.bak')) |
| 96 | cli.args.output.write_text(layouts_h) | 96 | cli.args.output.write_text(layouts_h) |
| 97 | 97 | ||
| 98 | if not cli.args.quiet: | 98 | if not cli.args.quiet: |
diff --git a/lib/python/qmk/cli/generate/rgb_breathe_table.py b/lib/python/qmk/cli/generate/rgb_breathe_table.py index e1c5423ee..7382abd68 100644 --- a/lib/python/qmk/cli/generate/rgb_breathe_table.py +++ b/lib/python/qmk/cli/generate/rgb_breathe_table.py | |||
| @@ -70,7 +70,7 @@ static const int table_scale = 256 / sizeof(rgblight_effect_breathe_table); | |||
| 70 | if cli.args.output: | 70 | if cli.args.output: |
| 71 | cli.args.output.parent.mkdir(parents=True, exist_ok=True) | 71 | cli.args.output.parent.mkdir(parents=True, exist_ok=True) |
| 72 | if cli.args.output.exists(): | 72 | if cli.args.output.exists(): |
| 73 | cli.args.output.replace(cli.args.output.name + '.bak') | 73 | cli.args.output.replace(cli.args.output.parent / (cli.args.output.name + '.bak')) |
| 74 | cli.args.output.write_text(table_template) | 74 | cli.args.output.write_text(table_template) |
| 75 | 75 | ||
| 76 | if not cli.args.quiet: | 76 | if not cli.args.quiet: |
diff --git a/lib/python/qmk/cli/generate/rules_mk.py b/lib/python/qmk/cli/generate/rules_mk.py index af740f341..c21ab5090 100755 --- a/lib/python/qmk/cli/generate/rules_mk.py +++ b/lib/python/qmk/cli/generate/rules_mk.py | |||
| @@ -44,7 +44,7 @@ def generate_rules_mk(cli): | |||
| 44 | """Generates a rules.mk file from info.json. | 44 | """Generates a rules.mk file from info.json. |
| 45 | """ | 45 | """ |
| 46 | if not cli.config.generate_rules_mk.keyboard: | 46 | if not cli.config.generate_rules_mk.keyboard: |
| 47 | cli.log.error('Missing paramater: --keyboard') | 47 | cli.log.error('Missing parameter: --keyboard') |
| 48 | cli.subcommands['info'].print_help() | 48 | cli.subcommands['info'].print_help() |
| 49 | return False | 49 | return False |
| 50 | 50 | ||
| @@ -79,7 +79,7 @@ def generate_rules_mk(cli): | |||
| 79 | if cli.args.output: | 79 | if cli.args.output: |
| 80 | cli.args.output.parent.mkdir(parents=True, exist_ok=True) | 80 | cli.args.output.parent.mkdir(parents=True, exist_ok=True) |
| 81 | if cli.args.output.exists(): | 81 | if cli.args.output.exists(): |
| 82 | cli.args.output.replace(cli.args.output.name + '.bak') | 82 | cli.args.output.replace(cli.args.output.parent / (cli.args.output.name + '.bak')) |
| 83 | cli.args.output.write_text(rules_mk) | 83 | cli.args.output.write_text(rules_mk) |
| 84 | 84 | ||
| 85 | if cli.args.quiet: | 85 | if cli.args.quiet: |
diff --git a/lib/python/qmk/cli/json2c.py b/lib/python/qmk/cli/json2c.py index e7babc0e4..5a2fb96c7 100755 --- a/lib/python/qmk/cli/json2c.py +++ b/lib/python/qmk/cli/json2c.py | |||
| @@ -37,7 +37,7 @@ def json2c(cli): | |||
| 37 | if cli.args.output: | 37 | if cli.args.output: |
| 38 | cli.args.output.parent.mkdir(parents=True, exist_ok=True) | 38 | cli.args.output.parent.mkdir(parents=True, exist_ok=True) |
| 39 | if cli.args.output.exists(): | 39 | if cli.args.output.exists(): |
| 40 | cli.args.output.replace(cli.args.output.name + '.bak') | 40 | cli.args.output.replace(cli.args.output.parent / (cli.args.output.name + '.bak')) |
| 41 | cli.args.output.write_text(keymap_c) | 41 | cli.args.output.write_text(keymap_c) |
| 42 | 42 | ||
| 43 | if not cli.args.quiet: | 43 | if not cli.args.quiet: |
