mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-22 22:03:43 +03: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. (cherry picked from commit ce0a056abc41168e1b45537505ca9f65bf6f5c30)
This commit is contained in:
parent
d572a74163
commit
951e99231e
@ -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…
x
Reference in New Issue
Block a user