Skip to content

Commit d9c8d1c

Browse files
committed
Remove deprecated flags args
The tools will no longer accept `--cflags`, `--cppflags`, or `--ldflags`. Instead, the ability to modify these flags is provided by the `--profile` argument. Documentation for the `--profile` argument may be found in docs/Toolchain_Profiles.md
1 parent c8c01f0 commit d9c8d1c

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

tools/options.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@
2222
from tools.targets import TARGET_NAMES
2323
from tools.utils import argparse_force_uppercase_type, \
2424
argparse_lowercase_hyphen_type, argparse_many, \
25-
argparse_filestring_type, args_error, argparse_profile_filestring_type
25+
argparse_filestring_type, args_error, argparse_profile_filestring_type,\
26+
argparse_deprecate
27+
28+
FLAGS_DEPRECATION_MESSAGE = "Please use the --profile argument instead.\n"\
29+
"Documentation may be found in "\
30+
"docs/Toolchain_Profiles.md"
2631

2732
def get_default_options_parser(add_clean=True, add_options=True,
2833
add_app_config=False):
@@ -59,14 +64,17 @@ def get_default_options_parser(add_clean=True, add_options=True,
5964
help="print Warnings, and Errors in color",
6065
action="store_true", default=False)
6166

62-
parser.add_argument("--cflags", default=[], action="append",
63-
help="Extra flags to provide to the C compiler")
67+
parser.add_argument("--cflags",
68+
type=argparse_deprecate(FLAGS_DEPRECATION_MESSAGE),
69+
help="Deprecated. " + FLAGS_DEPRECATION_MESSAGE)
6470

65-
parser.add_argument("--asmflags", default=[], action="append",
66-
help="Extra flags to provide to the assembler")
71+
parser.add_argument("--asmflags",
72+
type=argparse_deprecate(FLAGS_DEPRECATION_MESSAGE),
73+
help="Deprecated. " + FLAGS_DEPRECATION_MESSAGE)
6774

68-
parser.add_argument("--ldflags", default=[], action="append",
69-
help="Extra flags to provide to the linker")
75+
parser.add_argument("--ldflags",
76+
type=argparse_deprecate(FLAGS_DEPRECATION_MESSAGE),
77+
help="Deprecated. " + FLAGS_DEPRECATION_MESSAGE)
7078

7179
if add_clean:
7280
parser.add_argument("-c", "--clean", action="store_true", default=False,

tools/utils.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,13 @@ def parse_type(not_parent):
488488
return not_parent
489489
return parse_type
490490

491+
def argparse_deprecate(replacement_message):
492+
"""fail if argument is provided with deprecation warning"""
493+
def parse_type(_):
494+
"""The parser type"""
495+
raise argparse.ArgumentTypeError("Deprecated." + replacement_message)
496+
return parse_type
497+
491498
def print_large_string(large_string):
492499
""" Breaks a string up into smaller pieces before print them
493500

0 commit comments

Comments
 (0)