Skip to content

Commit 4f87b3c

Browse files
committed
don't fail if there is no /etc/os-release
Signed-off-by: Robert Schütz <github@dotlambda.de>
1 parent b118354 commit 4f87b3c

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/commoncode/system.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,10 @@ def is_on_ubuntu_22(os_release_location='/etc/os-release'):
9494
os_release_info = parse_os_release(os_release_location)
9595
return os_release_info['ID'] == 'ubuntu' and '22' in os_release_info['VERSION_ID']
9696

97-
on_ubuntu_22 = is_on_ubuntu_22()
97+
try:
98+
on_ubuntu_22 = is_on_ubuntu_22()
99+
except FileNotFoundError:
100+
on_ubuntu_22 = False
98101

99102
del is_on_ubuntu_22
100103

0 commit comments

Comments
 (0)