mirror of https://github.com/davisking/dlib.git
Make setup.py errors about cmake not being installed more readable
This commit is contained in:
parent
df46c516b9
commit
869097c809
11
setup.py
11
setup.py
|
@ -118,18 +118,17 @@ class CMakeBuild(build_ext):
|
|||
def get_cmake_version(self):
|
||||
try:
|
||||
out = subprocess.check_output(['cmake', '--version'])
|
||||
except OSError:
|
||||
raise RuntimeError("\n*******************************************************************\n" +
|
||||
" CMake must be installed to build the following extensions: " +
|
||||
", ".join(e.name for e in self.extensions) +
|
||||
"\n*******************************************************************\n")
|
||||
except:
|
||||
sys.stderr.write("\nERROR: CMake must be installed to build dlib\n\n")
|
||||
sys.exit(1)
|
||||
return re.search(r'version\s*([\d.]+)', out.decode()).group(1)
|
||||
|
||||
def run(self):
|
||||
cmake_version = self.get_cmake_version()
|
||||
if platform.system() == "Windows":
|
||||
if LooseVersion(cmake_version) < '3.1.0':
|
||||
raise RuntimeError("CMake >= 3.1.0 is required on Windows")
|
||||
sys.stderr.write("\nERROR: CMake >= 3.1.0 is required on Windows\n\n")
|
||||
sys.exit(1)
|
||||
|
||||
for ext in self.extensions:
|
||||
self.build_extension(ext)
|
||||
|
|
Loading…
Reference in New Issue