Commit c1fc77d5 authored by Stefan Behnel's avatar Stefan Behnel

code cleanup

parent f856a434
...@@ -274,7 +274,7 @@ class DependencyTree(object): ...@@ -274,7 +274,7 @@ class DependencyTree(object):
def find_pxd(self, module, filename=None): def find_pxd(self, module, filename=None):
if module[0] == '.': if module[0] == '.':
raise NotImplementedError, "New relative imports." raise NotImplementedError("New relative imports.")
if filename is not None: if filename is not None:
relative = '.'.join(self.package(filename) + tuple(module.split('.'))) relative = '.'.join(self.package(filename) + tuple(module.split('.')))
pxd = self.context.find_pxd_file(relative, None) pxd = self.context.find_pxd_file(relative, None)
...@@ -291,9 +291,9 @@ class DependencyTree(object): ...@@ -291,9 +291,9 @@ class DependencyTree(object):
a = self.cimports(filename) a = self.cimports(filename)
b = filter(None, [self.find_pxd(m, filename) for m in self.cimports(filename)]) b = filter(None, [self.find_pxd(m, filename) for m in self.cimports(filename)])
if len(a) != len(b): if len(a) != len(b):
print (filename) print(filename)
print ("\n\t".join(a)) print("\n\t".join(a))
print ("\n\t".join(b)) print("\n\t".join(b))
return tuple(self_pxd + filter(None, [self.find_pxd(m, filename) for m in self.cimports(filename)])) return tuple(self_pxd + filter(None, [self.find_pxd(m, filename) for m in self.cimports(filename)]))
cimported_files = cached_method(cimported_files) cimported_files = cached_method(cimported_files)
...@@ -392,7 +392,7 @@ def create_extension_list(patterns, ctx=None, aliases=None): ...@@ -392,7 +392,7 @@ def create_extension_list(patterns, ctx=None, aliases=None):
base = DistutilsInfo(template) base = DistutilsInfo(template)
exn_type = type(template) exn_type = type(template)
else: else:
raise TypeError, pattern raise TypeError(pattern)
for file in glob(filepattern): for file in glob(filepattern):
pkg = deps.package(file) pkg = deps.package(file)
if name == '*': if name == '*':
...@@ -428,7 +428,7 @@ def cythonize(module_list, ctx=None, nthreads=0, aliases=None): ...@@ -428,7 +428,7 @@ def cythonize(module_list, ctx=None, nthreads=0, aliases=None):
dep_timestamp, dep = deps.newest_dependency(source) dep_timestamp, dep = deps.newest_dependency(source)
priority = 2 - (dep in deps.immediate_dependencies(source)) priority = 2 - (dep in deps.immediate_dependencies(source))
if c_timestamp < dep_timestamp: if c_timestamp < dep_timestamp:
print "Compiling", source, "because it depends on", dep print("Compiling %s because it depends on %s" % (source, dep))
to_compile.append((priority, source, c_file)) to_compile.append((priority, source, c_file))
new_sources.append(c_file) new_sources.append(c_file)
else: else:
...@@ -441,7 +441,7 @@ def cythonize(module_list, ctx=None, nthreads=0, aliases=None): ...@@ -441,7 +441,7 @@ def cythonize(module_list, ctx=None, nthreads=0, aliases=None):
try: try:
import multiprocessing import multiprocessing
except ImportError: except ImportError:
print "multiprocessing required for parallel cythonization" print("multiprocessing required for parallel cythonization")
nthreads = 0 nthreads = 0
pool = multiprocessing.Pool(nthreads) pool = multiprocessing.Pool(nthreads)
pool.map(cythonoize_one_helper, to_compile) pool.map(cythonoize_one_helper, to_compile)
...@@ -454,9 +454,9 @@ cython_py = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../cytho ...@@ -454,9 +454,9 @@ cython_py = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../cytho
def cythonoize_one(pyx_file, c_file): def cythonoize_one(pyx_file, c_file):
cmd = "%s %s %s -o %s" % (sys.executable, cython_py, pyx_file, c_file) cmd = "%s %s %s -o %s" % (sys.executable, cython_py, pyx_file, c_file)
print cmd print(cmd)
if os.system(cmd) != 0: if os.system(cmd) != 0:
raise CompilerError, pyx_file raise CompilerError(pyx_file)
def cythonoize_one_helper(m): def cythonoize_one_helper(m):
return cythonoize_one(*m[1:]) return cythonoize_one(*m[1:])
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
Implements a version of the Distutils 'build_ext' command, for Implements a version of the Distutils 'build_ext' command, for
building Cython extension modules.""" building Cython extension modules."""
# This module should be kept compatible with Python 2.1. # This module should be kept compatible with Python 2.3.
__revision__ = "$Id:$" __revision__ = "$Id:$"
......
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