GAM-team / GAM

command line management for Google Workspace
https://github.com/GAM-team/GAM/wiki
Apache License 2.0
3.5k stars 470 forks source link

Python 3.12 compat issues #1655

Open jay0lee opened 1 year ago

jay0lee commented 1 year ago

Tests against Python 3.12.0rc1 which is due to be released in October are currently failing. See:

https://github.com/GAM-team/GAM/actions/runs/5890842881/job/15976761667

/home/runner/work/GAM/GAM/src/gam/gdata/service.py:1094: SyntaxWarning: invalid escape sequence '\?'
  m = re.compile('[\?\&]gsessionid=(\w*)').search(location)
/home/runner/work/GAM/GAM/src/gam/gdata/service.py:1342: SyntaxWarning: invalid escape sequence '\?'
  m = re.compile('[\?\&]gsessionid=(\w*)').search(location)
/home/runner/work/GAM/GAM/src/gam/gdata/service.py:1440: SyntaxWarning: invalid escape sequence '\?'
  m = re.compile('[\?\&]gsessionid=(\w*)').search(location)
/home/runner/work/GAM/GAM/src/gam/gdata/tlslite/utils/Python_RSAKey.py:188: SyntaxWarning: invalid escape sequence '\Z'
  xmltools.getReqAttribute(element, "xmlns", "http://trevp.net/rsa\Z")
/home/runner/work/GAM/GAM/src/gam/gdata/tlslite/utils/xmltools.py:137: SyntaxWarning: invalid escape sequence '\Z'
  nsRegEx = "http://trevp.net/cryptoID\Z"
/home/runner/work/GAM/GAM/src/gam/gdata/tlslite/utils/xmltools.py:138: SyntaxWarning: invalid escape sequence '\.'
  cryptoIDRegEx = "([a-km-z3-9]{5}\.){3}[a-km-z3-9]{5}\Z"
/home/runner/work/GAM/GAM/src/gam/gdata/tlslite/utils/xmltools.py:1[39](https://github.com/GAM-team/GAM/actions/runs/5890842881/job/15976761667#step:36:40): SyntaxWarning: invalid escape sequence '\Z'
  urlRegEx = "http(s)?://.{1,100}\Z"
/home/runner/work/GAM/GAM/src/gam/gdata/tlslite/utils/xmltools.py:1[40](https://github.com/GAM-team/GAM/actions/runs/5890842881/job/15976761667#step:36:41): SyntaxWarning: invalid escape sequence '\Z'
  sha1Base64RegEx = "[A-Za-z0-9+/]{27}=\Z"
/home/runner/work/GAM/GAM/src/gam/gdata/tlslite/utils/xmltools.py:1[41](https://github.com/GAM-team/GAM/actions/runs/5890842881/job/15976761667#step:36:42): SyntaxWarning: invalid escape sequence '\Z'
  base64RegEx = "[A-Za-z0-9+/]+={0,4}\Z"
/home/runner/work/GAM/GAM/src/gam/gdata/tlslite/utils/xmltools.py:1[42](https://github.com/GAM-team/GAM/actions/runs/5890842881/job/15976761667#step:36:43): SyntaxWarning: invalid escape sequence '\Z'
  certsListRegEx = "(0)?(1)?(2)?(3)?(4)?(5)?(6)?(7)?(8)?(9)?\Z"
/home/runner/work/GAM/GAM/src/gam/gdata/tlslite/utils/xmltools.py:1[43](https://github.com/GAM-team/GAM/actions/runs/5890842881/job/15976761667#step:36:44): SyntaxWarning: invalid escape sequence '\Z'
  keyRegEx = "[A-Z]\Z"
/home/runner/work/GAM/GAM/src/gam/gdata/tlslite/utils/xmltools.py:1[44](https://github.com/GAM-team/GAM/actions/runs/5890842881/job/15976761667#step:36:45): SyntaxWarning: invalid escape sequence '\Z'
  keysListRegEx = "(A)?(B)?(C)?(D)?(E)?(F)?(G)?(H)?(I)?(J)?(K)?(L)?(M)?(N)?(O)?(P)?(Q)?(R)?(S)?(T)?(U)?(V)?(W)?(X)?(Y)?(Z)?\Z"
/home/runner/work/GAM/GAM/src/gam/gdata/tlslite/utils/xmltools.py:1[45](https://github.com/GAM-team/GAM/actions/runs/5890842881/job/15976761667#step:36:46): SyntaxWarning: invalid escape sequence '\d'
  dateTimeRegEx = "\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\dZ\Z"
/home/runner/work/GAM/GAM/src/gam/gdata/tlslite/utils/xmltools.py:1[46](https://github.com/GAM-team/GAM/actions/runs/5890842881/job/15976761667#step:36:47): SyntaxWarning: invalid escape sequence '\Z'
  shortStringRegEx = ".{1,100}\Z"
/home/runner/work/GAM/GAM/src/gam/gdata/tlslite/utils/xmltools.py:1[47](https://github.com/GAM-team/GAM/actions/runs/5890842881/job/15976761667#step:36:48): SyntaxWarning: invalid escape sequence '\Z'
  exprRegEx = "[a-zA-Z0-9 ,()]{1,200}\Z"
/home/runner/work/GAM/GAM/src/gam/gdata/tlslite/utils/xmltools.py:1[48](https://github.com/GAM-team/GAM/actions/runs/5890842881/job/15976761667#step:36:49): SyntaxWarning: invalid escape sequence '\Z'
  notAfterDeltaRegEx = "0|([1-9][0-9]{0,8})\Z" #A number from 0 to (1 billion)-1

we need to either cleanup these regex expressions or cleanup the files they are in.

@taers232c FYI - I recall removing the "tlslite" directory" from gdata a looong time ago because it wasn't really used by GAM at all. Do you know if it's actually being used here?

It looks like the first 3 warnings against gdata/service.py just need the backslashes removed, I don't think it's necessary for those to be escaped and Python 3.12 is much more picky about this sort of thing.