From f40cd1fecd7bbccb7cf9615bf84ef393d05899d2 Mon Sep 17 00:00:00 2001 From: Michael 'Mickey' Lauer Date: Sat, 11 Jun 2005 14:46:09 +0000 Subject: collect_bbfiles: - save progress callback in function attribute - remain completely silent when no progress callback is requested --- lib/bb/make.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'lib/bb/make.py') diff --git a/lib/bb/make.py b/lib/bb/make.py index 424569d30..3ecaf7522 100644 --- a/lib/bb/make.py +++ b/lib/bb/make.py @@ -21,7 +21,7 @@ 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., 59 Temple -Place, Suite 330, Boston, MA 02111-1307 USA. +Place, Suite 330, Boston, MA 02111-1307 USA. This file is part of the BitBake build tools. """ @@ -111,19 +111,22 @@ def load_bbfile( bbfile ): def collect_bbfiles( progressCallback ): """Collect all available .bb build files""" - + collect_bbfiles.cb = progressCallback parsed, cached, skipped, masked = 0, 0, 0, 0 global cache, pkgdata cache = bb.data.getVar( "CACHE", cfg, 1 ) pkgdata = data.pkgdata( not cache in [None, ''], cache ) if not cache in [None, '']: - print "NOTE: Using cache in '%s'" % cache + if collect_bbfiles.cb is not None: + print "NOTE: Using cache in '%s'" % cache try: os.stat( cache ) except OSError: bb.mkdirhier( cache ) - else: print "NOTE: Not using a cache. Set CACHE = to enable." + else: + if collect_bbfiles.cb is not None: + print "NOTE: Not using a cache. Set CACHE = to enable." files = (data.getVar( "BBFILES", cfg, 1 ) or "").split() data.setVar("BBFILES", " ".join(files), cfg) @@ -178,7 +181,9 @@ def collect_bbfiles( progressCallback ): pkgdata[f] = bb_data # now inform the caller - progressCallback( i + 1, len( newfiles ), f, bb_data, fromCache ) + if collect_bbfiles.cb is not None: + collect_bbfiles.cb( i + 1, len( newfiles ), f, bb_data, fromCache ) + except IOError, e: bb.error("opening %s: %s" % (f, e)) pass @@ -189,7 +194,9 @@ def collect_bbfiles( progressCallback ): raise except Exception, e: bb.error("%s while parsing %s" % (e, f)) - print "\rNOTE: Parsing finished. %d cached, %d parsed, %d skipped, %d masked." % ( cached, parsed, skipped, masked ), + + if collect_bbfiles.cb is not None: + print "\rNOTE: Parsing finished. %d cached, %d parsed, %d skipped, %d masked." % ( cached, parsed, skipped, masked ), def explode_version(s): import string -- cgit 1.2.3-korg