oracle/oci-cli

`3.43.0` fails on python `3.12.x` with invalid escape sequence errors

gerstle opened this issue · 1 comments

When you brew install oci-cli as of 6 jun 2024, it pulls in python@3.12 which then causes failures when running oci...

/opt/homebrew/Cellar/oci-cli/3.43.0/libexec/lib/python3.12/site-packages/oci_cli/cli_util.py:1125: SyntaxWarning: invalid escape sequence '\['
  list_type = {'module': complex_type_definition['module'], 'class': re.match('list\[(.*)\]', complex_type_definition['class']).group(1)}  # noqa: W605
/opt/homebrew/Cellar/oci-cli/3.43.0/libexec/lib/python3.12/site-packages/oci_cli/cli_util.py:2335: SyntaxWarning: invalid escape sequence '\s'
  json_page_matcher = re.compile("(^\s*\[)([\s\S]*?)(}\s*\]$)")  # noqa: W605
/opt/homebrew/Cellar/oci-cli/3.43.0/libexec/lib/python3.12/site-packages/oci_cli/cli_util.py:2386: SyntaxWarning: invalid escape sequence '\s'
  json_page_matcher = re.compile("(^[\s\S]*\[\s)([\s\S]*?)(}\s*\]\s*}$)")  # noqa: W605
/opt/homebrew/Cellar/oci-cli/3.43.0/libexec/lib/python3.12/site-packages/oci_cli/cli_util.py:2427: SyntaxWarning: invalid escape sequence '\`'
  'with double escape character \`.\ne.g. --query data[*].\`"display-name\`"',  # noqa: E127, W605
/opt/homebrew/Cellar/oci-cli/3.43.0/libexec/lib/python3.12/site-packages/oci_cli/json_skeleton_utils.py:252: SyntaxWarning: invalid escape sequence '\['
  sub_kls = re.match('list\[(.*)\]', cls).group(1)  # noqa: W605
/opt/homebrew/Cellar/oci-cli/3.43.0/libexec/lib/python3.12/site-packages/oci_cli/json_skeleton_utils.py:269: SyntaxWarning: invalid escape sequence '\('
  key_sub_kls = re.match('dict\(([^,]*), (.*)\)', cls).group(1)    # noqa: W605
/opt/homebrew/Cellar/oci-cli/3.43.0/libexec/lib/python3.12/site-packages/oci_cli/json_skeleton_utils.py:270: SyntaxWarning: invalid escape sequence '\('
  value_sub_kls = re.match('dict\(([^,]*), (.*)\)', cls).group(2)  # noqa: W605
3.43.0

Modifying cli_util.py to use raw strings (ie, r"...") in a handful of cases seems to fix the issue.