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
This commit is contained in:
Alexander Bokovoy 2011-11-16 15:10:21 +02:00 committed by Rob Crittenden
parent 151001ac48
commit ebdc752b66

View File

@ -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'])