Skip to content

Commit

Permalink
Merge pull request #1456 from robertwb/distutils
Browse files Browse the repository at this point in the history
Replace old build_ext with new cythonize(...) version.
  • Loading branch information
scoder committed Sep 10, 2016
2 parents ae7b046 + 87e7212 commit 849d829
Show file tree
Hide file tree
Showing 8 changed files with 375 additions and 367 deletions.
4 changes: 3 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ Other changes
the current jupyter kernel. The language level can be set explicitly with
"%%cython -2" or "%%cython -3".

* Usage of ``Cython.Distutils.build_ext`` is now discouraged.
* The distutils extension ``Cython.Distutils.build_ext`` has now been updated
to use cythonize which properly handles dependencies. The old extension can
still be found in ``Cython.Distutils.old_build_ext`` and is now deprecated.


0.24.1 (2016-07-15)
Expand Down
5 changes: 4 additions & 1 deletion Cython/Build/Dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import cython
from .. import __version__

import collections
import re, os, sys, time
from glob import iglob

Expand Down Expand Up @@ -642,7 +643,9 @@ def create_extension_list(patterns, exclude=None, ctx=None, aliases=None, quiet=
print('Please put "# distutils: language=%s" in your .pyx or .pxd file(s)' % language)
if exclude is None:
exclude = []
if not isinstance(patterns, (list, tuple)):
if patterns is None:
return [], {}
elif isinstance(patterns, basestring) or not isinstance(patterns, collections.Iterable):
patterns = [patterns]
explicit_modules = set([m.name for m in patterns if isinstance(m, Extension)])
seen = set()
Expand Down
14 changes: 1 addition & 13 deletions Cython/Build/Distutils.py
Original file line number Diff line number Diff line change
@@ -1,13 +1 @@
import sys
from .Dependencies import cythonize

if 'setuptools' in sys.modules:
from setuptools.command import build_ext as _build_ext
else:
from distutils.command import build_ext as _build_ext

class build_ext(_build_ext.build_ext, object):
def finalize_options(self):
self.distribution.ext_modules[:] = cythonize(
self.distribution.ext_modules)
super(build_ext, self).finalize_options()
from Cython.Distutils.build_ext import build_ext
6 changes: 1 addition & 5 deletions Cython/Debugger/Tests/TestLibCython.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import runtests
import Cython.Distutils.extension
import Cython.Distutils.build_ext
import Cython.Distutils.old_build_ext as build_ext
from Cython.Debugger import Cygdb as cygdb

root = os.path.dirname(os.path.abspath(__file__))
Expand All @@ -24,10 +24,6 @@
with open(codefile) as f:
source_to_lineno = dict((line.strip(), i + 1) for i, line in enumerate(f))

# Cython.Distutils.__init__ imports build_ext from build_ext which means we
# can't access the module anymore. Get it from sys.modules instead.
build_ext = sys.modules['Cython.Distutils.build_ext']


have_gdb = None
def test_gdb():
Expand Down

0 comments on commit 849d829

Please sign in to comment.