File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010import logging
1111import os
1212import pathlib
13+ import platform
1314import shutil
1415import warnings
1516
1617import attr
18+ import pytest
1719
1820from commoncode import fileutils
1921from commoncode .system import on_linux
@@ -74,6 +76,32 @@ def get_command(env_var=EXTRACTCODE_GUESTFISH_PATH_ENVVAR, command='guestfish'):
7476 return cmd_loc
7577
7678
79+ def get_etc_os_release_info (os_release_path = '/etc/os-release' ):
80+ cfg_kv = {}
81+ with open (os_release_path ) as f :
82+ for line in f :
83+ split_line = line .split ('=' )
84+ if not split_line :
85+ continue
86+ k = split_line [0 ].strip ()
87+ v = split_line [- 1 ].strip ()
88+ cfg_kv [k ] = v
89+ return cfg_kv
90+
91+
92+ def is_on_ubuntu_22 ():
93+ if not on_linux :
94+ return False
95+ os_release_info = get_etc_os_release_info ()
96+ print (os_release_info )
97+ return os_release_info ['ID' ] == 'ubuntu' and '22' in os_release_info ['VERSION_ID' ]
98+
99+ on_ubuntu_22 = is_on_ubuntu_22 ()
100+
101+ del is_on_ubuntu_22
102+
103+
104+ @pytest .mark .skipif (on_ubuntu_22 , reason = 'Kernel is not readable on Ubuntu 22.04' )
77105def check_linux_kernel_is_readable ():
78106 """
79107 Return True if the kernel executable file can be read. This is required by
You can’t perform that action at this time.
0 commit comments