Skip to content

Added warning for arguments containing carriage returns. This happens… #1712

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 2 commits into from
Feb 18, 2019
Merged
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
8 changes: 8 additions & 0 deletions pythonforandroid/toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ class ToolchainCL(object):
def __init__(self):

argv = sys.argv
self.warn_on_carriage_return_args(argv)
# Buildozer used to pass these arguments in a now-invalid order
# If that happens, apply this fix
# This fix will be removed once a fixed buildozer is released
Expand Down Expand Up @@ -575,6 +576,13 @@ def add_parser(subparsers, *args, **kwargs):
# Each subparser corresponds to a method
getattr(self, args.subparser_name.replace('-', '_'))(args)

@staticmethod
def warn_on_carriage_return_args(args):
for check_arg in args:
if '\r' in check_arg:
warning("Argument '{}' contains a carriage return (\\r).".format(str(check_arg.replace('\r', ''))))
warning("Invoking this program via scripts which use CRLF instead of LF line endings will have undefined behaviour.")

def warn_on_deprecated_args(self, args):
"""
Print warning messages for any deprecated arguments that were passed.
Expand Down