mirror of
https://gitee.com/openharmony/third_party_jinja2
synced 2024-11-23 23:29:58 +00:00
Trash debugsupport.
This commit is contained in:
parent
460251c9ed
commit
447d3d2799
@ -14,16 +14,6 @@ Prerequisites
|
||||
|
||||
Jinja2 works with Python 2.6.x, 2.7.x and >= 3.3.
|
||||
|
||||
FIXME - this is outdated, code should get removed, docs fixed:
|
||||
Additionally a working C-compiler that can create python extensions should be
|
||||
installed for the debugger if you are using Python 2.4.
|
||||
|
||||
If you don't have a working C-compiler and you are trying to install the source
|
||||
release with the debugsupport you will get a compiler error.
|
||||
|
||||
.. _ctypes: http://python.net/crew/theller/ctypes/
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
@ -94,20 +84,6 @@ using Jinja2 with autoescaping.
|
||||
.. _MarkupSafe: http://pypi.python.org/pypi/MarkupSafe
|
||||
|
||||
|
||||
Enable the debug support Module
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
By default Jinja2 will not compile the debug support module. Enabling this
|
||||
will fail if you don't have the Python headers or a working compiler. This
|
||||
is often the case if you are installing Jinja2 from a windows machine.
|
||||
|
||||
FIXME - outdated:
|
||||
Because the debug support is only necessary for Python 2.4 you will not
|
||||
have to do this unless you run 2.4::
|
||||
|
||||
sudo python setup.py --with-debugsupport install
|
||||
|
||||
|
||||
Basic API Usage
|
||||
---------------
|
||||
|
||||
|
@ -1,78 +0,0 @@
|
||||
/**
|
||||
* jinja2._debugsupport
|
||||
* ~~~~~~~~~~~~~~~~~~~~
|
||||
*
|
||||
* C implementation of `tb_set_next`.
|
||||
*
|
||||
* :copyright: (c) 2010 by the Jinja Team.
|
||||
* :license: BSD.
|
||||
*/
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
|
||||
static PyObject*
|
||||
tb_set_next(PyObject *self, PyObject *args)
|
||||
{
|
||||
PyTracebackObject *tb, *old;
|
||||
PyObject *next;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "O!O:tb_set_next", &PyTraceBack_Type, &tb, &next))
|
||||
return NULL;
|
||||
if (next == Py_None)
|
||||
next = NULL;
|
||||
else if (!PyTraceBack_Check(next)) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"tb_set_next arg 2 must be traceback or None");
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
Py_INCREF(next);
|
||||
|
||||
old = tb->tb_next;
|
||||
tb->tb_next = (PyTracebackObject*)next;
|
||||
Py_XDECREF(old);
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
static PyMethodDef module_methods[] = {
|
||||
{"tb_set_next", (PyCFunction)tb_set_next, METH_VARARGS,
|
||||
"Set the tb_next member of a traceback object."},
|
||||
{NULL, NULL, 0, NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
|
||||
#ifndef PyMODINIT_FUNC /* declarations for DLL import/export */
|
||||
#define PyMODINIT_FUNC void
|
||||
#endif
|
||||
PyMODINIT_FUNC
|
||||
init_debugsupport(void)
|
||||
{
|
||||
Py_InitModule3("jinja2._debugsupport", module_methods, "");
|
||||
}
|
||||
|
||||
#else /* Python 3.x module initialization */
|
||||
|
||||
static struct PyModuleDef module_definition = {
|
||||
PyModuleDef_HEAD_INIT,
|
||||
"jinja2._debugsupport",
|
||||
NULL,
|
||||
-1,
|
||||
module_methods,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
PyMODINIT_FUNC
|
||||
PyInit__debugsupport(void)
|
||||
{
|
||||
return PyModule_Create(&module_definition);
|
||||
}
|
||||
|
||||
#endif
|
@ -331,10 +331,7 @@ def _init_ugly_crap():
|
||||
tb_set_next = None
|
||||
if tproxy is None:
|
||||
try:
|
||||
from jinja2._debugsupport import tb_set_next
|
||||
except ImportError:
|
||||
try:
|
||||
tb_set_next = _init_ugly_crap()
|
||||
except:
|
||||
pass
|
||||
tb_set_next = _init_ugly_crap()
|
||||
except:
|
||||
pass
|
||||
del _init_ugly_crap
|
||||
|
18
setup.py
18
setup.py
@ -37,15 +37,7 @@ For more informations visit the new `Jinja2 webpage`_ and `documentation`_.
|
||||
"""
|
||||
import sys
|
||||
|
||||
from setuptools import setup, Extension, Feature
|
||||
|
||||
debugsupport = Feature(
|
||||
'optional C debug support',
|
||||
standard=False,
|
||||
ext_modules = [
|
||||
Extension('jinja2._debugsupport', ['jinja2/_debugsupport.c']),
|
||||
],
|
||||
)
|
||||
from setuptools import setup
|
||||
|
||||
|
||||
# ignore the old '--with-speedups' flag
|
||||
@ -54,11 +46,10 @@ try:
|
||||
except ValueError:
|
||||
pass
|
||||
else:
|
||||
sys.argv[speedups_pos] = '--with-debugsupport'
|
||||
sys.argv[speedups_pos] = ''
|
||||
sys.stderr.write('*' * 74 + '\n')
|
||||
sys.stderr.write('WARNING:\n')
|
||||
sys.stderr.write(' the --with-speedups flag is deprecated, assuming '
|
||||
'--with-debugsupport\n')
|
||||
sys.stderr.write(' the --with-speedups flag is deprecated\n')
|
||||
sys.stderr.write(' For the actual speedups install the MarkupSafe '
|
||||
'package.\n')
|
||||
sys.stderr.write('*' * 74 + '\n')
|
||||
@ -97,6 +88,5 @@ setup(
|
||||
entry_points="""
|
||||
[babel.extractors]
|
||||
jinja2 = jinja2.ext:babel_extract[i18n]
|
||||
""",
|
||||
features={'debugsupport': debugsupport}
|
||||
"""
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user