[Freeipa-devel] [PATCH] 0034 configure does not check for Python.h

Alexander Bokovoy abokovoy at redhat.com
Thu Nov 17 09:11:40 UTC 2011


py_default_encoding extension depends on Python.h and Python 
development tools availability. Make sure they are installed.

https://fedorahosted.org/freeipa/ticket/1838
-- 
/ Alexander Bokovoy
-------------- next part --------------
>From b6b6112cb84f69c41a27bbab1c75fed97be4a61b Mon Sep 17 00:00:00 2001
From: Alexander Bokovoy <abokovoy at redhat.com>
Date: Wed, 16 Nov 2011 15:10:21 +0200
Subject: [PATCH 1/3] Check for Python.h during build of py_default_encoding
 extension

For rare cases when Python development package is not installed,
check that Python.h is available and bail out if not.

Fixes:
https://fedorahosted.org/freeipa/ticket/1838
---
 ipapython/py_default_encoding/setup.py |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/ipapython/py_default_encoding/setup.py b/ipapython/py_default_encoding/setup.py
index 87f7504e46675fb4c79d6452f23408c445a4824c..de2478c1962aba7a78919efdb266bf0600965905 100644
--- a/ipapython/py_default_encoding/setup.py
+++ b/ipapython/py_default_encoding/setup.py
@@ -18,6 +18,13 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 from distutils.core import setup, Extension
+from distutils.sysconfig import get_python_inc
+import sys
+import os
+
+python_header = os.path.join(get_python_inc(plat_specific=1), 'Python.h')
+if not os.path.exists(python_header):
+    sys.exit("Cannot find Python development packages that provide Python.h")
 
 default_encoding_utf8 = Extension('default_encoding_utf8', ['default_encoding_utf8.c'])
 
-- 
1.7.7.2



More information about the Freeipa-devel mailing list