Stop compilation when Python headers are not present
authorDag Sverre Seljebotn <dagss@student.matnat.uio.no>
Wed, 20 May 2009 18:11:13 +0000 (20:11 +0200)
committerDag Sverre Seljebotn <dagss@student.matnat.uio.no>
Wed, 20 May 2009 18:11:13 +0000 (20:11 +0200)
Cython/Compiler/Code.py
Cython/Compiler/ModuleNode.py

index 48fbbd01156736d85d0f8e4b62596525e0205102..2a426fe35a0969b1646c1e853522f5b2f71acc3f 100644 (file)
@@ -236,7 +236,8 @@ class GlobalState(object):
         'before_global_var',
         'global_var',
         'all_the_rest',
-        'utility_code_def'
+        'utility_code_def',
+        'end'
     ]
     
 
index 32be4c715e26ea1f2c0345ffdc7960d0f949cf10..63b72a3a2b88c2a76d0b51a2fdc0550d38fecca9 100644 (file)
@@ -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")