Commit adb0fbc7 authored by Sébastien Luttringer's avatar Sébastien Luttringer
Browse files

Also unicodify install subparser arguments

parent ec7a9ad6
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@ import argparse
import psutil
import socket
import sys
import locale
import installsystems
import installsystems.printer
import installsystems.tools as istools
@@ -674,10 +673,7 @@ def main():
        # init arg parser
        arg_parser = arg_parser_init()
        # encode command line arguments to utf-8
        try:
            args = [ unicode(x, encoding=locale.getpreferredencoding()) for x in sys.argv[1:]]
        except UnicodeDecodeError as e:
            raise ISError("Invalid character encoding in command line")
        args = istools.argv()[1:]
        # first partial parsing, to get early debug and config path
        options = arg_parser.parse_known_args(args=args)[0]
        # set early command line verbosity and color
@@ -736,6 +732,7 @@ def main():
    except Exception as e:
        error(u"Unexpected error, please report it with debug enabled", exception=e)


# Entry point
if __name__ == '__main__':
    main()
+3 −1
Original line number Diff line number Diff line
@@ -981,9 +981,11 @@ class PackageImage(Image):
                             {"parser": extparser})
        # call parser (again), with full options
        arrow("Parsing command line")
        # encode command line arguments to utf-8
        args = istools.argv()[1:]
        # Catch exception in custom argparse action
        try:
            args = parser.parse_args()
            args = parser.parse_args(args=args)
        except Exception as e:
            raise ISError("Argument parser", e)
        # run setup scripts
+9 −0
Original line number Diff line number Diff line
@@ -670,3 +670,12 @@ def render_templates(target, context, tpl_ext=".istpl", force=False, keep=False)
                os.chmod(file_path, st.st_mode)
                if not keep:
                    os.unlink(tpl_path)

def argv():
    '''
    Return system argv after an unicode transformation with locale preference
    '''
    try:
        return [unicode(x, encoding=locale.getpreferredencoding()) for x in sys.argv]
    except UnicodeDecodeError as e:
        raise ISError("Invalid character encoding in command line")