mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-15 10:09:59 +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 version of markdown required
|
||||||
MINIMUM_MARKDOWN = (3, 3, 3)
|
MINIMUM_MARKDOWN = (3, 3, 3)
|
||||||
|
|
||||||
|
# Minimum meson required
|
||||||
|
MINIMUM_MESON = "0.60.0"
|
||||||
|
|
||||||
|
|
||||||
def get_possible_profiles():
|
def get_possible_profiles():
|
||||||
return ["fedora", "centos", "debian", "ubuntu", "arch", "void"]
|
return ["fedora", "centos", "debian", "ubuntu", "arch", "void"]
|
||||||
@ -33,7 +36,16 @@ def detect_profile():
|
|||||||
return target
|
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:
|
try:
|
||||||
import markdown
|
import markdown
|
||||||
|
|
||||||
@ -42,7 +54,16 @@ def test_markdown():
|
|||||||
new_enough = False
|
new_enough = False
|
||||||
if not new_enough:
|
if not new_enough:
|
||||||
print("python3-markdown must be installed/upgraded")
|
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):
|
def parse_dependencies(OS, variant, requested_type):
|
||||||
@ -146,6 +167,7 @@ if __name__ == "__main__":
|
|||||||
choices=[
|
choices=[
|
||||||
"get-dependencies",
|
"get-dependencies",
|
||||||
"test-markdown",
|
"test-markdown",
|
||||||
|
"test-meson",
|
||||||
"detect-profile",
|
"detect-profile",
|
||||||
"install-dependencies",
|
"install-dependencies",
|
||||||
"install-pip",
|
"install-pip",
|
||||||
@ -178,7 +200,9 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
# command to run
|
# command to run
|
||||||
if command == "test-markdown":
|
if command == "test-markdown":
|
||||||
test_markdown()
|
test_markdown(args.debug)
|
||||||
|
elif command == "test-meson":
|
||||||
|
test_meson(args.debug)
|
||||||
elif command == "detect-profile":
|
elif command == "detect-profile":
|
||||||
print(detect_profile())
|
print(detect_profile())
|
||||||
elif command == "get-dependencies":
|
elif command == "get-dependencies":
|
||||||
|
@ -5,6 +5,15 @@ set -x
|
|||||||
#check for and install missing dependencies
|
#check for and install missing dependencies
|
||||||
./contrib/ci/fwupd_setup_helpers.py install-dependencies --yes -o ubuntu
|
./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
|
#clone test firmware if necessary
|
||||||
. ./contrib/ci/get_test_firmware.sh
|
. ./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
|
read -p "Install developer-friendly **unsafe** PolicyKit rules into /etc/polkit-1/rules.d? (y/N) " question
|
||||||
if [ "$question" = "y" ]; then
|
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/
|
sudo cp ./policy/org.freedesktop.fwupd-unsafe.rules /etc/polkit-1/rules.d/
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -111,9 +112,12 @@ setup_prepush()
|
|||||||
|
|
||||||
check_markdown()
|
check_markdown()
|
||||||
{
|
{
|
||||||
if ! python3 $HELPER test-markdown; then
|
python3 $HELPER test-markdown
|
||||||
install_pip markdown --upgrade
|
}
|
||||||
fi
|
|
||||||
|
check_meson()
|
||||||
|
{
|
||||||
|
python3 $HELPER test-meson
|
||||||
}
|
}
|
||||||
|
|
||||||
detect_os()
|
detect_os()
|
||||||
@ -173,6 +177,7 @@ if [ -t 2 ]; then
|
|||||||
esac
|
esac
|
||||||
setup_unsafe_polkit_rules
|
setup_unsafe_polkit_rules
|
||||||
check_markdown
|
check_markdown
|
||||||
|
check_meson
|
||||||
setup_vscode
|
setup_vscode
|
||||||
rename_branch
|
rename_branch
|
||||||
setup_prepush
|
setup_prepush
|
||||||
|
Loading…
Reference in New Issue
Block a user