Enable C extensions on pypy and add pypy3 support

Conflicts:
	tox.ini
This commit is contained in:
John Anderson
2015-06-25 10:59:57 -07:00
committed by Adam Holmberg
parent 376cb0c10c
commit f7c0bd312d
3 changed files with 20 additions and 5 deletions

View File

@@ -20,6 +20,13 @@ typedef int Py_ssize_t;
#define PY_SSIZE_T_MIN INT_MIN
#endif
#ifdef PYPY_VERSION
#define COMPILING_IN_PYPY 1
#define COMPILING_IN_CPYTHON 0
#else
#define COMPILING_IN_PYPY 0
#define COMPILING_IN_CPYTHON 1
#endif
//-----------------------------------------------------------------------------
// Platform-specific functions and macros
@@ -179,7 +186,8 @@ struct module_state {
PyObject *error;
};
#if PY_MAJOR_VERSION >= 3
// pypy3 doesn't have GetState yet.
#if COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#define GETSTATE(m) ((struct module_state*)PyModule_GetState(m))
#else
#define GETSTATE(m) (&_state)

View File

@@ -235,6 +235,7 @@ def run_setup(extensions):
**kw)
is_windows = os.name == 'nt'
if is_windows:
build_extensions.error_message = """
===============================================================================
@@ -291,8 +292,7 @@ The optional C extensions are not supported on big-endian systems.
if extensions:
if (sys.platform.startswith("java")
or sys.platform == "cli"
or "PyPy" in sys.version):
or sys.platform == "cli"):
sys.stderr.write(platform_unsupported_msg)
extensions = ()
elif sys.byteorder == "big":

11
tox.ini
View File

@@ -1,5 +1,5 @@
[tox]
envlist = py{26,27,33,34},pypy
envlist = py{26,27,33,34},pypy,pypy3
[base]
deps = nose
@@ -20,6 +20,13 @@ commands = nosetests --verbosity=2 --no-path-adjustment {toxinidir}/tests/unit/
[testenv:pypy]
deps = {[base]deps}
commands = nosetests --verbosity=2 {toxinidir}/tests/unit/
commands = {envpython} setup.py build_ext --inplace
nosetests --verbosity=2 tests/unit/
[testenv:pypy3]
deps = {[base]deps}
commands = {envpython} setup.py build_ext --inplace
nosetests --verbosity=2 tests/unit/
# cqlengine/test_timestamp.py uses sure, which fails in pypy presently
# could remove sure usage