Skip to content

Commit

Permalink
[install] Use distro instead of lsb_release.
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabien-B authored and Fabien-B committed Oct 14, 2024
1 parent 697ec20 commit 082dba8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ PyQtWebEngine
pyqtgraph
unidecode
matplotlib
distro
19 changes: 9 additions & 10 deletions sw/tools/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *

import lsb_release
import distro
import subprocess
import webbrowser

release = lsb_release.get_distro_information()
distro_version = float(distro.version())
docs = 'https://paparazzi-uav.readthedocs.io'


Expand Down Expand Up @@ -47,12 +47,12 @@ def cmd_repo(self):
def cmd_dev(self):
self.execute('sudo -E apt-get -f -y install paparazzi-dev')
# Missing
if float(release['RELEASE']) <= 20.04:
if distro_version <= 20.04:
self.execute('sudo -E apt-get install -y python3-lxml python3-numpy')

def cmd_arm(self):
self.execute('sudo -E apt-get -f -y install paparazzi-dev')
if float(release['RELEASE']) >= 20.04:
if distro_version >= 20.04:
self.execute('sudo -E apt-get install -y python-is-python3 gcc-arm-none-eabi gdb-multiarch')
# python3-serial?
else:
Expand All @@ -72,7 +72,7 @@ def cmd_mcu(self):
self.execute('sudo -E cp conf/system/udev/rules/*.rules /etc/udev/rules.d/ && sudo -E udevadm control --reload-rules')

def cmd_gazebo(self):
if float(release['RELEASE']) > 20.04:
if distro_version > 20.04:
self.execute('sudo -E apt-get -f -y install gazebo libgazebo-dev')
else:
self.execute('sudo -E apt-get -f -y install gazebo9 libgazebo9-dev')
Expand Down Expand Up @@ -106,8 +106,7 @@ def __init__(self):
QWidget.__init__(self)
mainlayout = QVBoxLayout()

os = QLabel()
os.setText("OS: " + release['ID'] + ' ' + release['RELEASE'])
os = QLabel(f"OS: {distro.name()} {distro.version()}")
os.setFont(QFont("Times", 18, QFont.Bold))
mainlayout.addWidget(os)

Expand Down Expand Up @@ -143,7 +142,7 @@ def __init__(self):
btn_layout.addWidget(button4)

button5 = QPushButton('5) Binary ground station')
if float(release['RELEASE']) < 20.04:
if distro_version < 20.04:
button5.setDisabled(True)
else:
button5.clicked.connect(self.cmd_gcs)
Expand All @@ -153,7 +152,7 @@ def __init__(self):
button6.clicked.connect(self.cmd_mcu)
btn_layout.addWidget(button6)

if float(release['RELEASE']) <= 20.04:
if distro_version <= 20.04:
button7 = QPushButton('7) Gazebo9')
else:
button7 = QPushButton('7) Gazebo11')
Expand All @@ -162,7 +161,7 @@ def __init__(self):

button8 = QPushButton('8) Bebop Opencv')
button8.clicked.connect(self.cmd_bebopcv)
if float(release['RELEASE']) > 20.04:
if distro_version > 20.04:
button8.setDisabled(True)
btn_layout.addWidget(button8)

Expand Down

0 comments on commit 082dba8

Please sign in to comment.