move legacy pxd files to Cython/Includes/Deprecated
authorLisandro Dalcin <dalcinl@gmail.com>
Fri, 11 Jun 2010 19:27:59 +0000 (16:27 -0300)
committerLisandro Dalcin <dalcinl@gmail.com>
Fri, 11 Jun 2010 19:27:59 +0000 (16:27 -0300)
--HG--
rename : Cython/Includes/python.pxd => Cython/Includes/Deprecated/python.pxd
rename : Cython/Includes/python2.5.pxd => Cython/Includes/Deprecated/python2.5.pxd
rename : Cython/Includes/python_bool.pxd => Cython/Includes/Deprecated/python_bool.pxd
rename : Cython/Includes/python_buffer.pxd => Cython/Includes/Deprecated/python_buffer.pxd
rename : Cython/Includes/python_bytes.pxd => Cython/Includes/Deprecated/python_bytes.pxd
rename : Cython/Includes/python_cobject.pxd => Cython/Includes/Deprecated/python_cobject.pxd
rename : Cython/Includes/python_complex.pxd => Cython/Includes/Deprecated/python_complex.pxd
rename : Cython/Includes/python_dict.pxd => Cython/Includes/Deprecated/python_dict.pxd
rename : Cython/Includes/python_exc.pxd => Cython/Includes/Deprecated/python_exc.pxd
rename : Cython/Includes/python_float.pxd => Cython/Includes/Deprecated/python_float.pxd
rename : Cython/Includes/python_function.pxd => Cython/Includes/Deprecated/python_function.pxd
rename : Cython/Includes/python_getargs.pxd => Cython/Includes/Deprecated/python_getargs.pxd
rename : Cython/Includes/python_instance.pxd => Cython/Includes/Deprecated/python_instance.pxd
rename : Cython/Includes/python_int.pxd => Cython/Includes/Deprecated/python_int.pxd
rename : Cython/Includes/python_iterator.pxd => Cython/Includes/Deprecated/python_iterator.pxd
rename : Cython/Includes/python_list.pxd => Cython/Includes/Deprecated/python_list.pxd
rename : Cython/Includes/python_long.pxd => Cython/Includes/Deprecated/python_long.pxd
rename : Cython/Includes/python_mapping.pxd => Cython/Includes/Deprecated/python_mapping.pxd
rename : Cython/Includes/python_mem.pxd => Cython/Includes/Deprecated/python_mem.pxd
rename : Cython/Includes/python_method.pxd => Cython/Includes/Deprecated/python_method.pxd
rename : Cython/Includes/python_module.pxd => Cython/Includes/Deprecated/python_module.pxd
rename : Cython/Includes/python_number.pxd => Cython/Includes/Deprecated/python_number.pxd
rename : Cython/Includes/python_object.pxd => Cython/Includes/Deprecated/python_object.pxd
rename : Cython/Includes/python_oldbuffer.pxd => Cython/Includes/Deprecated/python_oldbuffer.pxd
rename : Cython/Includes/python_pycapsule.pxd => Cython/Includes/Deprecated/python_pycapsule.pxd
rename : Cython/Includes/python_ref.pxd => Cython/Includes/Deprecated/python_ref.pxd
rename : Cython/Includes/python_sequence.pxd => Cython/Includes/Deprecated/python_sequence.pxd
rename : Cython/Includes/python_set.pxd => Cython/Includes/Deprecated/python_set.pxd
rename : Cython/Includes/python_string.pxd => Cython/Includes/Deprecated/python_string.pxd
rename : Cython/Includes/python_tuple.pxd => Cython/Includes/Deprecated/python_tuple.pxd
rename : Cython/Includes/python_type.pxd => Cython/Includes/Deprecated/python_type.pxd
rename : Cython/Includes/python_unicode.pxd => Cython/Includes/Deprecated/python_unicode.pxd
rename : Cython/Includes/python_version.pxd => Cython/Includes/Deprecated/python_version.pxd
rename : Cython/Includes/python_weakref.pxd => Cython/Includes/Deprecated/python_weakref.pxd
rename : Cython/Includes/stdio.pxd => Cython/Includes/Deprecated/stdio.pxd
rename : Cython/Includes/stdlib.pxd => Cython/Includes/Deprecated/stdlib.pxd
rename : Cython/Includes/stl.pxd => Cython/Includes/Deprecated/stl.pxd

47 files changed:
Cython/Compiler/Main.py
Cython/Includes/Deprecated/python.pxd [moved from Cython/Includes/python.pxd with 100% similarity]
Cython/Includes/Deprecated/python2.5.pxd [moved from Cython/Includes/python2.5.pxd with 100% similarity]
Cython/Includes/Deprecated/python_bool.pxd [moved from Cython/Includes/python_bool.pxd with 100% similarity]
Cython/Includes/Deprecated/python_buffer.pxd [moved from Cython/Includes/python_buffer.pxd with 100% similarity]
Cython/Includes/Deprecated/python_bytes.pxd [moved from Cython/Includes/python_bytes.pxd with 100% similarity]
Cython/Includes/Deprecated/python_cobject.pxd [moved from Cython/Includes/python_cobject.pxd with 100% similarity]
Cython/Includes/Deprecated/python_complex.pxd [moved from Cython/Includes/python_complex.pxd with 100% similarity]
Cython/Includes/Deprecated/python_dict.pxd [moved from Cython/Includes/python_dict.pxd with 100% similarity]
Cython/Includes/Deprecated/python_exc.pxd [moved from Cython/Includes/python_exc.pxd with 100% similarity]
Cython/Includes/Deprecated/python_float.pxd [moved from Cython/Includes/python_float.pxd with 100% similarity]
Cython/Includes/Deprecated/python_function.pxd [moved from Cython/Includes/python_function.pxd with 100% similarity]
Cython/Includes/Deprecated/python_getargs.pxd [moved from Cython/Includes/python_getargs.pxd with 100% similarity]
Cython/Includes/Deprecated/python_instance.pxd [moved from Cython/Includes/python_instance.pxd with 100% similarity]
Cython/Includes/Deprecated/python_int.pxd [moved from Cython/Includes/python_int.pxd with 100% similarity]
Cython/Includes/Deprecated/python_iterator.pxd [moved from Cython/Includes/python_iterator.pxd with 100% similarity]
Cython/Includes/Deprecated/python_list.pxd [moved from Cython/Includes/python_list.pxd with 100% similarity]
Cython/Includes/Deprecated/python_long.pxd [moved from Cython/Includes/python_long.pxd with 100% similarity]
Cython/Includes/Deprecated/python_mapping.pxd [moved from Cython/Includes/python_mapping.pxd with 100% similarity]
Cython/Includes/Deprecated/python_mem.pxd [moved from Cython/Includes/python_mem.pxd with 100% similarity]
Cython/Includes/Deprecated/python_method.pxd [moved from Cython/Includes/python_method.pxd with 100% similarity]
Cython/Includes/Deprecated/python_module.pxd [moved from Cython/Includes/python_module.pxd with 100% similarity]
Cython/Includes/Deprecated/python_number.pxd [moved from Cython/Includes/python_number.pxd with 100% similarity]
Cython/Includes/Deprecated/python_object.pxd [moved from Cython/Includes/python_object.pxd with 100% similarity]
Cython/Includes/Deprecated/python_oldbuffer.pxd [moved from Cython/Includes/python_oldbuffer.pxd with 100% similarity]
Cython/Includes/Deprecated/python_pycapsule.pxd [moved from Cython/Includes/python_pycapsule.pxd with 100% similarity]
Cython/Includes/Deprecated/python_ref.pxd [moved from Cython/Includes/python_ref.pxd with 100% similarity]
Cython/Includes/Deprecated/python_sequence.pxd [moved from Cython/Includes/python_sequence.pxd with 100% similarity]
Cython/Includes/Deprecated/python_set.pxd [moved from Cython/Includes/python_set.pxd with 100% similarity]
Cython/Includes/Deprecated/python_string.pxd [moved from Cython/Includes/python_string.pxd with 100% similarity]
Cython/Includes/Deprecated/python_tuple.pxd [moved from Cython/Includes/python_tuple.pxd with 100% similarity]
Cython/Includes/Deprecated/python_type.pxd [moved from Cython/Includes/python_type.pxd with 100% similarity]
Cython/Includes/Deprecated/python_unicode.pxd [moved from Cython/Includes/python_unicode.pxd with 100% similarity]
Cython/Includes/Deprecated/python_version.pxd [moved from Cython/Includes/python_version.pxd with 100% similarity]
Cython/Includes/Deprecated/python_weakref.pxd [moved from Cython/Includes/python_weakref.pxd with 100% similarity]
Cython/Includes/Deprecated/stdio.pxd [moved from Cython/Includes/stdio.pxd with 100% similarity]
Cython/Includes/Deprecated/stdlib.pxd [moved from Cython/Includes/stdlib.pxd with 100% similarity]
Cython/Includes/Deprecated/stl.pxd [moved from Cython/Includes/stl.pxd with 100% similarity]
Cython/Includes/cpython/object.pxd
Cython/Includes/numpy.pxd
tests/compile/c_directives.pyx
tests/compile/shipped_pxds.pyx [deleted file]
tests/run/bufaccess.pyx
tests/run/buffmt.pyx
tests/run/cython_includes.pyx
tests/run/inplace.pyx
tests/run/r_pythonapi.pyx

index 74e33b1361d42ccf49e8df534b3f98eec12a5255..b06b116ddb35766f348a6ba796be5f50f8061fad 100644 (file)
@@ -19,7 +19,7 @@ import Errors
 import Parsing
 import Version
 from Scanning import PyrexScanner, FileSourceDescriptor
-from Errors import PyrexError, CompileError, InternalError, error
+from Errors import PyrexError, CompileError, InternalError, error, warning
 from Symtab import BuiltinScope, ModuleScope
 from Cython import Utils
 from Cython.Utils import open_new_file, replace_suffix
@@ -321,7 +321,27 @@ class Context(object):
         # the directory containing the source file is searched first
         # for a dotted filename, and its containing package root
         # directory is searched first for a non-dotted filename.
-        return self.search_include_directories(qualified_name, ".pxd", pos)
+        pxd = self.search_include_directories(qualified_name, ".pxd", pos)
+        if pxd is None: # XXX Keep this until Includes/Deprecated is removed
+            if (qualified_name.startswith('python') or
+                qualified_name in ('stdlib', 'stdio', 'stl')):
+                standard_include_path = os.path.abspath(os.path.normpath(
+                        os.path.join(os.path.dirname(__file__), os.path.pardir, 'Includes')))
+                deprecated_include_path = os.path.join(standard_include_path, 'Deprecated')
+                self.include_directories.append(deprecated_include_path)
+                try:
+                    pxd = self.search_include_directories(qualified_name, ".pxd", pos)
+                finally:
+                    self.include_directories.pop()
+                if pxd:
+                    name = qualified_name
+                    if name.startswith('python'):
+                        warning(pos, "'%s' is deprecated, use 'cpython'" % name, 1)
+                    elif name in ('stdlib', 'stdio'):
+                        warning(pos, "'%s' is deprecated, use 'libc.%s'" % (name, name), 1)
+                    elif name in ('stl'):
+                        warning(pos, "'%s' is deprecated, use 'libcpp.*.*'" % name, 1)
+        return pxd
 
     def find_pyx_file(self, qualified_name, pos):
         # Search include path for the .pyx file corresponding to the
index 5d434d900d7241d3b277b1bb4b60435dab1685b0..de49492fc315d654d4521cd2c884e46340df6730 100644 (file)
@@ -1,5 +1,5 @@
 from cpython.ref cimport PyObject, PyTypeObject
-from stdio cimport FILE
+from libc.stdio cimport FILE
 
 cdef extern from "Python.h":
     
index 862d8ac2ae6609cb547fbf64d05e23fd6d142d37..dd6da0c6580ccc2576c763de23d947182b52b07d 100644 (file)
 
 DEF _buffer_format_string_len = 255
 
-cimport python_buffer as pybuf
-from python_ref cimport PyObject, Py_INCREF, Py_XDECREF
-cimport stdlib
-cimport stdio
+cimport cpython.buffer as pybuf
+from cpython cimport PyObject, Py_INCREF, Py_XDECREF
+from libc cimport stdlib
+from libc cimport stdio
 
 cdef extern from "Python.h":
     ctypedef int Py_intptr_t
index 942ba90ec841b0c8722ad9605e76478260af2786..f29200113291510ae0a029f83250f47d2857915e 100644 (file)
@@ -6,7 +6,7 @@
 
 print 3
 
-cimport python_dict as asadf, python_exc, cython as cy
+cimport cython as cy
 
 def e(object[int, ndim=2] buf):
     print buf[3, 2] # no bc
diff --git a/tests/compile/shipped_pxds.pyx b/tests/compile/shipped_pxds.pyx
deleted file mode 100644 (file)
index 7392d03..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-cimport python_bool
-cimport python_buffer
-cimport python_bytes
-cimport python_cobject
-cimport python_complex
-cimport python_dict
-cimport python_exc
-cimport python_float
-cimport python_function
-cimport python_getargs
-cimport python_instance
-cimport python_int
-cimport python_iterator
-cimport python_list
-cimport python_long
-cimport python_mapping
-cimport python_mem
-cimport python_method
-cimport python_module
-cimport python_number
-cimport python_object
-cimport python
-cimport python_pycapsule
-cimport python_ref
-cimport python_sequence
-cimport python_set
-cimport python_string
-cimport python_tuple
-cimport python_type
-cimport python_unicode
-cimport python_version
-cimport python_weakref
-cimport stdio
-cimport stdlib
index b6cdc8d8944fc0763af532b10c82e673ec88b801..bb7072b4d090915d620356747cf0fd66c41414d8 100644 (file)
@@ -9,12 +9,12 @@
 
 from __future__ import unicode_literals
 
-cimport stdlib
-cimport python_buffer
-cimport stdio
+from libc cimport stdlib
+from libc cimport stdio
+cimport cpython.buffer
 cimport cython
 
-from python_ref cimport PyObject
+from cpython cimport PyObject, Py_INCREF, Py_DECREF
 
 __test__ = {}
 
@@ -871,7 +871,6 @@ def printbuf_td_h_double(object[td_h_double] buf, shape):
 #
 # Object access
 #
-from python_ref cimport Py_INCREF, Py_DECREF
 def addref(*args):
     for item in args: Py_INCREF(item)
 def decref(*args):
@@ -983,13 +982,13 @@ def buffer_cast_fails(object[char, cast=True] buf):
 
 
 available_flags = (
-    ('FORMAT', python_buffer.PyBUF_FORMAT),
-    ('INDIRECT', python_buffer.PyBUF_INDIRECT),
-    ('ND', python_buffer.PyBUF_ND),
-    ('STRIDES', python_buffer.PyBUF_STRIDES),
-    ('C_CONTIGUOUS', python_buffer.PyBUF_C_CONTIGUOUS),
-    ('F_CONTIGUOUS', python_buffer.PyBUF_F_CONTIGUOUS),
-    ('WRITABLE', python_buffer.PyBUF_WRITABLE)
+    ('FORMAT', cpython.buffer.PyBUF_FORMAT),
+    ('INDIRECT', cpython.buffer.PyBUF_INDIRECT),
+    ('ND', cpython.buffer.PyBUF_ND),
+    ('STRIDES', cpython.buffer.PyBUF_STRIDES),
+    ('C_CONTIGUOUS', cpython.buffer.PyBUF_C_CONTIGUOUS),
+    ('F_CONTIGUOUS', cpython.buffer.PyBUF_F_CONTIGUOUS),
+    ('WRITABLE', cpython.buffer.PyBUF_WRITABLE)
 )
 
 cdef class MockBuffer:
index 3d740d61eed5403ec8ec93ab96ac3ab424ce7078..c4ec4c0c7e613cf3448c2e69fd73eda7cc840b8b 100644 (file)
@@ -7,7 +7,7 @@ def testcase(func):
     __test__[func.__name__] = func.__doc__
     return func
 
-cimport stdlib
+from libc cimport stdlib
 
 def little_endian():
     cdef unsigned int n = 1
index ddaec586942cc349f228eaee90a388922dea9c32..40fdeeaa926c3deed7d9ea7767906094064f57bd 100644 (file)
@@ -1,7 +1,7 @@
 
 from libc.stdio cimport sprintf
-from python cimport PyType_Check
-from python_type cimport PyType_Check as PyType_Check2
+from cpython cimport PyType_Check
+from cpython cimport PyType_Check as PyType_Check2
 from cpython.type cimport PyType_Check as PyType_Check3
 
 def libc_cimports():
index 7ae65753d53d224824de111145666de619c1221d..99acc351351aa9b925b771502ca51e394abd77a8 100644 (file)
@@ -30,7 +30,7 @@ def h(double a, double b):
     a *= b
     return a
 
-cimport stdlib
+from libc cimport stdlib
 
 def arrays():
     """
index ead4ff33476058a7aca554b9d6e8915d3c043674..8557d17f40fb17775ba57198a5dbf2baf5259a49 100644 (file)
@@ -11,7 +11,7 @@ if sys.version_info[0] >= 3:
 cdef extern from "string.h":
     void memcpy(char *d, char *s, int n)
 
-from python_unicode cimport PyUnicode_DecodeUTF8
+from cpython cimport PyUnicode_DecodeUTF8
     
 def spam():
     cdef char buf[12]