changeset 12649:6c0e1aee1b19

setup: user-friendly error message if Python headers are missing
author Nicolas Dumazet <nicdumz.commits@gmail.com>
date Fri, 08 Oct 2010 21:43:21 +0200
parents 8be2d78460ef
children fed4bb2c8def
files setup.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/setup.py	Sat Oct 09 07:13:51 2010 -0500
+++ b/setup.py	Fri Oct 08 21:43:21 2010 +0200
@@ -55,6 +55,7 @@
 from distutils.spawn import spawn, find_executable
 from distutils.ccompiler import new_compiler
 from distutils.errors import CCompilerError
+from distutils.sysconfig import get_python_inc
 
 scripts = ['hg']
 if os.name == 'nt':
@@ -246,6 +247,9 @@
                 if ext.name.startswith("mercurial."):
                     self.py_modules.append("mercurial.pure.%s" % ext.name[10:])
             self.distribution.ext_modules = []
+        else:
+            if not os.path.exists(os.path.join(get_python_inc(), 'Python.h')):
+                raise SystemExit("Python headers are required to build Mercurial")
 
     def find_modules(self):
         modules = build_py.find_modules(self)