Skip to content

Commit 0abb070

Browse files
committed
Check if the program requirements are there, if not exit the program
- Check if the proper Python3 version is installed - Check if pv is installed
1 parent 8730fe0 commit 0abb070

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

meta_update.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
11
#!/usr/bin/env python3
22

3+
import apt
34
import os
45
import pathlib
56
import shutil
67
import sqlite3
78
import subprocess
89
import sys
910

11+
# Check the python version, minimum version needs to be 3.7
12+
if sys.version_info < (3, 7):
13+
sys.exit("You must use Python 3.7 or newer.")
14+
15+
# Check if pv is installed
16+
cache = apt.Cache()
17+
cache.open()
18+
try:
19+
cache["pv"].is_installed
20+
except Exception:
21+
sys.exit("You must install pv, apt install pv.")
22+
1023
# Installation count/type
1124
installCount = 0
1225
installType = ""

0 commit comments

Comments
 (0)