python23

Dan Williams dcbw at redhat.com
Mon Dec 17 09:31:42 PST 2012


On Mon, 2012-12-17 at 11:46 -0500, Shawn J. Goff wrote:
> qmi-codegen produces lots of python2/3 problems like this:
> 
> Traceback (most recent call last):
>      message = Message(object_dictionary, common_objects_dictionary)
>    File "../../build-aux/qmi-codegen/qmi-codegen", line 97, in <module>
>      message_list = MessageList(object_list_json, common_object_list_json)
>    File 
> "/home/shawn/projects/all-projects/fx/buildroot-fresh/output/build/libqmi-1.0.0/build-aux/qmi-codegen/Message.py", 
> line 56, in __init__
>    File 
> "/home/shawn/projects/all-projects/fx/buildroot-fresh/output/build/libqmi-1.0.0/build-aux/qmi-codegen/MessageList.py", 
> line 46, in __init__
>      message = Message(object_dictionary, common_objects_dictionary)
>    File 
> "/home/shawn/projects/all-projects/fx/buildroot-fresh/output/build/libqmi-1.0.0/build-aux/qmi-codegen/Message.py", 
> line 56, in __init__
>      self.id_enum_name = 
> string.upper(utils.build_underscore_name(self.fullname))
> AttributeError: 'module' object has no attribute 'upper'

Looks like we can just call the object method "upper()" on the string
itself, which is supported in both python 2 and 3.  What other issues
have you run into?  Ideally, we fix them so that all the codegen is
compatible with both python2 and 3 at the same time.

Dan

> 
> I have libqmi as a package in an automated build system, and this is 
> causing problems. I either have to make a custom build script that 
> creates a python->python2 symlink and modifies PATH for that package or 
> add a patch that specifies "python2" instead of "python" for the 
> interpreter in all the .py files. It looks like that codegen is some 
> standard thing; I'd like to find out if the upstream has been made 
> compatible with python3 and pull it into libqmi, but it looks like every 
> project just copies it in to their source and modifies it, so I can't 
> find the original source for this codegen stuff. Can anyone point me to it?
> 
> Would you be interested in accepting a patch with an updated codegen if 
> it's available? If not, would you want a patch that changes the "#!" to 
> point to python2 instead of python? I'm not sure that last solution is a 
> good solution; I don't know if everywhere you want to support has a 
> python2 symlink.
> _______________________________________________
> libqmi-devel mailing list
> libqmi-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/libqmi-devel




More information about the libqmi-devel mailing list