Bug 620068

Summary: Mayavi needs to be rebuilt for python-2.7
Product: [Fedora] Fedora Reporter: Toshio Ernie Kuratomi <a.badger>
Component: MayaviAssignee: Chen Lei <supercyper1>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: rawhideCC: cbm, dmalcolm, rpandit, supercyper1
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Mayavi-3.3.2-1.fc14 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-08-19 01:16:36 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 620067    
Bug Blocks: 619913    
Attachments:
Description Flags
Fix for UnboundLocalError in wrapper_gen.py on py2.7 none

Description Toshio Ernie Kuratomi 2010-07-31 18:46:48 UTC
Description of problem:

Mayavi needs a rebuild in F-14 and devel to use python-2.7.

It looks like a rebuild is blocking on a vtk rebuild:
http://koji.fedoraproject.org/koji/taskinfo?taskID=2369535

Comment 1 Dave Malcolm 2010-08-01 23:07:21 UTC
vtk is now in the buildroot; I'm looking at Mayavi

Comment 2 Dave Malcolm 2010-08-01 23:09:20 UTC
Created attachment 435926 [details]
Fix for UnboundLocalError in wrapper_gen.py on py2.7

Fix for this error:

  File "enthought/tvtk/wrapper_gen.py", line 456, in _gen_get_set_methods
UnboundLocalError: local variable 'rng' referenced before assignment

Comment 3 Dave Malcolm 2010-08-01 23:11:49 UTC
With the above patch, build gets further, but fails with:
running build
----------------------------------------------------------------------
Building TVTK classes... SyntaxError: ('EOL while scanning string literal', ('tvtk_classes/delimited_text_reader.py', 105, 45, '    utf8_record_delimiters = traits.String(r"\n'))
error: tvtk_classes/delimited_text_reader.pyc: No such file or directory

Seems to be Mayavi-3.3.0/enthought/tvtk/setup.py in "gen_tvtk_classes_zip", which generates python source code into tvtk_classes.zip.

Unfortunately the error means that the zipfile is never actually written to the filesystem (I think), so debugging this is tricky.

Looks like mismatching " vs ' characters.

Comment 4 Dave Malcolm 2010-08-01 23:24:36 UTC
Hacking Mayavi-3.3.0/enthought/tvtk/wrapper_gen.py:WrapperGenerator.generate_code
and adding:
   out = sys.stdout
allows us to see the generated code.

I misread the error in comment #3, the generated code looks like this:

    utf8_record_delimiters = traits.String(r"
    ", enter_set=True, auto_set=False, help=\
        """
        Specify the character(s) that will be used to separate records.
        The order of characters in the string does not matter.  Defaults
        to "\r\n".
        """
    )
 
where clearly the newline within the r"" string literal is a syntax error.

Comment 5 Dave Malcolm 2010-08-02 11:29:46 UTC
Setting
  out = sys.stdout 
means we don't actually get the code written out; build fails later on IIRC.

Better debugging method: I added this to the top of generate_code

        class Tee:
            def __init__(self, out):
                self.out = out
            def write(self, data):
                self.out.write(data)
                sys.stdout.write(data)
	out = Tee(out)

to see the code on stdout _and_ to have it written out.

I attempted a fix for this by changing the code generator to emit multiline string literals, which got things further, now fails here:

SyntaxError: ('invalid syntax', ('tvtk_classes/renderer.py', 222, 10, '    pass = traits.Property(_get_pass, _set_pass, help=\\\n'))

Comment 6 Dave Malcolm 2010-08-02 11:32:25 UTC
The generated code is:
    pass = traits.Property(_get_pass, _set_pass, help=\
        """
        Set/Get a custom render pass.
        Initial value is NULL.
        """
    )

Given that the error occurs in column 10, the issue seems to be that "pass" is a reserved word.

Did this code ever get built for python 2.6?

Comment 7 Chen Lei 2010-08-10 13:47:42 UTC
Hi Dava,


Mayavi has a very active upstream, would mind to report this issue to upstream?

https://svn.enthought.com/enthought/report
http://code.enthought.com/support/

Comment 8 Chen Lei 2010-08-10 13:59:12 UTC
FYI, a bugfix version 3.3.2 is available at http://www.enthought.com/repo/ETS/ for several months, I haven't tried if it can work with python 2.7.

Comment 9 Chen Lei 2010-08-10 14:20:18 UTC
Mayavi 3.3.2 built sucessfully with python 2.7. 

See http://koji.fedoraproject.org/koji/taskinfo?taskID=2391288

Comment 10 Fedora Update System 2010-08-15 08:30:55 UTC
Mayavi-3.3.2-1.fc14,python-Traits-3.4.0-1.fc14,python-TraitsGUI-3.4.0-2.fc14,python-TraitsBackendQt-3.4.0-1.fc14,python-TraitsBackendWX-3.4.0-3.fc14,python-EnvisagePlugins-3.1.2-1.fc14,python-EnvisageCore-3.1.2-1.fc14,python-EnthoughtBase-3.0.5-1.fc14,python-AppTools-3.3.2-1.fc14 has been submitted as an update for Fedora 14.
http://admin.fedoraproject.org/updates/Mayavi-3.3.2-1.fc14,python-Traits-3.4.0-1.fc14,python-TraitsGUI-3.4.0-2.fc14,python-TraitsBackendQt-3.4.0-1.fc14,python-TraitsBackendWX-3.4.0-3.fc14,python-EnvisagePlugins-3.1.2-1.fc14,python-EnvisageCore-3.1.2-1.fc14,python-EnthoughtBase-3.0.5-1.fc14,python-AppTools-3.3.2-1.fc14

Comment 11 Fedora Update System 2010-08-16 16:05:18 UTC
Mayavi-3.3.2-1.fc14, python-Traits-3.4.0-1.fc14, python-TraitsGUI-3.4.0-2.fc14, python-TraitsBackendQt-3.4.0-1.fc14, python-TraitsBackendWX-3.4.0-3.fc14, python-EnvisagePlugins-3.1.2-1.fc14, python-EnvisageCore-3.1.2-1.fc14, python-EnthoughtBase-3.0.5-1.fc14, python-AppTools-3.3.2-1.fc14 has been pushed to the Fedora 14 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update Mayavi python-Traits python-TraitsGUI python-TraitsBackendQt python-TraitsBackendWX python-EnvisagePlugins python-EnvisageCore python-EnthoughtBase python-AppTools'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/Mayavi-3.3.2-1.fc14,python-Traits-3.4.0-1.fc14,python-TraitsGUI-3.4.0-2.fc14,python-TraitsBackendQt-3.4.0-1.fc14,python-TraitsBackendWX-3.4.0-3.fc14,python-EnvisagePlugins-3.1.2-1.fc14,python-EnvisageCore-3.1.2-1.fc14,python-EnthoughtBase-3.0.5-1.fc14,python-AppTools-3.3.2-1.fc14

Comment 12 Fedora Update System 2010-08-19 01:16:32 UTC
Mayavi-3.3.2-1.fc14, python-Traits-3.4.0-1.fc14, python-TraitsGUI-3.4.0-2.fc14, python-TraitsBackendQt-3.4.0-1.fc14, python-TraitsBackendWX-3.4.0-3.fc14, python-EnvisagePlugins-3.1.2-1.fc14, python-EnvisageCore-3.1.2-1.fc14, python-EnthoughtBase-3.0.5-1.fc14, python-AppTools-3.3.2-1.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.