"""
if 'include_path' not in options:
options['include_path'] = ['.']
+ if 'common_utility_include_dir' in options:
+ if not os.path.exists(options['common_utility_include_dir']):
+ os.makedirs(options['common_utility_include_dir'])
c_options = CompilationOptions(**options)
cpp_options = CompilationOptions(**options); cpp_options.cplus = True
ctx = c_options.create_context()
except (EnvironmentError, PyrexError), e:
sys.stderr.write('%s\n' % e)
any_failures = 1
+ # XXX
+ import traceback
+ traceback.print_exc()
except Exception:
if raise_on_failure:
raise
def put_or_include(self, code, name):
include_dir = self.globalstate.common_utility_include_dir
- if include_dir and len(code) > 1042:
+ if include_dir and len(code) > 1024:
include_file = "%s_%s.h" % (
name, hashlib.md5(code).hexdigest())
path = os.path.join(include_dir, include_file)
--- /dev/null
+PYTHON setup.py build_ext --inplace
+PYTHON -c "import runner"
+
+# Verify some files were created.
+ls common/AddTraceback_impl*.h common/RaiseException_impl_*.h
+
+# Verify that they're used.
+grep -c '#include "common/AddTraceback_impl_.*h"' a.c
+grep -c '#include "common/AddTraceback_impl_.*h"' b.c
+grep -c '#include "common/AddTraceback_impl_.*h"' c.c
+
+
+######## setup.py ########
+
+from Cython.Build.Dependencies import cythonize
+
+from distutils.core import setup
+
+setup(
+ ext_modules = cythonize("*.pyx", common_utility_include_dir='common', nthreads=2),
+)
+
+######## a.pyx ########
+
+def generator(n):
+ for k in range(n):
+ yield k
+
+assert list(generator(10)) == list(range(10))
+
+######## b.pyx ########
+
+def generator(n):
+ for k in range(n):
+ yield k
+
+assert list(generator(10)) == list(range(10))
+
+if __name__ == "__main__":
+ print "here", "b"
+
+######## c.pyx ########
+
+if __name__ == "__main__":
+ print "here", "c"
+
+######## runner.py ########
+
+import a, b, c