[Buildroot] [RFC] Python 3 external packages support

Patrick kpa_info at yahoo.fr
Mon Feb 11 14:54:02 UTC 2013


Dear all,

Buildroot as support for python 2 and python 3. Both could be enabled and installed in the same system. Python 2 is then called "python" and Python 3 "python3". This is working fine. 

Buildroot also had a sub menu with some external python packages. Currently buildroot support to enable them only if you use Python 2. When using Python 3 you could not enable any external package. This is, in my opinion, an issue as some of the proposed packages work fine with python 3. 

Adding the menu is easy to do, but then I have to edit each python packages .mk files to handle both version of python correctly, and here I need your advice:


For example the python-bottle package have the following:

define PYTHON_SERIAL_BUILD_CMDS
    (cd $(@D); $(HOST_DIR)/usr/bin/python setup.py build)
endef

define PYTHON_SERIAL_INSTALL_TARGET_CMDS
    (cd $(@D); $(HOST_DIR)/usr/bin/python setup.py install --prefix=$(TARGET_DIR)/usr)
endef

To support python 3, I simply have to call "python3" instead of "python". But if I would like to support both version simultaneously I have to do something like this:
If python2 is enabled
    define command for python2

end if

If python3 is enabled
    define command for python3

end if

As "define" command are used it start to be tricky has I have to define 3 cases: python2 only, python3 only and both. This would be then repeated for each python package, becoming not clean at all !

So my question is how to make this cleaner ? Any idea or comment is welcome !


Patrick


More information about the buildroot mailing list