#12868: Attaching a pyx file in the presence of __init__.py results in wrong 
module
names
-----------------------------+----------------------------------------------
       Reporter:  SimonKing  |         Owner:  jason   
           Type:  defect     |        Status:  new     
       Priority:  major      |     Milestone:  sage-5.1
      Component:  misc       |    Resolution:          
       Keywords:             |   Work issues:          
Report Upstream:  N/A        |     Reviewers:          
        Authors:             |     Merged in:          
   Dependencies:             |      Stopgaps:          
-----------------------------+----------------------------------------------

Comment (by leif):

 In the Cython-generated `.c` file, I see things like
 {{{
 #!c
 ...
 /* Module declarations from '_tmp_foo_foo_pyx._tmp_foo_foo_pyx_0' */
 #define __Pyx_MODULE_NAME "_tmp_foo_foo_pyx._tmp_foo_foo_pyx_0"
 int __pyx_module_is_main__tmp_foo_foo_pyx___tmp_foo_foo_pyx_0 = 0;

 /* Implementation of '_tmp_foo_foo_pyx._tmp_foo_foo_pyx_0' */
 static char __pyx_k_1[] = "File: _tmp_foo_foo_pyx_0.pyx (starting at line
 2)";
 static char __pyx_k_2[] = "_tmp_foo_foo_pyx._tmp_foo_foo_pyx_0";
 static char __pyx_k__bar[] = "bar";
 static char __pyx_k____main__[] = "__main__";
 static char __pyx_k____test__[] = "__test__";
 static PyObject *__pyx_n_s_2;
 static PyObject *__pyx_n_s____main__;
 static PyObject *__pyx_n_s____test__;
 static PyObject *__pyx_n_s__bar;

 static PyMethodDef __pyx_methods[] = {
   {0, 0, 0, 0}
 };

 #if PY_MAJOR_VERSION >= 3
 static struct PyModuleDef __pyx_moduledef = {
     PyModuleDef_HEAD_INIT,
     __Pyx_NAMESTR("_tmp_foo_foo_pyx_0"),
     __Pyx_DOCSTR(__pyx_k_1), /* m_doc */
     -1, /* m_size */
     __pyx_methods /* m_methods */,
     NULL, /* m_reload */
     NULL, /* m_traverse */
     NULL, /* m_clear */
     NULL /* m_free */
 };
 #endif
 ...
 }}}
 with an `__init__.py` file present.  (My dummy class is called `bar`
 rather than `bla`.)

 In the temporary build directory, also a symbolic link to `__init__.py` is
 created:
 {{{
 /home/leif/.sage/temp/sleepless/17317/spyx/_tmp_foo_foo_pyx:
 total 112
 drwxr-xr-x 3 leif leif  4096 2012-04-22 17:45 .
 drwxr-xr-x 3 leif leif  4096 2012-04-22 17:45 ..
 drwxr-xr-x 4 leif leif  4096 2012-04-22 17:45 build
 -rw-r--r-- 1 leif leif     0 2012-04-22 17:45 err
 lrwxrwxrwx 1 leif leif    16 2012-04-22 17:45 foo.pyx -> /tmp/foo/foo.pyx
 lrwxrwxrwx 1 leif leif    20 2012-04-22 17:45 __init__.py ->
 /tmp/foo/__init__.py
 -rw-r--r-- 1 leif leif  1536 2012-04-22 17:45 log
 -rw-r--r-- 1 leif leif  1400 2012-04-22 17:45 setup.py
 -rw-r--r-- 1 leif leif 46397 2012-04-22 17:45 _tmp_foo_foo_pyx_0.c
 -rw-r--r-- 1 leif leif  3993 2012-04-22 17:45 _tmp_foo_foo_pyx_0.html
 -rw-r--r-- 1 leif leif   157 2012-04-22 17:45 _tmp_foo_foo_pyx_0.pyx
 -rwxr-xr-x 1 leif leif 36595 2012-04-22 17:45 _tmp_foo_foo_pyx_0.so
 }}}
 `setup.py` there looks "clean".

 So I'm pretty sure -- if at all -- ''distutils'' are to blame for the
 unexpected behaviour, although it seems quite reasonable to me.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12868#comment:4>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to