[Mesa-dev] glretrace

Jose Fonseca jfonseca at vmware.com
Mon Dec 6 15:31:52 PST 2010


Hi Tom,

I can remove python2.6 dependency as you suggest, but although this new string formatting method is seldom used it actually makes the code much more readable and I was hoping to spread its use, so I'd like you to try one thing first before giving it up:

I don't know which Debian release you have, but Debian has been shipping a python2.6 for a long time. If you install it and pull the latest apitrace code from git, which has this change

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c8848d3..0761a78 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -12,6 +12,8 @@ if (NOT CMAKE_BUILD_TYPE)
         FORCE)
 endif (NOT CMAKE_BUILD_TYPE)
 
+set (CMAKE_USE_PYTHON_VERSION 2.6)
+
 find_package (PythonInterp REQUIRED)
 find_package (OpenGL REQUIRED)
 
then it should pickup the /usr/bin/python2.6 interpreter binary instead of the /usr/bin/python, therefore not failing.

Does this work for you? You may need to remove the CMakeCache.txt file first.

Jose

________________________________________
From: tom fogal [tfogal at sci.utah.edu]
Sent: Monday, December 06, 2010 22:14
To: Jose Fonseca
Cc: mesa-dev at lists.freedesktop.org
Subject: Re: [Mesa-dev] glretrace

Hi José,

José Fonseca wrote:
> FYI, I've extended my apitrace project to be able not only to show a
> list of GL calls, but also replay them.

Neat!

> The idea is to facilitate reproduction of bugs, help finding
> regressions, and do it across different platforms.
>
> Code is in
> http://cgit.freedesktop.org/~jrfonseca/apitrace/log/?h=retrace

I'm having trouble getting it to work on my system:

[ 33%] Generating glretrace.cpp
/usr/bin/python2.5 /home/tfogal/dev/gltrace/glretrace.py >
/home/tfogal/dev/gltrace/glretrace.cpp
Traceback (most recent call last):
   File "/home/tfogal/dev/gltrace/glretrace.py", line 214, in <module>
     retracer.retrace_api(glapi.glapi)
   File "/home/tfogal/dev/gltrace/retrace.py", line 282, in retrace_api
     self.retrace_functions(api.functions)
   File "/home/tfogal/dev/gltrace/retrace.py", line 234, in
retrace_functions
     self.retrace_function(function)
   File "/home/tfogal/dev/gltrace/glretrace.py", line 38, in
retrace_function
     Retracer.retrace_function(self, function)
   File "/home/tfogal/dev/gltrace/retrace.py", line 185, in retrace_function
     self.extract_arg(function, arg, arg_type, lvalue, rvalue)
   File "/home/tfogal/dev/gltrace/glretrace.py", line 145, in extract_arg
     Retracer.extract_arg(self, function, arg, arg_type, lvalue, rvalue)
   File "/home/tfogal/dev/gltrace/retrace.py", line 216, in extract_arg
     ValueExtractor().visit(arg_type, lvalue, rvalue)
   File "/home/tfogal/dev/gltrace/stdapi.py", line 342, in visit
     return type.visit(self, *args, **kwargs)
   File "/home/tfogal/dev/gltrace/stdapi.py", line 166, in visit
     return visitor.visit_array(self, *args, **kwargs)
   File "/home/tfogal/dev/gltrace/retrace.py", line 80, in visit_array
     print '        for(size_t {i} = 0; {i} < {length}; ++{i})
{{'.format(i = index, length = length)
AttributeError: 'str' object has no attribute 'format'

Turns out the "format" function of strings was added in python 2.6:

    http://docs.python.org/library/stdtypes.html#str.format

and I happen to be running Debian stable, which is still shipping 2.5.

I could get by that particular format problem pretty easily, but then
there's another one on line 161 that uses ``**locals'', and my python-fu
isn't up to snuff to rewrite that as a `"string" % (a,b,c)' form.

Any thoughts on supporting 2.5?

-tom


More information about the mesa-dev mailing list