mirror of
https://github.com/systemd/systemd.git
synced 2024-12-05 00:04:02 +08:00
check-os-release.py compatible with Python < 3.8
The ":=" operator was only added in Python 3.8 so splitting the line with it into two makes check-os-release.py actually fulfill its claim of working with any python version.
This commit is contained in:
parent
1afe3d712e
commit
ce0a056abc
@ -17,7 +17,8 @@ def read_os_release():
|
||||
line = line.rstrip()
|
||||
if not line or line.startswith('#'):
|
||||
continue
|
||||
if m := re.match(r'([A-Z][A-Z_0-9]+)=(.*)', line):
|
||||
m = re.match(r'([A-Z][A-Z_0-9]+)=(.*)', line)
|
||||
if m:
|
||||
name, val = m.groups()
|
||||
if val and val[0] in '"\'':
|
||||
val = ast.literal_eval(val)
|
||||
|
Loading…
Reference in New Issue
Block a user