Skip to content

Remove deprecated flags args #3385

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 15, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions tools/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@
from tools.targets import TARGET_NAMES
from tools.utils import argparse_force_uppercase_type, \
argparse_lowercase_hyphen_type, argparse_many, \
argparse_filestring_type, args_error, argparse_profile_filestring_type
argparse_filestring_type, args_error, argparse_profile_filestring_type,\
argparse_deprecate

FLAGS_DEPRECATION_MESSAGE = "Please use the --profile argument instead.\n"\
"Documentation may be found in "\
"docs/Toolchain_Profiles.md"

def get_default_options_parser(add_clean=True, add_options=True,
add_app_config=False):
Expand Down Expand Up @@ -59,14 +64,17 @@ def get_default_options_parser(add_clean=True, add_options=True,
help="print Warnings, and Errors in color",
action="store_true", default=False)

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

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

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

if add_clean:
parser.add_argument("-c", "--clean", action="store_true", default=False,
Expand Down
7 changes: 7 additions & 0 deletions tools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,13 @@ def parse_type(not_parent):
return not_parent
return parse_type

def argparse_deprecate(replacement_message):
"""fail if argument is provided with deprecation warning"""
def parse_type(_):
"""The parser type"""
raise argparse.ArgumentTypeError("Deprecated." + replacement_message)
return parse_type

def print_large_string(large_string):
""" Breaks a string up into smaller pieces before print them

Expand Down