Permalink
Browse files

Fixing for new distutils

  • Loading branch information...
teoliphant committed Sep 14, 2005
1 parent c5b2e41 commit 14db4193112ecc5930154af860228562132e3b48
Showing with 1,321 additions and 9,600 deletions.
  1. +656 −0 base/code_generators/generate_array_api.py
  2. +185 −0 base/code_generators/generate_ufunc_api.py
  3. +462 −0 base/code_generators/generate_umath.py
  4. +0 −1 distutils/MANIFEST.in
  5. +0 −10 distutils/__init__.py
  6. +0 −128 distutils/absoftfcompiler.py
  7. +0 −332 distutils/ccompiler.py
  8. +0 −30 distutils/command/__init__.py
  9. +0 −5 distutils/command/bdist_rpm.py
  10. +0 −78 distutils/command/build.py
  11. +0 −224 distutils/command/build_clib.py
  12. +0 −377 distutils/command/build_ext.py
  13. +0 −13 distutils/command/build_py.py
  14. +0 −609 distutils/command/build_src.py
  15. +0 −55 distutils/command/config_compiler.py
  16. +0 −102 distutils/command/install.py
  17. +0 −13 distutils/command/install_data.py
  18. +0 −20 distutils/command/install_headers.py
  19. +0 −154 distutils/command/sdist.py
  20. +0 −94 distutils/compaqfcompiler.py
  21. +0 −118 distutils/core.py
  22. +0 −675 distutils/cpuinfo.py
  23. +0 −54 distutils/dist.py
  24. +0 −17 distutils/examples/setup_module_config.py
  25. +0 −11 distutils/examples/setup_module_pure.py
  26. +0 −23 distutils/examples/setup_module_pure_data.py
  27. +0 −27 distutils/examples/setup_module_pure_super.py
  28. +0 −18 distutils/examples/setup_module_svn.py
  29. +0 −645 distutils/exec_command.py
  30. +0 −107 distutils/extension.py
  31. +0 −870 distutils/fcompiler.py
  32. +0 −262 distutils/from_template.py
  33. +0 −41 distutils/g95fcompiler.py
  34. +0 −209 distutils/gnufcompiler.py
  35. +0 −41 distutils/hpuxfcompiler.py
  36. +0 −80 distutils/ibmfcompiler.py
  37. +0 −43 distutils/info_scipy_distutils.py
  38. +0 −174 distutils/intelfcompiler.py
  39. +0 −46 distutils/laheyfcompiler.py
  40. +0 −116 distutils/lib2def.py
  41. +0 −75 distutils/line_endings.py
  42. +0 −100 distutils/log.py
  43. +0 −13 distutils/mingw32_support.py
  44. +0 −213 distutils/mingw32ccompiler.py
  45. +0 −56 distutils/mipsfcompiler.py
  46. +0 −596 distutils/misc_util.py
  47. +0 −39 distutils/nagfcompiler.py
  48. +0 −42 distutils/pgfcompiler.py
  49. +0 −494 distutils/proc.py
  50. +0 −51 distutils/sample_site.cfg
  51. +0 −27 distutils/scipy_distutils_version.py
  52. +0 −16 distutils/setup.py
  53. +0 −40 distutils/setup_scipy_distutils.py
  54. +0 −47 distutils/sunfcompiler.py
  55. +0 −1,517 distutils/system_info.py
  56. 0 distutils/tests/f2py_ext/__init__.py
  57. +0 −12 distutils/tests/f2py_ext/setup.py
  58. +0 −18 distutils/tests/f2py_ext/src/fib1.f
  59. +0 −9 distutils/tests/f2py_ext/src/fib2.pyf
  60. +0 −13 distutils/tests/f2py_ext/tests/test_fib2.py
  61. 0 distutils/tests/f2py_f90_ext/__init__.py
  62. +0 −5 distutils/tests/f2py_f90_ext/include/body.f90
  63. +0 −16 distutils/tests/f2py_f90_ext/setup.py
  64. +0 −6 distutils/tests/f2py_f90_ext/src/foo_free.f90
  65. +0 −13 distutils/tests/f2py_f90_ext/tests/test_foo.py
  66. 0 distutils/tests/gen_ext/__init__.py
  67. +0 −47 distutils/tests/gen_ext/setup.py
  68. +0 −13 distutils/tests/gen_ext/tests/test_fib3.py
  69. 0 distutils/tests/swig_ext/__init__.py
  70. +0 −14 distutils/tests/swig_ext/setup.py
  71. +0 −14 distutils/tests/swig_ext/src/example.c
  72. +0 −11 distutils/tests/swig_ext/src/example.i
  73. +0 −23 distutils/tests/swig_ext/src/zoo.cc
  74. +0 −9 distutils/tests/swig_ext/src/zoo.h
  75. +0 −10 distutils/tests/swig_ext/src/zoo.i
  76. +0 −18 distutils/tests/swig_ext/tests/test_example.py
  77. +0 −17 distutils/tests/swig_ext/tests/test_example2.py
  78. +0 −65 distutils/unixccompiler.py
  79. +0 −51 distutils/vastfcompiler.py
  80. +18 −68 setup.py

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,185 @@
+
+# doc is comment_documentation
+
+# use list so order is preserved.
+ufunc_api_list = [
+ (r"""
+ """,
+ 'FromFuncAndData', 'PyUFuncGenericFunction *, void **, char *, int, int, int, int, char *, char *, int', 'PyObject *'),
+ (r"""
+ """,
+ 'GenericFunction', 'PyUFuncObject *, PyObject *, PyArrayObject **', 'int'),
+
+ (r"""
+ """,
+ 'f_f_As_d_d','char **, intp *, intp *, void *','void'),
+
+ (r"""
+ """,
+ 'd_d','char **, intp *, intp *, void *','void'),
+
+ (r"""
+ """,
+ 'f_f','char **, intp *, intp *, void *','void'),
+
+ (r"""
+ """,
+ 'g_g','char **, intp *, intp *, void *','void'),
+
+ (r"""
+ """,
+ 'F_F_As_D_D','char **, intp *, intp *, void *','void'),
+
+ (r"""
+ """,
+ 'F_F','char **, intp *, intp *, void *','void'),
+
+ (r"""
+ """,
+ 'D_D','char **, intp *, intp *, void *','void'),
+
+ (r"""
+ """,
+ 'G_G','char **, intp *, intp *, void *','void'),
+
+ (r"""
+ """,
+ 'O_O','char **, intp *, intp *, void *','void'),
+
+ (r"""
+ """,
+ 'ff_f_As_dd_d','char **, intp *, intp *, void *','void'),
+
+ (r"""
+ """,
+ 'ff_f','char **, intp *, intp *, void *','void'),
+
+ (r"""
+ """,
+ 'dd_d','char **, intp *, intp *, void *','void'),
+
+ (r"""
+ """,
+ 'gg_g','char **, intp *, intp *, void *','void'),
+
+ (r"""
+ """,
+ 'FF_F_As_DD_D','char **, intp *, intp *, void *','void'),
+
+ (r"""
+ """,
+ 'DD_D','char **, intp *, intp *, void *','void'),
+
+ (r"""
+ """,
+ 'FF_F','char **, intp *, intp *, void *','void'),
+
+ (r"""
+ """,
+ 'GG_G','char **, intp *, intp *, void *','void'),
+
+ (r"""
+ """,
+ 'OO_O','char **, intp *, intp *, void *','void'),
+
+ (r"""
+ """,
+ 'O_O_method','char **, intp *, intp *, void *','void'),
+
+ (r"""
+ """,
+ 'checkfperr', 'int, PyObject *', 'int'),
+
+ (r"""
+ """,
+ 'clearfperr', 'void', 'void')
+
+]
+
+# API fixes for __arrayobject_api.h
+
+fixed = 1
+nummulti = len(ufunc_api_list)
+numtotal = fixed + nummulti
+
+
+module_list = []
+extension_list = []
+init_list = []
+
+#setup object API
+for k, item in enumerate(ufunc_api_list):
+ num = fixed + k
+ astr = "static %s PyUFunc_%s \\\n (%s);" % \
+ (item[3],item[1],item[2])
+ module_list.append(astr)
+ astr = "#define PyUFunc_%s \\\n (*(%s (*)(%s)) \\\n"\
+ " PyUFunc_API[%d])" % (item[1],item[3],item[2],num)
+ extension_list.append(astr)
+ astr = " (void *) PyUFunc_%s," % item[1]
+ init_list.append(astr)
+
+
+outstr = r"""
+#ifdef _UMATHMODULE
+
+static PyTypeObject PyUFunc_Type;
+
+%s
+
+#else
+
+static void **PyUFunc_API;
+
+#define PyUFunc_Type (*(PyTypeObject *)PyUFunc_API[0])
+
+%s
+
+static int
+import_ufunc(void)
+{
+ PyObject *numpy = PyImport_ImportModule("scipy.base.umath");
+ PyObject *c_api = NULL;
+
+ if (numpy == NULL) return -1;
+ c_api = PyObject_GetAttrString(numpy, "_UFUNC_API");
+ if (c_api == NULL) {Py_DECREF(numpy); return -1;}
+ if (PyCObject_Check(c_api)) {
+ PyUFunc_API = (void **)PyCObject_AsVoidPtr(c_api);
+ }
+ Py_DECREF(c_api);
+ Py_DECREF(numpy);
+ if (PyUFunc_API == NULL) return -1;
+ return 0;
+}
+
+#endif
+
+""" % ('\n'.join(module_list),
+ '\n'.join(extension_list))
+
+# Write to header
+fid = open('__ufunc_api.h','w')
+fid.write(outstr)
+fid.close()
+
+
+outstr = r"""
+/* These pointers will be stored in the C-object for use in other
+ extension modules
+*/
+
+void *PyUFunc_API[] = {
+ (void *) &PyUFunc_Type,
+%s
+};
+""" % '\n'.join(init_list)
+
+# Write to c-code
+fid = open('__ufunc_api.c','w')
+fid.write(outstr)
+fid.close()
+
+
+
+
Oops, something went wrong.

0 comments on commit 14db419

Please sign in to comment.