Permalink
Browse files

Do not attempt to compile extensions for pypy and jython. This fixes #4

  • Loading branch information...
1 parent 178f605 commit 515ec279a31168272c9f32d24f11735b69eb3217 @mitsuhiko mitsuhiko committed Jul 20, 2011
Showing with 34 additions and 17 deletions.
  1. +6 −0 CHANGES
  2. +2 −2 markupsafe/_speedups.c
  3. +26 −15 setup.py
View
@@ -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
------------
View
@@ -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;
}
View
@@ -9,6 +9,9 @@
# 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)
@mcdonc

mcdonc Jul 20, 2011

run_setpu? you sure you don't need tox? ;-)

@mitsuhiko

mitsuhiko Jul 20, 2011

Owner

Aww. I would use tox, but it always screws up things here ;(

0 comments on commit 515ec27

Please sign in to comment.