Add debug info and qemu enhancement

1. Added debug info to check the python version
2. Added kvm option in qemu under Linux
pull/276/head
mbusb 7 years ago
parent 3136ffe4fa
commit 75342f1198

@ -19,6 +19,13 @@ sys.path.append('/usr/local/lib/python3.5/dist-packages') # for version 8.9.0 o
if '/usr/lib/python3/dist-packages/scripts/' not in sys.path: if '/usr/lib/python3/dist-packages/scripts/' not in sys.path:
sys.path.append('/usr/lib/python3/dist-packages/scripts/') sys.path.append('/usr/lib/python3/dist-packages/scripts/')
# May users install multibootusb on python 2.7 and report as multibootusb issue
# We need to know which version are they using so the below lines are required.
# We need to do this here otherwise it failes on import error
python_version = sys.version
_platform = platform.platform()
print('Using python version ', python_version, 'on platform', _platform)
# Had trouble in importing scripts directory. Had to add few lines below to ensure it works on source as well as # Had trouble in importing scripts directory. Had to add few lines below to ensure it works on source as well as
# post install # post install
try: try:
@ -43,6 +50,7 @@ def running_from():
""" """
Print version and path location (installed or source code) info for debugging later. Print version and path location (installed or source code) info for debugging later.
""" """
gen.log('Using python version ' + python_version + 'on platform ' + _platform, _print=False)
if os.path.exists('scripts'): if os.path.exists('scripts'):
gen.log('Running multibootusb version ' + gen.mbusb_version() + ' from source...') gen.log('Running multibootusb version ' + gen.mbusb_version() + ' from source...')
else: else:

@ -22,7 +22,7 @@ def scripts_dir_path():
return os.path.dirname(os.path.realpath(__file__)) return os.path.dirname(os.path.realpath(__file__))
def log(message, info=True, error=False, debug=False): def log(message, info=True, error=False, debug=False, _print=True):
""" """
Dirty function to log messages to file and also print on screen. Dirty function to log messages to file and also print on screen.
:param message: :param message:
@ -43,6 +43,7 @@ def log(message, info=True, error=False, debug=False):
format='%(asctime)s.%(msecs)03d %(name)s %(levelname)s %(message)s', format='%(asctime)s.%(msecs)03d %(name)s %(levelname)s %(message)s',
datefmt='%H:%M:%S', datefmt='%H:%M:%S',
level=logging.DEBUG) level=logging.DEBUG)
if _print is True:
print(message) print(message)
# remove ANSI color codes from logs # remove ANSI color codes from logs

@ -48,7 +48,7 @@ class Qemu(QtWidgets.QMainWindow, Ui_MainWindow):
else: else:
ram = "" ram = ""
cmd = qemu + ram + ' -boot d' + ' -cdrom "' + str(qemu_iso_link) + '"' cmd = qemu + ram + ' -enable-kvm -boot d' + ' -cdrom "' + str(qemu_iso_link) + '"'
try: try:
log("Executing ==> " + cmd) log("Executing ==> " + cmd)
subprocess.Popen(cmd, shell=True) subprocess.Popen(cmd, shell=True)
@ -98,7 +98,7 @@ class Qemu(QtWidgets.QMainWindow, Ui_MainWindow):
os.chdir(parent_dir) os.chdir(parent_dir)
elif platform.system() == "Linux": elif platform.system() == "Linux":
cmd = qemu + ' -hda "' + qemu_usb_disk + '"' + ram + ' -vga std' cmd = qemu + ' -enable-kvm -hda "' + qemu_usb_disk + '"' + ram + ' -vga std'
try: try:
log('Executing ==> ' + cmd) log('Executing ==> ' + cmd)
subprocess.Popen(cmd, shell=True) subprocess.Popen(cmd, shell=True)

Loading…
Cancel
Save