diff options
author | Armin Ronacher <armin.ronacher@active-4.com> | 2011-07-20 09:51:43 +0200 |
---|---|---|
committer | Armin Ronacher <armin.ronacher@active-4.com> | 2011-07-20 09:51:43 +0200 |
commit | 515ec279a31168272c9f32d24f11735b69eb3217 (patch) | |
tree | 132fdae8fc89a5ff4a0807b8e998aee048d01551 | |
parent | 178f60584374bfc10ac257c74bcc2c36dffff7c9 (diff) | |
download | markupsafe-515ec279a31168272c9f32d24f11735b69eb3217.tar.gz |
Do not attempt to compile extensions for pypy and jython. This fixes #40.13
-rw-r--r-- | CHANGES | 6 | ||||
-rw-r--r-- | markupsafe/_speedups.c | 4 | ||||
-rw-r--r-- | setup.py | 41 |
3 files changed, 34 insertions, 17 deletions
@@ -1,6 +1,12 @@ MarkupSafe Changelog ==================== +Version 0.13 +------------ + +- Do not attempt to compile extension for PyPy or Jython. +- Work around some 64bit Windows issues. + Version 0.12 ------------ diff --git a/markupsafe/_speedups.c b/markupsafe/_speedups.c index 2a09b42..f349feb 100644 --- a/markupsafe/_speedups.c +++ b/markupsafe/_speedups.c @@ -64,9 +64,9 @@ escape_unicode(PyUnicodeObject *in) /* First we need to figure out how long the escaped string will be */ while (*(inp) || inp < inp_end) { - if (*inp < ESCAPED_CHARS_TABLE_SIZE && escaped_chars_delta_len[*inp]) { + if (*inp < ESCAPED_CHARS_TABLE_SIZE) { delta += escaped_chars_delta_len[*inp]; - ++erepl; + erepl += !!escaped_chars_delta_len[*inp]; } ++inp; } @@ -9,6 +9,9 @@ from distutils.errors import CCompilerError, DistutilsExecError, \ # fail safe compilation shamelessly stolen from the simplejson # setup.py file. Original author: Bob Ippolito +is_jython = 'java' in sys.platform +is_pypy = hasattr(sys, 'pypy_version_info') + speedups = Feature( 'optional C speed-enhancement module', @@ -92,21 +95,29 @@ def run_setup(with_binary): ) -try: - run_setup(True) -except BuildFailed: - LINE = '=' * 74 - BUILD_EXT_WARNING = 'WARNING: The C extension could not be compiled, speedups are not enabled.' +def try_building_extension(): + try: + run_setup(True) + except BuildFailed: + LINE = '=' * 74 + BUILD_EXT_WARNING = 'WARNING: The C extension could not be ' \ + 'compiled, speedups are not enabled.' + + echo(LINE) + echo(BUILD_EXT_WARNING) + echo('Failure information, if any, is above.') + echo('Retrying the build without the C extension now.') + echo() + + run_setup(False) - echo(LINE) - echo(BUILD_EXT_WARNING) - echo('Failure information, if any, is above.') - echo('Retrying the build without the C extension now.') - echo() + echo(LINE) + echo(BUILD_EXT_WARNING) + echo('Plain-Python installation succeeded.') + echo(LINE) - run_setup(False) - echo(LINE) - echo(BUILD_EXT_WARNING) - echo('Plain-Python installation succeeded.') - echo(LINE) +if not (is_pypy or is_jython): + try_building_extension() +else: + run_setpu(False) |