From bc3d2d852e2f6e2fd56e6cdeec6329d6033ea431 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Fri, 19 Oct 2007 15:49:56 +0200 Subject: [PATCH] fixed a couple of errors with the c extensions build process on windows --HG-- branch : trunk --- jinja/_speedups.c | 3 ++- setup.py | 11 ++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/jinja/_speedups.c b/jinja/_speedups.c index d2aaa36..c3ee18e 100644 --- a/jinja/_speedups.c +++ b/jinja/_speedups.c @@ -437,7 +437,7 @@ static PyTypeObject BaseContextType = { 0, /* tp_dictoffset */ (initproc)BaseContext_init, /* tp_init */ 0, /* tp_alloc */ - PyType_GenericNew /* tp_new */ + 0 /* tp_new */ }; static PyMethodDef module_methods[] = { @@ -452,6 +452,7 @@ init_speedups(void) { PyObject *module; + BaseContextType.tp_new = (newfunc)PyType_GenericNew; if (PyType_Ready(&BaseContextType) < 0) return; diff --git a/setup.py b/setup.py index cae23c7..d824690 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ import ez_setup ez_setup.use_setuptools() from distutils.command.build_ext import build_ext -from distutils.errors import CCompilerError +from distutils.errors import CCompilerError, DistutilsError from setuptools import setup, Extension, Feature from inspect import getdoc @@ -22,8 +22,17 @@ def list_files(path): class optional_build_ext(build_ext): + def run(self): + try: + build_ext.run(self) + except DistutilsError, e: + self.compiler = None + self._setup_error = e + def build_extension(self, ext): try: + if self.compiler is None: + raise self._setup_error build_ext.build_extension(self, ext) except CCompilerError, e: print '=' * 79 -- 2.26.2