All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joshua Lock <josh@openedhand.com>
To: poky@yoctoproject.org
Subject: Re: [PATCH 3/7] bb: add bb.fetcher as dynamic fetch module instance for fetch/fetch2
Date: Mon, 10 Jan 2011 10:13:39 +0000	[thread overview]
Message-ID: <1294654419.2451.3.camel@scimitar> (raw)
In-Reply-To: <caa56bdbc2294f3da1ccec752e1ba9e3e452f241.1294469496.git.ke.yu@intel.com>

On Sat, 2011-01-08 at 15:15 +0800, Yu Ke wrote:
> bb.fetcher is introduced to swtich between bb.fetch and bb.fetch2.
> all bb.fetch/bb.fetch2 referrence can be replaced with bb.fetcher.instance,
> so that we can cleanly switch between bb.fetch and bb.fetch2
> 
> Signed-off-by: Yu Ke <ke.yu@intel.com>
> ---
>  bitbake/lib/bb/fetcher.py |   26 ++++++++++++++++++++++++++
>  1 files changed, 26 insertions(+), 0 deletions(-)
>  create mode 100644 bitbake/lib/bb/fetcher.py
> 
> diff --git a/bitbake/lib/bb/fetcher.py b/bitbake/lib/bb/fetcher.py
> new file mode 100644
> index 0000000..3818d78
> --- /dev/null
> +++ b/bitbake/lib/bb/fetcher.py
> @@ -0,0 +1,26 @@
> +#!/usr/bin/env python
> +# ex:ts=4:sw=4:sts=4:et
> +# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
> +#
> +# This program is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License version 2 as
> +# published by the Free Software Foundation.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License along
> +# with this program; if not, write to the Free Software Foundation, Inc.,
> +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
> +
> +import bb
> +from bb import fetch, fetch2
> +
> +# switch between fetch and fetch2
> +instance = bb.fetch
> +__version__ = "1"
> +
> +#instance = bb.fetch2
> +#__version__ = "2"

I'm not very happy with this, it doesn't feel right. Can we not add some
runtime determination of which module to use (a variable in
bitbake.conf?) and then use some dynamic Python magic to add it to the
imported modules list?

A quick Google makes me thing we could do something more dynamic with
the __import__() function.
 
Cheers,
Joshua
-- 
Joshua Lock
        Intel Open Source Technology Centre



  reply	other threads:[~2011-01-10 10:13 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-08  7:14 [PATCH 0/7] add initial bb.fetch2 code Yu Ke
2011-01-08  7:14 ` [PATCH 1/7] fetch2: copy bb.fetch to bb.fetch2 as initial code base Yu Ke
2011-01-08  7:15 ` [PATCH 2/7] bb.fetch2: replace bb.fetch with bb.fetch2 in the bb.fetch2 Yu Ke
2011-01-08  7:15 ` [PATCH 3/7] bb: add bb.fetcher as dynamic fetch module instance for fetch/fetch2 Yu Ke
2011-01-10 10:13   ` Joshua Lock [this message]
2011-01-10 11:42     ` Richard Purdie
2011-01-10 16:43       ` Richard Purdie
2011-01-10 20:19         ` Richard Purdie
2011-01-11  0:06           ` Yu Ke
2011-01-11  0:13           ` Yu Ke
2011-01-11  0:50             ` Richard Purdie
2011-01-11  1:16               ` Yu Ke
2011-01-11 11:54           ` Joshua Lock
2011-01-08  7:15 ` [PATCH 4/7] BBHandler: remove bb.fetch referrence Yu Ke
2011-01-08  7:15 ` [PATCH 5/7] bb.cooker: remove bb.fetch.persistent_database_connection referrence Yu Ke
2011-01-08  7:15 ` [PATCH 6/7] bb: replace bb.fetch referrence with bb.fetcher instance Yu Ke
2011-01-08  7:15 ` [PATCH 7/7] bbclass: replace the " Yu Ke

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=1294654419.2451.3.camel@scimitar \
    --to=josh@openedhand.com \
    --cc=poky@yoctoproject.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.