Enhance setup.py cmake errors reporting

This commit is contained in:
Francesco Caliumi 2020-07-31 09:51:12 +02:00 committed by GitHub
parent c78f14fb42
commit 3a9e23917f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 3 deletions

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python3
# setup script
# Copyright (C) 2019, 2020 Nguyễn Gia Phong
# Copyright (C) 2020 Francesco Caliumi
#
# This file is part of palace.
#
@ -17,6 +18,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with palace. If not, see <https://www.gnu.org/licenses/>.
import sys
import re
from distutils import log
from distutils.command.clean import clean
@ -27,7 +29,7 @@ from operator import methodcaller
from os import environ, unlink
from os.path import dirname, join
from platform import system
from subprocess import DEVNULL, PIPE, run
from subprocess import DEVNULL, PIPE, run, CalledProcessError
from Cython.Build import cythonize
from setuptools import setup, Extension
@ -57,8 +59,14 @@ class BuildAlure2Ext(build_ext):
mkpath(self.build_temp)
copy_file(join(dirname(__file__), 'CMakeLists.txt'),
self.build_temp)
cmake = run(['cmake', '.'], check=True, stdout=DEVNULL, stderr=PIPE,
cwd=self.build_temp, universal_newlines=True)
try:
cmake = run(['cmake', '.'],
check=True, stdout=DEVNULL, stderr=PIPE,
cwd=self.build_temp, universal_newlines=True)
except CalledProcessError as e:
print(e.stderr, file=sys.stderr)
raise e from None
for key, value in map(methodcaller('groups'),
re.finditer(r'^alure2_(\w*)=(.*)$',
cmake.stderr, re.MULTILINE)):