Commit be8e9ced authored by Stefan Behnel's avatar Stefan Behnel

Remove support and special handling code for Py3.2.

parent 51cc426a
...@@ -11,7 +11,6 @@ python: ...@@ -11,7 +11,6 @@ python:
- 2.7 - 2.7
- 3.6 - 3.6
- 2.6 - 2.6
- 3.2
- 3.3 - 3.3
- 3.4 - 3.4
- 3.5 - 3.5
...@@ -52,7 +51,6 @@ matrix: ...@@ -52,7 +51,6 @@ matrix:
allow_failures: allow_failures:
- python: pypy - python: pypy
- python: pypy3 - python: pypy3
- python: 3.2
- python: 3.6-dev - python: 3.6-dev
- python: 3.7-dev - python: 3.7-dev
exclude: exclude:
......
lib2to3.fixes.fix_unicode
...@@ -50,6 +50,11 @@ Bugs fixed ...@@ -50,6 +50,11 @@ Bugs fixed
* abs(signed int) now returns a signed rather than unsigned int. * abs(signed int) now returns a signed rather than unsigned int.
(Github issue #1837) (Github issue #1837)
Other changes
-------------
* This release no longer supports Python 3.2.
0.26.1 (2017-??-??) 0.26.1 (2017-??-??)
=================== ===================
......
...@@ -619,8 +619,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -619,8 +619,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code.putln(" #error Python headers needed to compile C extensions, " code.putln(" #error Python headers needed to compile C extensions, "
"please install development version of Python.") "please install development version of Python.")
code.putln("#elif PY_VERSION_HEX < 0x02060000 || " code.putln("#elif PY_VERSION_HEX < 0x02060000 || "
"(0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)") "(0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)")
code.putln(" #error Cython requires Python 2.6+ or Python 3.2+.") code.putln(" #error Cython requires Python 2.6+ or Python 3.3+.")
code.putln("#else") code.putln("#else")
code.globalstate["end"].putln("#endif /* Py_PYTHON_H */") code.globalstate["end"].putln("#endif /* Py_PYTHON_H */")
......
...@@ -1127,7 +1127,7 @@ static void __Pyx_Coroutine_del(PyObject *self) { ...@@ -1127,7 +1127,7 @@ static void __Pyx_Coroutine_del(PyObject *self) {
{ {
// untrack dead object as we are executing Python code (which might trigger GC) // untrack dead object as we are executing Python code (which might trigger GC)
PyObject_GC_UnTrack(self); PyObject_GC_UnTrack(self);
#if PY_VERSION_HEX >= 0x03030000 || defined(PyErr_WarnFormat) #if PY_MAJOR_VERSION >= 3 /* PY_VERSION_HEX >= 0x03030000*/ || defined(PyErr_WarnFormat)
if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0)) if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0))
PyErr_WriteUnraisable(self); PyErr_WriteUnraisable(self);
#else #else
...@@ -1139,35 +1139,15 @@ static void __Pyx_Coroutine_del(PyObject *self) { ...@@ -1139,35 +1139,15 @@ static void __Pyx_Coroutine_del(PyObject *self) {
#else #else
char *cname; char *cname;
PyObject *qualname; PyObject *qualname;
#if PY_MAJOR_VERSION >= 3
qualname = PyUnicode_AsUTF8String(gen->gi_qualname);
if (likely(qualname)) {
cname = PyBytes_AS_STRING(qualname);
} else {
PyErr_Clear();
cname = (char*) "?";
}
msg = PyBytes_FromFormat(
#else
qualname = gen->gi_qualname; qualname = gen->gi_qualname;
cname = PyString_AS_STRING(qualname); cname = PyString_AS_STRING(qualname);
msg = PyString_FromFormat( msg = PyString_FromFormat("coroutine '%.50s' was never awaited", cname);
#endif
"coroutine '%.50s' was never awaited", cname);
#if PY_MAJOR_VERSION >= 3
Py_XDECREF(qualname);
#endif
if (unlikely(!msg)) { if (unlikely(!msg)) {
PyErr_Clear(); PyErr_Clear();
cmsg = (char*) "coroutine was never awaited"; cmsg = (char*) "coroutine was never awaited";
} else { } else {
#if PY_MAJOR_VERSION >= 3
cmsg = PyBytes_AS_STRING(msg);
#else
cmsg = PyString_AS_STRING(msg); cmsg = PyString_AS_STRING(msg);
#endif
} }
#endif #endif
if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, cmsg, 1) < 0)) if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, cmsg, 1) < 0))
...@@ -1827,11 +1807,11 @@ static int __Pyx_patch_abc(void) { ...@@ -1827,11 +1807,11 @@ static int __Pyx_patch_abc(void) {
static int abc_patched = 0; static int abc_patched = 0;
if (CYTHON_REGISTER_ABCS && !abc_patched) { if (CYTHON_REGISTER_ABCS && !abc_patched) {
PyObject *module; PyObject *module;
module = PyImport_ImportModule((PY_VERSION_HEX >= 0x03030000) ? "collections.abc" : "collections"); module = PyImport_ImportModule((PY_MAJOR_VERSION >= 3) ? "collections.abc" : "collections");
if (!module) { if (!module) {
PyErr_WriteUnraisable(NULL); PyErr_WriteUnraisable(NULL);
if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning,
((PY_VERSION_HEX >= 0x03030000) ? ((PY_MAJOR_VERSION >= 3) ?
"Cython module failed to register with collections.abc module" : "Cython module failed to register with collections.abc module" :
"Cython module failed to register with collections module"), 1) < 0)) { "Cython module failed to register with collections module"), 1) < 0)) {
return -1; return -1;
......
...@@ -257,11 +257,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject ...@@ -257,11 +257,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject
goto bad; goto bad;
} }
#if PY_VERSION_HEX >= 0x03030000
if (cause) { if (cause) {
#else
if (cause && cause != Py_None) {
#endif
PyObject *fixed_cause; PyObject *fixed_cause;
if (cause == Py_None) { if (cause == Py_None) {
// raise ... from None // raise ... from None
......
...@@ -23,7 +23,7 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { ...@@ -23,7 +23,7 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
PyObject *global_dict = 0; PyObject *global_dict = 0;
PyObject *empty_dict = 0; PyObject *empty_dict = 0;
PyObject *list; PyObject *list;
#if PY_VERSION_HEX < 0x03030000 #if PY_MAJOR_VERSION < 3
PyObject *py_import; PyObject *py_import;
py_import = __Pyx_PyObject_GetAttrStr($builtins_cname, PYIDENT("__import__")); py_import = __Pyx_PyObject_GetAttrStr($builtins_cname, PYIDENT("__import__"));
if (!py_import) if (!py_import)
...@@ -48,17 +48,8 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { ...@@ -48,17 +48,8 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
if (level == -1) { if (level == -1) {
if (strchr(__Pyx_MODULE_NAME, '.')) { if (strchr(__Pyx_MODULE_NAME, '.')) {
/* try package relative import first */ /* try package relative import first */
#if PY_VERSION_HEX < 0x03030000
PyObject *py_level = PyInt_FromLong(1);
if (!py_level)
goto bad;
module = PyObject_CallFunctionObjArgs(py_import,
name, global_dict, empty_dict, list, py_level, NULL);
Py_DECREF(py_level);
#else
module = PyImport_ImportModuleLevelObject( module = PyImport_ImportModuleLevelObject(
name, global_dict, empty_dict, list, 1); name, global_dict, empty_dict, list, 1);
#endif
if (!module) { if (!module) {
if (!PyErr_ExceptionMatches(PyExc_ImportError)) if (!PyErr_ExceptionMatches(PyExc_ImportError))
goto bad; goto bad;
...@@ -69,7 +60,7 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { ...@@ -69,7 +60,7 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
} }
#endif #endif
if (!module) { if (!module) {
#if PY_VERSION_HEX < 0x03030000 #if PY_MAJOR_VERSION < 3
PyObject *py_level = PyInt_FromLong(level); PyObject *py_level = PyInt_FromLong(level);
if (!py_level) if (!py_level)
goto bad; goto bad;
...@@ -83,7 +74,7 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { ...@@ -83,7 +74,7 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
} }
} }
bad: bad:
#if PY_VERSION_HEX < 0x03030000 #if PY_MAJOR_VERSION < 3
Py_XDECREF(py_import); Py_XDECREF(py_import);
#endif #endif
Py_XDECREF(empty_list); Py_XDECREF(empty_list);
...@@ -259,7 +250,8 @@ bad: ...@@ -259,7 +250,8 @@ bad:
/////////////// SetPackagePathFromImportLib.proto /////////////// /////////////// SetPackagePathFromImportLib.proto ///////////////
#if PY_VERSION_HEX >= 0x03030000 // PY_VERSION_HEX >= 0x03030000
#if PY_MAJOR_VERSION >= 3 && !CYTHON_PEP489_MULTI_PHASE_INIT
static int __Pyx_SetPackagePathFromImportLib(const char* parent_package_name, PyObject *module_name); static int __Pyx_SetPackagePathFromImportLib(const char* parent_package_name, PyObject *module_name);
#else #else
#define __Pyx_SetPackagePathFromImportLib(a, b) 0 #define __Pyx_SetPackagePathFromImportLib(a, b) 0
...@@ -269,7 +261,8 @@ static int __Pyx_SetPackagePathFromImportLib(const char* parent_package_name, Py ...@@ -269,7 +261,8 @@ static int __Pyx_SetPackagePathFromImportLib(const char* parent_package_name, Py
//@requires: ObjectHandling.c::PyObjectGetAttrStr //@requires: ObjectHandling.c::PyObjectGetAttrStr
//@substitute: naming //@substitute: naming
#if PY_VERSION_HEX >= 0x03030000 // PY_VERSION_HEX >= 0x03030000
#if PY_MAJOR_VERSION >= 3 && !CYTHON_PEP489_MULTI_PHASE_INIT
static int __Pyx_SetPackagePathFromImportLib(const char* parent_package_name, PyObject *module_name) { static int __Pyx_SetPackagePathFromImportLib(const char* parent_package_name, PyObject *module_name) {
PyObject *importlib, *loader, *osmod, *ossep, *parts, *package_path; PyObject *importlib, *loader, *osmod, *ossep, *parts, *package_path;
PyObject *path = NULL, *file_path = NULL; PyObject *path = NULL, *file_path = NULL;
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#ifndef HAVE_LONG_LONG #ifndef HAVE_LONG_LONG
// CPython has required PY_LONG_LONG support for years, even if HAVE_LONG_LONG is not defined for us // CPython has required PY_LONG_LONG support for years, even if HAVE_LONG_LONG is not defined for us
#if PY_VERSION_HEX >= 0x03030000 || (PY_MAJOR_VERSION == 2 && PY_VERSION_HEX >= 0x02070000) #if PY_VERSION_HEX >= 0x02070000
#define HAVE_LONG_LONG #define HAVE_LONG_LONG
#endif #endif
#endif #endif
......
...@@ -833,7 +833,7 @@ static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_co ...@@ -833,7 +833,7 @@ static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_co
if (!CYTHON_PEP393_ENABLED || ukind == result_ukind) { if (!CYTHON_PEP393_ENABLED || ukind == result_ukind) {
memcpy((char *)result_udata + char_pos * result_ukind, udata, ulength * result_ukind); memcpy((char *)result_udata + char_pos * result_ukind, udata, ulength * result_ukind);
} else { } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030300F0 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030300F0 || defined(_PyUnicode_FastCopyCharacters)
_PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength); _PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength);
#else #else
Py_ssize_t j; Py_ssize_t j;
......
...@@ -205,7 +205,7 @@ static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) { ...@@ -205,7 +205,7 @@ static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
} }
#if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) #if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
#if PY_VERSION_HEX < 0x03030000 #if !CYTHON_PEP393_ENABLED
static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
char* defenc_c; char* defenc_c;
// borrowed reference, cached internally in 'o' by CPython // borrowed reference, cached internally in 'o' by CPython
...@@ -229,7 +229,7 @@ static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *leng ...@@ -229,7 +229,7 @@ static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *leng
return defenc_c; return defenc_c;
} }
#else /* PY_VERSION_HEX < 0x03030000 */ #else /* CYTHON_PEP393_ENABLED: */
static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
...@@ -247,7 +247,7 @@ static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py ...@@ -247,7 +247,7 @@ static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py
return PyUnicode_AsUTF8AndSize(o, length); return PyUnicode_AsUTF8AndSize(o, length);
#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */ #endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
} }
#endif /* PY_VERSION_HEX < 0x03030000 */ #endif /* CYTHON_PEP393_ENABLED */
#endif #endif
// Py3.7 returns a "const char*" for unicode strings // Py3.7 returns a "const char*" for unicode strings
......
...@@ -315,10 +315,6 @@ EXT_EXTRAS = { ...@@ -315,10 +315,6 @@ EXT_EXTRAS = {
} }
def _is_py3_before_32(excluded, version):
return version[0] >= 3 and version < (3,2)
# TODO: use tags # TODO: use tags
VER_DEP_MODULES = { VER_DEP_MODULES = {
# tests are excluded if 'CurrentPythonVersion OP VersionTuple', i.e. # tests are excluded if 'CurrentPythonVersion OP VersionTuple', i.e.
...@@ -341,8 +337,6 @@ VER_DEP_MODULES = { ...@@ -341,8 +337,6 @@ VER_DEP_MODULES = {
'compile.extdelslice', 'compile.extdelslice',
'run.special_methods_T561_py2' 'run.special_methods_T561_py2'
]), ]),
(3,1): (_is_py3_before_32, lambda x: x in ['run.pyclass_special_methods',
]),
(3,3) : (operator.lt, lambda x: x in ['build.package_compilation', (3,3) : (operator.lt, lambda x: x in ['build.package_compilation',
'run.yield_from_py33', 'run.yield_from_py33',
]), ]),
...@@ -1343,7 +1337,7 @@ class CythonPyregrTestCase(CythonRunTestCase): ...@@ -1343,7 +1337,7 @@ class CythonPyregrTestCase(CythonRunTestCase):
run_forked_test(result, run_test, self.shortDescription(), self.fork) run_forked_test(result, run_test, self.shortDescription(), self.fork)
include_debugger = IS_CPYTHON and sys.version_info[:2] > (2, 5) include_debugger = IS_CPYTHON
def collect_unittests(path, module_prefix, suite, selectors, exclude_selectors): def collect_unittests(path, module_prefix, suite, selectors, exclude_selectors):
...@@ -1868,21 +1862,6 @@ def main(): ...@@ -1868,21 +1862,6 @@ def main():
if options.with_cython and sys.version_info[0] >= 3: if options.with_cython and sys.version_info[0] >= 3:
sys.path.insert(0, options.cython_dir) sys.path.insert(0, options.cython_dir)
if sys.version_info[:2] == (3, 2):
try:
# try if Cython is installed in a Py3 version
import Cython.Compiler.Main
except Exception:
# back out anything the import process loaded, then
# 2to3 the Cython sources to make them re-importable
cy_modules = [ name for name in sys.modules
if name == 'Cython' or name.startswith('Cython.') ]
for name in cy_modules:
del sys.modules[name]
# hasn't been refactored yet - do it now
global CY3_DIR
CY3_DIR = cy3_dir = os.path.join(WORKDIR, 'Cy3')
refactor_for_py3(DISTDIR, cy3_dir)
if options.watermark: if options.watermark:
import Cython.Compiler.Version import Cython.Compiler.Version
...@@ -2074,9 +2053,6 @@ def runtests(options, cmd_args, coverage=None): ...@@ -2074,9 +2053,6 @@ def runtests(options, cmd_args, coverage=None):
for bugs_file_name, condition in bug_files if condition for bugs_file_name, condition in bug_files if condition
] ]
if sys.platform in ['win32', 'cygwin'] and sys.version_info < (2,6):
exclude_selectors += [ lambda x: x == "run.specialfloat" ]
global COMPILER global COMPILER
if options.compiler: if options.compiler:
COMPILER = options.compiler COMPILER = options.compiler
......
...@@ -34,16 +34,6 @@ class sdist(sdist_orig): ...@@ -34,16 +34,6 @@ class sdist(sdist_orig):
sdist_orig.run(self) sdist_orig.run(self)
add_command_class('sdist', sdist) add_command_class('sdist', sdist)
if sys.version_info[:2] == (3, 2):
import lib2to3.refactor
from distutils.command.build_py \
import build_py_2to3 as build_py
# need to convert sources to Py3 on installation
with open('2to3-fixers.txt') as f:
fixers = [line.strip() for line in f if line.strip()]
build_py.fixer_names = fixers
add_command_class("build_py", build_py)
pxd_include_dirs = [ pxd_include_dirs = [
directory for directory, dirs, files directory for directory, dirs, files
in os.walk(os.path.join('Cython', 'Includes')) in os.walk(os.path.join('Cython', 'Includes'))
...@@ -61,15 +51,13 @@ setup_args['package_data'] = { ...@@ -61,15 +51,13 @@ setup_args['package_data'] = {
'Cython.Runtime' : ['*.pyx', '*.pxd'], 'Cython.Runtime' : ['*.pyx', '*.pxd'],
'Cython.Utility' : ['*.pyx', '*.pxd', '*.c', '*.h', '*.cpp'], 'Cython.Utility' : ['*.pyx', '*.pxd', '*.c', '*.h', '*.cpp'],
'Cython' : [ p[7:] for p in pxd_include_patterns ], 'Cython' : [ p[7:] for p in pxd_include_patterns ],
} 'Cython.Debugger.Tests': ['codefile', 'cfuncs.c'],
}
# This dict is used for passing extra arguments that are setuptools # This dict is used for passing extra arguments that are setuptools
# specific to setup # specific to setup
setuptools_extra_args = {} setuptools_extra_args = {}
# tells whether to include cygdb (the script and the Cython.Debugger package
include_debugger = sys.version_info[:2] > (2, 5)
if 'setuptools' in sys.modules: if 'setuptools' in sys.modules:
setuptools_extra_args['zip_safe'] = False setuptools_extra_args['zip_safe'] = False
setuptools_extra_args['entry_points'] = { setuptools_extra_args['entry_points'] = {
...@@ -85,15 +73,14 @@ else: ...@@ -85,15 +73,14 @@ else:
else: else:
scripts = ["cython.py", "cythonize.py"] scripts = ["cython.py", "cythonize.py"]
if include_debugger: if 'setuptools' in sys.modules:
if 'setuptools' in sys.modules: setuptools_extra_args['entry_points']['console_scripts'].append(
setuptools_extra_args['entry_points']['console_scripts'].append( 'cygdb = Cython.Debugger.Cygdb:main')
'cygdb = Cython.Debugger.Cygdb:main') else:
if os.name == "posix":
scripts.append('bin/cygdb')
else: else:
if os.name == "posix": scripts.append('cygdb.py')
scripts.append('bin/cygdb')
else:
scripts.append('cygdb.py')
def compile_cython_modules(profile=False, compile_more=False, cython_with_refnanny=False): def compile_cython_modules(profile=False, compile_more=False, cython_with_refnanny=False):
...@@ -169,61 +156,17 @@ def compile_cython_modules(profile=False, compile_more=False, cython_with_refnan ...@@ -169,61 +156,17 @@ def compile_cython_modules(profile=False, compile_more=False, cython_with_refnan
# XXX hack around setuptools quirk for '*.pyx' sources # XXX hack around setuptools quirk for '*.pyx' sources
extensions[-1].sources[0] = pyx_source_file extensions[-1].sources[0] = pyx_source_file
if sys.version_info[:2] == (3, 2): from Cython.Distutils import build_ext
# Python 3.2: can only run Cython *after* running 2to3 if profile:
build_ext = _defer_cython_import_in_py32(source_root, profile) from Cython.Compiler.Options import get_directive_defaults
else: get_directive_defaults()['profile'] = True
from Cython.Distutils import build_ext sys.stderr.write("Enabled profiling for the Cython binary modules\n")
if profile:
from Cython.Compiler.Options import get_directive_defaults
get_directive_defaults()['profile'] = True
sys.stderr.write("Enabled profiling for the Cython binary modules\n")
# not using cythonize() here to let distutils decide whether building extensions was requested # not using cythonize() here to let distutils decide whether building extensions was requested
add_command_class("build_ext", build_ext) add_command_class("build_ext", build_ext)
setup_args['ext_modules'] = extensions setup_args['ext_modules'] = extensions
def _defer_cython_import_in_py32(source_root, profile=False):
# Python 3.2: can only run Cython *after* running 2to3
# => re-import Cython inside of build_ext
from distutils.command.build_ext import build_ext as build_ext_orig
class build_ext(build_ext_orig):
# we must keep the original modules alive to make sure
# their code keeps working when we remove them from
# sys.modules
dead_modules = []
def __reimport(self):
if self.dead_modules:
return
# add path where 2to3 installed the transformed sources
# and make sure Python (re-)imports them from there
already_imported = [
module for module in sys.modules
if module == 'Cython' or module.startswith('Cython.')
]
keep_alive = self.dead_modules.append
for module in already_imported:
keep_alive(sys.modules[module])
del sys.modules[module]
sys.path.insert(0, os.path.join(source_root, self.build_lib))
def build_extensions(self):
self.__reimport()
if profile:
from Cython.Compiler.Options import directive_defaults
directive_defaults['profile'] = True
print("Enabled profiling for the Cython binary modules")
from Cython.Build.Dependencies import cythonize
self.distribution.ext_modules[:] = cythonize(
self.distribution.ext_modules)
build_ext_orig.build_extensions(self)
return build_ext
cython_profile = '--cython-profile' in sys.argv cython_profile = '--cython-profile' in sys.argv
if cython_profile: if cython_profile:
sys.argv.remove('--cython-profile') sys.argv.remove('--cython-profile')
...@@ -271,6 +214,8 @@ packages = [ ...@@ -271,6 +214,8 @@ packages = [
'Cython.Compiler', 'Cython.Compiler',
'Cython.Runtime', 'Cython.Runtime',
'Cython.Distutils', 'Cython.Distutils',
'Cython.Debugger',
'Cython.Debugger.Tests',
'Cython.Plex', 'Cython.Plex',
'Cython.Tests', 'Cython.Tests',
'Cython.Build.Tests', 'Cython.Build.Tests',
...@@ -280,12 +225,6 @@ packages = [ ...@@ -280,12 +225,6 @@ packages = [
'pyximport', 'pyximport',
] ]
if include_debugger:
packages.append('Cython.Debugger')
packages.append('Cython.Debugger.Tests')
# it's enough to do this for Py2.5+:
setup_args['package_data']['Cython.Debugger.Tests'] = ['codefile', 'cfuncs.c']
setup( setup(
name='Cython', name='Cython',
version=version, version=version,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment