[pygobject] setup.py: Add logging for pycairo lookup and fail early if the header isn't found. See #150
- From: Christoph Reiter <creiter src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] setup.py: Add logging for pycairo lookup and fail early if the header isn't found. See #150
- Date: Thu, 25 Jan 2018 14:48:17 +0000 (UTC)
commit 200a9c940d9bf5b0104cedc96c94c55867aac440
Author: Christoph Reiter <reiter christoph gmail com>
Date: Thu Jan 25 15:42:04 2018 +0100
setup.py: Add logging for pycairo lookup and fail early if the header isn't found. See #150
Log the pycairo module we find and the include path we deduce from that.
Also check that the directory actually includes the right header file
instead of letting the compiler fail later on.
This will hopefully make it more clear why installing through pip isn't working
in some cases (see #150 for some reports)
setup.py | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/setup.py b/setup.py
index 7ffb11f1..9718ff31 100755
--- a/setup.py
+++ b/setup.py
@@ -35,8 +35,9 @@ from email import parser
import pkg_resources
from setuptools import setup, find_packages
from distutils.core import Extension, Distribution, Command
+from distutils.errors import DistutilsSetupError
from distutils.ccompiler import new_compiler
-from distutils import dir_util
+from distutils import dir_util, log
def get_command_class(name):
@@ -502,6 +503,7 @@ def get_pycairo_include_dir():
script_dir, get_pycairo_pkg_config_name())
dist = pkg_resources.get_distribution("pycairo>=%s" % min_version)
+ log.info("pycairo: found %r" % dist)
def get_sys_path(dist, name):
"""The sysconfig path for a distribution, or None"""
@@ -585,6 +587,15 @@ class build_ext(du_build_ext):
def add_pycairo(ext):
include_dir = get_pycairo_include_dir()
+
+ log.info("pycairo: using include directory: %r" % include_dir)
+ header_path = os.path.join(
+ include_dir, "%s.h" % get_pycairo_pkg_config_name())
+ if not os.path.exists(header_path):
+ raise DistutilsSetupError(
+ "pycairo: header file (%r) not found" % header_path)
+ log.info("pycairo: found %r" % header_path)
+
ext.include_dirs += [include_dir]
gi_ext = ext["gi._gi"]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]