From 7997dd38759cbbdf134a55dd9bd6f453b682d4e7 Mon Sep 17 00:00:00 2001 From: Dag Sverre Seljebotn Date: Wed, 20 May 2009 20:11:13 +0200 Subject: [PATCH] Stop compilation when Python headers are not present --- Cython/Compiler/Code.py | 3 ++- Cython/Compiler/ModuleNode.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Cython/Compiler/Code.py b/Cython/Compiler/Code.py index 48fbbd01..2a426fe3 100644 --- a/Cython/Compiler/Code.py +++ b/Cython/Compiler/Code.py @@ -236,7 +236,8 @@ class GlobalState(object): 'before_global_var', 'global_var', 'all_the_rest', - 'utility_code_def' + 'utility_code_def', + 'end' ] diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py index 32be4c71..63b72a3a 100644 --- a/Cython/Compiler/ModuleNode.py +++ b/Cython/Compiler/ModuleNode.py @@ -425,7 +425,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): code.putln('#include "%s"' % filename) code.putln("#ifndef Py_PYTHON_H") code.putln(" #error Python headers needed to compile C extensions, please install development version of Python.") - code.putln("#endif") + code.putln("#else") + code.globalstate["end"].putln("#endif /* Py_PYTHON_H */") code.putln("#ifndef PY_LONG_LONG") code.putln(" #define PY_LONG_LONG LONG_LONG") code.putln("#endif") -- 2.26.2