forked from firka/student-legacy
package name is not the same as in pip bugfix
This commit is contained in:
parent
49b98e8b10
commit
bf1bb53c96
16
tools.py
16
tools.py
@ -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:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user