mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-15 04:11:41 +00:00
trivial: upgrade/install pip, meson and markdown if necessary during setup
This is super important because the Ubuntu CI job publishes documentation.
This commit is contained in:
parent
687ee06470
commit
f0ea7e1717
@ -16,6 +16,9 @@ ENDC = "\033[0m"
|
||||
# Minimum version of markdown required
|
||||
MINIMUM_MARKDOWN = (3, 3, 3)
|
||||
|
||||
# Minimum meson required
|
||||
MINIMUM_MESON = "0.60.0"
|
||||
|
||||
|
||||
def get_possible_profiles():
|
||||
return ["fedora", "centos", "debian", "ubuntu", "arch", "void"]
|
||||
@ -33,7 +36,16 @@ def detect_profile():
|
||||
return target
|
||||
|
||||
|
||||
def test_markdown():
|
||||
def pip_install_package(debug, name):
|
||||
import subprocess
|
||||
|
||||
cmd = ["python3", "-m", "pip", "install", "--upgrade", name]
|
||||
if debug:
|
||||
print(cmd)
|
||||
subprocess.call(cmd)
|
||||
|
||||
|
||||
def test_markdown(debug):
|
||||
try:
|
||||
import markdown
|
||||
|
||||
@ -42,7 +54,16 @@ def test_markdown():
|
||||
new_enough = False
|
||||
if not new_enough:
|
||||
print("python3-markdown must be installed/upgraded")
|
||||
sys.exit(not new_enough)
|
||||
pip_install_package(debug, "markdown")
|
||||
|
||||
|
||||
def test_meson(debug):
|
||||
from importlib.metadata import version
|
||||
|
||||
new_enough = version("meson") >= MINIMUM_MESON
|
||||
if not new_enough:
|
||||
print("meson must be installed/upgraded")
|
||||
pip_install_package(debug, "meson")
|
||||
|
||||
|
||||
def parse_dependencies(OS, variant, requested_type):
|
||||
@ -146,6 +167,7 @@ if __name__ == "__main__":
|
||||
choices=[
|
||||
"get-dependencies",
|
||||
"test-markdown",
|
||||
"test-meson",
|
||||
"detect-profile",
|
||||
"install-dependencies",
|
||||
"install-pip",
|
||||
@ -178,7 +200,9 @@ if __name__ == "__main__":
|
||||
|
||||
# command to run
|
||||
if command == "test-markdown":
|
||||
test_markdown()
|
||||
test_markdown(args.debug)
|
||||
elif command == "test-meson":
|
||||
test_meson(args.debug)
|
||||
elif command == "detect-profile":
|
||||
print(detect_profile())
|
||||
elif command == "get-dependencies":
|
||||
|
@ -5,6 +5,15 @@ set -x
|
||||
#check for and install missing dependencies
|
||||
./contrib/ci/fwupd_setup_helpers.py install-dependencies --yes -o ubuntu
|
||||
|
||||
#check we have pip
|
||||
./contrib/ci/fwupd_setup_helpers.py install-pip --yes -o ubuntu
|
||||
|
||||
#check meson is new enough
|
||||
./contrib/ci/fwupd_setup_helpers.py test-meson
|
||||
|
||||
#check markdown is new enough
|
||||
./contrib/ci/fwupd_setup_helpers.py test-markdown
|
||||
|
||||
#clone test firmware if necessary
|
||||
. ./contrib/ci/get_test_firmware.sh
|
||||
|
||||
|
@ -56,6 +56,7 @@ setup_unsafe_polkit_rules()
|
||||
{
|
||||
read -p "Install developer-friendly **unsafe** PolicyKit rules into /etc/polkit-1/rules.d? (y/N) " question
|
||||
if [ "$question" = "y" ]; then
|
||||
sudo mkdir -p /etc/polkit-1/rules.d
|
||||
sudo cp ./policy/org.freedesktop.fwupd-unsafe.rules /etc/polkit-1/rules.d/
|
||||
fi
|
||||
}
|
||||
@ -111,9 +112,12 @@ setup_prepush()
|
||||
|
||||
check_markdown()
|
||||
{
|
||||
if ! python3 $HELPER test-markdown; then
|
||||
install_pip markdown --upgrade
|
||||
fi
|
||||
python3 $HELPER test-markdown
|
||||
}
|
||||
|
||||
check_meson()
|
||||
{
|
||||
python3 $HELPER test-meson
|
||||
}
|
||||
|
||||
detect_os()
|
||||
@ -173,6 +177,7 @@ if [ -t 2 ]; then
|
||||
esac
|
||||
setup_unsafe_polkit_rules
|
||||
check_markdown
|
||||
check_meson
|
||||
setup_vscode
|
||||
rename_branch
|
||||
setup_prepush
|
||||
|
Loading…
Reference in New Issue
Block a user