package name is not the same as in pip bugfix

This commit is contained in:
Zypherift 2024-03-18 21:34:07 +01:00
parent 49b98e8b10
commit bf1bb53c96

View File

@ -5,18 +5,18 @@ import sys
def install(package): def install(package):
subprocess.check_call([sys.executable, "-m", "pip", "install", package]) subprocess.check_call([sys.executable, "-m", "pip", "install", package])
# List of required packages # Dictionary mapping required package names to import names
required_packages = [ package_mapping = {
"console-menu", "console-menu": "consolemenu",
"bottombar" "bottombar": "bottombar"
] }
# Check for missing packages # Check for missing packages
missing_packages = [] missing_packages = []
for package in required_packages: for required_package, import_name in package_mapping.items():
spec = importlib.util.find_spec(package) spec = importlib.util.find_spec(import_name)
if spec is None: if spec is None:
missing_packages.append(package) missing_packages.append(required_package)
# If missing packages are found, ask the user whether to install them # If missing packages are found, ask the user whether to install them
if missing_packages: if missing_packages: