Commit b1a13763 authored by Maxime Perrotin's avatar Maxime Perrotin

Add check of gr740_rtems10_gaisler_posix

parent 318e974c
#!/bin/bash -e #!/bin/bash -e
echo "Checking if target $1 is supported" echo "Checking if target $1 is supported"
check-deployment-target-gui.py $1
exit 0 exit 0
#!/usr/bin/env python #!/usr/bin/env python
import sys import sys
import os
import PySide import PySide
from PySide.QtGui import (QApplication, from PySide.QtGui import (QApplication,
QMessageBox) QMessageBox)
def check_crazyflie(): def install_gr740_rtems410_gaisler_posix():
''' This function should be in a different module ''' print 'Installing this nice target'
return
def check_snoopy(): def check_gr740_rtems410_gaisler_posix():
raise NotImplementedError() if not os.path.isdir("/opt/rtems-4.10"):
raise NotImplementedError(install_gr740_rtems410_gaisler_posix)
PLATFORMS = { "crazyflie.gnat" : check_crazyflie,
"snoopy" : check_snoopy}
def run_gui(platform): PLATFORMS = { "crazyflie_v2.gnat" : lambda: True,
app = QApplication(sys.argv) "stm32f4_discovery.gnat" : lambda: True,
"leon.rtems_posix" : lambda: True,
"leon2.rtems412_posix" : lambda: True,
"leon3.rtems412_posix" : lambda: True,
"gr712.rtems412_posix" : lambda: True,
"gr740.rtems412_posix" : lambda: True,
"gr740.rtems410_gaisler_posix" :
check_gr740_rtems410_gaisler_posix,
"x86.linux" : lambda: True,
"x86.win32" : lambda: True
}
def query_user(platform):
msg_box = QMessageBox() msg_box = QMessageBox()
msg_box.setWindowTitle("This plaform is not installed!") msg_box.setWindowTitle("This plaform is not installed!")
ok = msg_box.addButton("Install now", QMessageBox.AcceptRole) ok = msg_box.addButton("Install now", QMessageBox.AcceptRole)
...@@ -24,28 +35,35 @@ def run_gui(platform): ...@@ -24,28 +35,35 @@ def run_gui(platform):
msg_box.setEscapeButton(later) msg_box.setEscapeButton(later)
msg_box.setDefaultButton(ok) msg_box.setDefaultButton(ok)
msg_box.setIcon(QMessageBox.Warning) msg_box.setIcon(QMessageBox.Warning)
msg_box.setText("Do you want to install target {} ?".format(platform)) msg_box.setText("Do you want to install target\n{} ?".format(platform))
msg_box.exec_() msg_box.exec_()
if msg_box.clickedButton() == ok: if msg_box.clickedButton() == ok:
print("OK, will do.") return True
else: else:
warn_box = QMessageBox() warn_box = QMessageBox()
warn_box.setIcon(QMessageBox.Information) warn_box.setIcon(QMessageBox.Information)
warn_box.setText("You can install the platform later, manually") warn_box.setText("You can install the platform later, manually")
warn_box.exec_() warn_box.exec_()
return False
def main(): def main():
app = QApplication(sys.argv)
# check if the target in supported # check if the target in supported
try: try:
platform = sys.argv[1] platform = sys.argv[1]
PLATFORMS[platform]() PLATFORMS[platform]()
except KeyError: except KeyError:
print("Unknown platform: {}".format(platform)) warn_box = QMessageBox()
warn_box.setIcon(QMessageBox.Information)
warn_box.setText("Unknown platform: {}".format(platform))
warn_box.exec_()
return 1 return 1
except IndexError: except IndexError:
print("You must specify the target in the command line") print("You must specify the target in the command line")
except NotImplementedError: except NotImplementedError as exc:
run_gui(platform) install_it, = exc.args
if query_user(platform):
install_it()
else: else:
print("Platform {} is installed".format(platform)) print("Platform {} is installed".format(platform))
sys.exit(0) sys.exit(0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment