Skip to content

Commit 4fa7ffb

Browse files
committed
chore(linux): remove install_linux.sh script. Activate argcomplete
Only developers need to install it and they should use SetupDeveloperPC.sh instead Clean up licenses
1 parent d42bd41 commit 4fa7ffb

File tree

5 files changed

+80
-81
lines changed

5 files changed

+80
-81
lines changed

REUSE.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ SPDX-FileCopyrightText = "2024-2025 Amilcar Lucas, 2025 Jonas Vermeulen"
5353
SPDX-License-Identifier = "GPL-3.0-or-later"
5454

5555
[[annotations]]
56-
path = ["pyrightconfig.json", "install_msgfmt.bat", "install_wsl.bash", "pyproject.toml", "pytest.ini", "test_pip_package.sh", "ardupilot_methodic_configurator_command_line_completion.psm1"]
56+
path = ["pyrightconfig.json", "pyproject.toml", "pytest.ini", "test_pip_package.sh", "ardupilot_methodic_configurator_command_line_completion.psm1"]
5757
SPDX-FileCopyrightText = "2024-2025 Amilcar Lucas"
5858
SPDX-License-Identifier = "GPL-3.0-or-later"
5959

SetupDeveloperPC.sh

+71-13
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,76 @@
11
#!/bin/bash
2+
#
3+
# SPDX-FileCopyrightText: 2024-2025 Amilcar do Carmo Lucas <[email protected]>
4+
#
5+
# SPDX-License-Identifier: GPL-3.0-or-later
6+
7+
echo "This script is only meant for ArduPilot methodic configurator developers."
8+
read -p "Do you want to develop ArduPilot methodic Configurator software on your PC? (y/N) " response
9+
10+
# Convert response to lowercase
11+
response=${response,,}
12+
13+
if [[ ! $response =~ ^y(es)?$ ]]; then
14+
echo "Setup canceled, install the software using 'pip install ardupilot_methodic_configurator' instead."
15+
exit 0
16+
fi
217

318
# Store the original directory
419
ORIGINAL_DIR=$(pwd)
520

621
# Change to the directory where the script resides
722
cd "$(dirname "$0")" || exit
823

24+
InstallDependencies() {
25+
echo "Updating package lists..."
26+
if command -v apt-get &> /dev/null; then
27+
sudo apt-get update
28+
# Install Python3 PIL.ImageTk for GUI support
29+
echo "Installing Python3 PIL.ImageTk..."
30+
sudo apt-get install -y python3-pil.imagetk
31+
else
32+
echo "apt-get not found. Skipping system package updates."
33+
fi
34+
35+
# Uninstall serial and pyserial to avoid conflicts
36+
echo "Uninstalling serial and pyserial..."
37+
sudo python3 -m pip uninstall -y serial pyserial
38+
39+
# Install the project dependencies
40+
echo "Installing project dependencies..."
41+
python3 -m pip install -e .[dev]
42+
}
43+
44+
CreateDesktopEntry() {
45+
# Get the directory of the script
46+
prog_dir=$(realpath "$(dirname "$0")")/ardupilot_methodic_configurator
47+
48+
# Check if the system is Debian-based
49+
if [ -f /etc/debian_version ] || [ -f /etc/os-release ] && grep -q 'ID_LIKE=.*debian.*' /etc/os-release; then
50+
echo "Creating ardupilot_methodic_configurator.desktop for Debian-based systems..."
51+
# Define the desktop entry content
52+
desktop_entry="[Desktop Entry]\nName=ArduPilot Methodic Configurator\nComment=A clear ArduPilot configuration sequence\nExec=bash -c 'cd $prog_dir && python3 -m ardupilot_methodic_configurator'\nIcon=$prog_dir/ArduPilot_icon.png\nTerminal=true\nType=Application\nCategories=Development;\nKeywords=ardupilot;arducopter;drone;copter;scm"
53+
# Create the .desktop file in the appropriate directory
54+
echo -e "$desktop_entry" > "/home/$USER/.local/share/applications/ardupilot_methodic_configurator.desktop"
55+
echo "ardupilot_methodic_configurator.desktop created successfully."
56+
57+
# Check if the ~/Desktop directory exists
58+
if [ -d "$HOME/Desktop" ]; then
59+
# Copy the .desktop file to the ~/Desktop directory
60+
cp "/home/$USER/.local/share/applications/ardupilot_methodic_configurator.desktop" "$HOME/Desktop/"
61+
# Mark it as trusted
62+
chmod 755 "$HOME/Desktop/ardupilot_methodic_configurator.desktop"
63+
echo "ardupilot_methodic_configurator.desktop copied to ~/Desktop."
64+
else
65+
echo "$HOME/Desktop directory does not exist. Skipping copy to Desktop."
66+
fi
67+
68+
update-desktop-database ~/.local/share/applications/
69+
else
70+
echo "This system is not Debian-based. Skipping .desktop file creation."
71+
fi
72+
}
73+
974
ConfigureGit() {
1075
echo "Configuring Git settings..."
1176
git config --local commit.gpgsign false
@@ -37,18 +102,6 @@ ConfigureGit() {
37102
echo Git configuration applied successfully.
38103
}
39104

40-
ConfigurePreCommit() {
41-
echo Setting pre-commit...
42-
echo "Checking for pip..."
43-
if ! command -v pip &> /dev/null; then
44-
echo "pip is not installed. Please install pip before running this script."
45-
exit 1
46-
fi
47-
pip install 'pre-commit==4.1.0'
48-
pre-commit install
49-
echo Pre-commit done.
50-
}
51-
52105
ConfigureVSCode() {
53106
# Check for VSCode installation
54107
echo "Checking for VSCode..."
@@ -90,9 +143,14 @@ ConfigureVSCode() {
90143
}
91144

92145
# Call configuration functions
146+
InstallDependencies
147+
CreateDesktopEntry
93148
ConfigureGit
94149
ConfigureVSCode
95-
ConfigurePreCommit
150+
151+
activate-global-python-argcomplete
152+
153+
pre-commit install
96154

97155
# Run pre-commit
98156
echo "running pre-commit checks on all Files"

install_linux.sh

-66
This file was deleted.

install_msgfmt.bat

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
@echo off
2+
rem SPDX-FileCopyrightText: 2024-2025 Amilcar do Carmo Lucas <[email protected]>
3+
rem
4+
rem SPDX-License-Identifier: GPL-3.0-or-later
25
setlocal enabledelayedexpansion
36

47
:: Check for admin privileges
@@ -41,4 +44,4 @@ if %errorLevel% neq 0 (
4144
)
4245

4346
echo Installation completed successfully
44-
pause
47+
pause

install_wsl.bash

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
# It configures the WSL2 virtual machine to run the linters required in the project
55
#
66
# This script is automatically called from the SetupDeveloperPC.bat and should not be called directly
7+
#
8+
# SPDX-FileCopyrightText: 2024-2025 Amilcar do Carmo Lucas <[email protected]>
9+
#
10+
# SPDX-License-Identifier: GPL-3.0-or-later
711

812
sudo apt-get update
913

0 commit comments

Comments
 (0)