diff --git a/pythonforandroid/toolchain.py b/pythonforandroid/toolchain.py index 153bba1523..99680d83de 100644 --- a/pythonforandroid/toolchain.py +++ b/pythonforandroid/toolchain.py @@ -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 @@ -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.