Skip to content

Commit

Permalink
Do not attempt to compile extensions for pypy and jython. This fixes #4
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuhiko committed Jul 20, 2011
1 parent 178f605 commit 515ec27
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 17 deletions.
6 changes: 6 additions & 0 deletions CHANGES
@@ -1,6 +1,12 @@
MarkupSafe Changelog MarkupSafe Changelog
==================== ====================


Version 0.13
------------

- Do not attempt to compile extension for PyPy or Jython.
- Work around some 64bit Windows issues.

Version 0.12 Version 0.12
------------ ------------


Expand Down
4 changes: 2 additions & 2 deletions markupsafe/_speedups.c
Expand Up @@ -64,9 +64,9 @@ escape_unicode(PyUnicodeObject *in)


/* First we need to figure out how long the escaped string will be */ /* First we need to figure out how long the escaped string will be */
while (*(inp) || inp < inp_end) { 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]; delta += escaped_chars_delta_len[*inp];
++erepl; erepl += !!escaped_chars_delta_len[*inp];
} }
++inp; ++inp;
} }
Expand Down
41 changes: 26 additions & 15 deletions setup.py
Expand Up @@ -9,6 +9,9 @@
# fail safe compilation shamelessly stolen from the simplejson # fail safe compilation shamelessly stolen from the simplejson
# setup.py file. Original author: Bob Ippolito # setup.py file. Original author: Bob Ippolito


is_jython = 'java' in sys.platform
is_pypy = hasattr(sys, 'pypy_version_info')



speedups = Feature( speedups = Feature(
'optional C speed-enhancement module', 'optional C speed-enhancement module',
Expand Down Expand Up @@ -92,21 +95,29 @@ def run_setup(with_binary):
) )




try: def try_building_extension():
run_setup(True) try:
except BuildFailed: run_setup(True)
LINE = '=' * 74 except BuildFailed:
BUILD_EXT_WARNING = 'WARNING: The C extension could not be compiled, speedups are not enabled.' 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(LINE)
echo(BUILD_EXT_WARNING) echo(BUILD_EXT_WARNING)
echo('Failure information, if any, is above.') echo('Plain-Python installation succeeded.')
echo('Retrying the build without the C extension now.') echo(LINE)
echo()


run_setup(False)


echo(LINE) if not (is_pypy or is_jython):
echo(BUILD_EXT_WARNING) try_building_extension()
echo('Plain-Python installation succeeded.') else:
echo(LINE) run_setpu(False)

This comment has been minimized.

Copy link
@mcdonc

mcdonc Jul 20, 2011

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

This comment has been minimized.

Copy link
@mitsuhiko

mitsuhiko Jul 20, 2011

Author Contributor

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

0 comments on commit 515ec27

Please sign in to comment.