diff options
author | Chris Mayo <aklhfex@gmail.com> | 2022-11-02 19:29:56 +0000 |
---|---|---|
committer | Frediano Ziglio <freddy77@gmail.com> | 2023-12-16 18:45:43 +0000 |
commit | 29dacb5f53f5183fb089a3fb02d081dd08bde8a1 (patch) | |
tree | 7548d9c5cae3960dbedf1f430c714f64e306ce9d | |
parent | 91fc091358ac4906a05b68d70e9db94082c0749f (diff) |
Stop using Python six package
Signed-off-by: Chris Mayo <aklhfex@gmail.com>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
-rw-r--r-- | .gitlab-ci.yml | 2 | ||||
-rw-r--r-- | m4/spice-deps.m4 | 6 | ||||
-rw-r--r-- | meson.build | 2 | ||||
-rw-r--r-- | python_modules/codegen.py | 6 | ||||
-rw-r--r-- | python_modules/spice_parser.py | 10 | ||||
-rwxr-xr-x | spice_codegen.py | 11 |
6 files changed, 13 insertions, 24 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4e4de75..877919b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,7 +3,7 @@ image: fedora:latest before_script: - > dnf install git libtool make libasan - python3 python3-six python3-pyparsing glib-networking + python3 python3-pyparsing glib-networking meson ninja-build gdk-pixbuf2-devel glib2-devel pixman-devel openssl-devel libjpeg-devel libcacard-devel cyrus-sasl-devel lz4-devel opus-devel diff --git a/m4/spice-deps.m4 b/m4/spice-deps.m4 index b5466e6..46e7729 100644 --- a/m4/spice-deps.m4 +++ b/m4/spice-deps.m4 @@ -153,14 +153,12 @@ AC_DEFUN([SPICE_CHECK_PYTHON_MODULES], [ if test "x$enable_python_checks" != "xno"; then AS_IF([test -n "$PYTHON"], # already set required PYTHON version [AM_PATH_PYTHON - AX_PYTHON_MODULE([six], [1]) AX_PYTHON_MODULE([pyparsing], [1])], [PYTHON=python3 - AX_PYTHON_MODULE([six]) AX_PYTHON_MODULE([pyparsing]) - test "$HAVE_PYMOD_SIX" = "yes" && test "$HAVE_PYMOD_PYPARSING" = "yes"], + test "$HAVE_PYMOD_PYPARSING" = "yes"], [AM_PATH_PYTHON([3])], - [AC_MSG_ERROR([Python modules six and pyparsing are required])]) + [AC_MSG_ERROR([Python module pyparsing is required])]) else AM_PATH_PYTHON fi diff --git a/meson.build b/meson.build index 33f8f8a..e98119d 100644 --- a/meson.build +++ b/meson.build @@ -130,7 +130,7 @@ if spice_common_generate_client_code or spice_common_generate_server_code python = py_module.find_installation('python3') if get_option('python-checks') - foreach module : ['six', 'pyparsing'] + foreach module : ['pyparsing'] message('Checking for python module @0@'.format(module)) cmd = run_command(python, '-c', 'import @0@'.format(module), check : false) if cmd.returncode() != 0 diff --git a/python_modules/codegen.py b/python_modules/codegen.py index bfb2351..affe5bc 100644 --- a/python_modules/codegen.py +++ b/python_modules/codegen.py @@ -1,5 +1,4 @@ -import six from io import StringIO def camel_to_underscores(s, upper = False): @@ -123,10 +122,7 @@ class CodeWriter: def write(self, s): # Ensure its a unicode string - if six.PY3: - s = str(s) - else: - s = unicode(s) + s = str(s) if len(s) == 0: return diff --git a/python_modules/spice_parser.py b/python_modules/spice_parser.py index 4d753cb..1dc7e22 100644 --- a/python_modules/spice_parser.py +++ b/python_modules/spice_parser.py @@ -1,11 +1,9 @@ -import six - try: from pyparsing import Literal, CaselessLiteral, Word, OneOrMore, ZeroOrMore, \ Forward, delimitedList, Group, Optional, Combine, alphas, nums, restOfLine, cStyleComment, \ alphanums, ParseException, ParseResults, Keyword, StringEnd, replaceWith except ImportError: - six.print_("Module pyparsing not found.") + print("Module pyparsing not found.") exit(1) @@ -149,9 +147,9 @@ def parse(filename): bnf = SPICE_BNF() types = bnf.parseFile(filename) except ParseException as err: - six.print_(err.line, file=sys.stderr) - six.print_(" "*(err.column-1) + "^", file=sys.stderr) - six.print_(err, file=sys.stderr) + print(err.line, file=sys.stderr) + print(" "*(err.column-1) + "^", file=sys.stderr) + print(err, file=sys.stderr) return None for t in types: diff --git a/spice_codegen.py b/spice_codegen.py index d3a1bf5..b45a7ef 100755 --- a/spice_codegen.py +++ b/spice_codegen.py @@ -9,7 +9,7 @@ from python_modules import ptypes from python_modules import codegen from python_modules import demarshal from python_modules import marshal -import six + def write_channel_enums(writer, channel, client, describe): messages = list(filter(lambda m : m.channel == channel, \ @@ -113,20 +113,17 @@ def write_content(dest_file, content, keep_identical_file): f.close() if content == old_content: - six.print_("No changes to %s" % dest_file) + print("No changes to %s" % dest_file) return except IOError: pass f = open(dest_file, 'wb') - if six.PY3: - f.write(bytes(content, 'UTF-8')) - else: - f.write(content) + f.write(bytes(content, 'UTF-8')) f.close() - six.print_("Wrote %s" % dest_file) + print("Wrote %s" % dest_file) parser = OptionParser(usage="usage: %prog [options] <protocol_file> <destination file>") |