Commit 052449d1 authored by Ghislain MARY's avatar Ghislain MARY

Add python module dependencies checking in prepare.py.

parent 23e5580d
......@@ -24,6 +24,7 @@
import argparse
import copy
import imp
import os
import platform
import re
......@@ -174,6 +175,7 @@ class Preparator:
self.targets = targets
self.virtual_targets = virtual_targets
self.additional_args = []
self.missing_python_dependencies = []
self.missing_dependencies = {}
self.release_with_debug_info = False
self.veryclean = False
......@@ -215,6 +217,14 @@ class Preparator:
new_targets += [target_name]
self.args.target = list(set(new_targets))
def check_python_module_is_present(self, modname):
try:
imp.find_module(modname)
return True
except ImportError:
self.missing_python_dependencies += [modname]
return False
def check_is_installed(self, binary, prog=None, warn=True):
if not find_executable(binary):
if warn:
......@@ -243,6 +253,11 @@ class Preparator:
if self.missing_dependencies:
error("The following binaries are missing: {}. Please install them.".format(' '.join(self.missing_dependencies.keys())))
def show_missing_python_dependencies(self):
if self.missing_python_dependencies:
error("The following python modules are missing: {}. Please install them using:\n\tpip install {}".format(
' '.join(self.missing_python_dependencies), ' '.join(self.missing_python_dependencies)))
def gpl_disclaimer(self):
if not self.show_gpl_disclaimer:
return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment