зеркало из https://github.com/mono/qa.git
* Added OS detection for VPC, VMware and LiveCD to helpers.whichOS()
svn path=/trunk/qa/; revision=138775
This commit is contained in:
Родитель
7b71204255
Коммит
a37c3e1084
|
@ -3,6 +3,7 @@
|
|||
import sys
|
||||
import os
|
||||
import subprocess
|
||||
import pdb
|
||||
|
||||
myTestopia = None
|
||||
|
||||
|
@ -30,7 +31,25 @@ def whichOS():
|
|||
if sys.platform == 'win32':
|
||||
return 'win32'
|
||||
elif sys.platform == 'linux2':
|
||||
return 'linux'
|
||||
if os.path.isfile("/studio/profile"):
|
||||
# this will determine if it's running on vpc
|
||||
moboMaker = executeCmd("hal-device computer | grep system.board.vendor")[0].strip()
|
||||
|
||||
# this tells us what type if image kiwi created (VM or LiveCD)
|
||||
for curLine in open("/studio/profile").readlines():
|
||||
if "kiwi_type=" in curLine:
|
||||
kiwiType = curLine.split("=")[1].strip().strip("\"")
|
||||
|
||||
if moboMaker == "system.board.vendor = 'Microsoft Corporation' (string)" and kiwiType == "vmx":
|
||||
return 'vpc'
|
||||
elif kiwiType == "iso":
|
||||
return 'livecd'
|
||||
elif kiwiType == "vmx":
|
||||
return 'vmware'
|
||||
else:
|
||||
raise Exception("Couldn't determine the type of kiwi created image I'm running on.")
|
||||
else:
|
||||
return 'linux'
|
||||
elif sys.platform == 'darwin':
|
||||
return 'macos'
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче