Move GetVolumeID to common lib
This commit is contained in:
15
client/lib.py
Normal file
15
client/lib.py
Normal file
@@ -0,0 +1,15 @@
|
||||
import re
|
||||
import subprocess
|
||||
|
||||
|
||||
_VOLUME_ID_REGEX = re.compile(b'^Volume id: (?P<volume_id>.+)$', re.MULTILINE)
|
||||
|
||||
|
||||
def GetVolumeID(path):
|
||||
isoinfo = subprocess.check_output([
|
||||
'isoinfo',
|
||||
'-d',
|
||||
'-i', path,
|
||||
])
|
||||
match = _VOLUME_ID_REGEX.search(isoinfo)
|
||||
return match.group('volume_id').decode('ascii')
|
||||
Reference in New Issue
Block a user