Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] [RFC] Python 3 external packages support
Date: Mon, 11 Feb 2013 16:09:08 +0100	[thread overview]
Message-ID: <20130211160908.2da60098@skate> (raw)
In-Reply-To: <1360594442.60393.YahooMailNeo@web171801.mail.ir2.yahoo.com>

Dear Patrick,

On Mon, 11 Feb 2013 14:54:02 +0000 (GMT), Patrick wrote:

> 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 !

I think we should support either Python 2 *OR* Python 3. The two
packages should be exclusive. I don't think it's really useful for
something such as Buildroot to support cases where both Python versions
are needed in a given configuration.

If we make them exclusive, then we can ensure that
$(HOST_DIR)/usr/bin/python is either a symbolic link to python2 (when
Python 2 is used) or a symbolic link on python3 (when Python 3 is
used), and that should make the thing work pretty smoothly.

Then, Python external modules would have to depend on
BR2_PACKAGE_PYTHON || BR2_PACKAGE_PYTHON3 is they support both,
BR2_PACKAGE_PYTHON if they support Python 2 only, and
BR2_PACKAGE_PYTHON3 is they support Python 3 only.

Best regards,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

  reply	other threads:[~2013-02-11 15:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-11 14:54 [Buildroot] [RFC] Python 3 external packages support Patrick
2013-02-11 15:09 ` Thomas Petazzoni [this message]
     [not found]   ` <1360595860.22602.YahooMailNeo@web171805.mail.ir2.yahoo.com>
     [not found]     ` <20130211162231.0ac06f9c@skate>
2013-02-11 15:40       ` Patrick
2013-02-11 15:42         ` Thomas Petazzoni
2013-02-11 15:45   ` Samuel Martin
2013-02-11 15:54     ` Thomas Petazzoni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130211160908.2da60098@skate \
    --to=thomas.petazzoni@free-electrons.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox