Make bbread use bb.make.load_bbfile() rather than calling handle on the .bb itself.
[vuplus_bitbake] / bin / bbread
1 #!/usr/bin/env python
2 # ex:ts=4:sw=4:sts=4:et
3 # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
4 #
5 # Copyright (C) 2003, 2004  Chris Larson
6 #
7 # This program is free software; you can redistribute it and/or modify it under
8 # the terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 2 of the License, or (at your option) any later
10 # version.
11
12 # This program is distributed in the hope that it will be useful, but WITHOUT
13 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15
16 # You should have received a copy of the GNU General Public License along with
17 # this program; if not, write to the Free Software Foundation, Inc., 59 Temple
18 # Place, Suite 330, Boston, MA 02111-1307 USA. 
19
20 import sys, copy, os
21 sys.path.append(os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), 'lib'))
22 import bb, bb.parse, bb.build, bb.make
23
24 d = bb.data.init()
25 try:
26     bb.make.cfg = bb.parse.handle(os.path.join('conf', 'bitbake.conf'), d)
27 except IOError, e:
28     bb.fatal("Unable to read conf/bitbake.conf: %s" % e)
29
30 if len(sys.argv) == 2:
31     bbfile = sys.argv[1]
32     try:
33         d, fromCache = bb.make.load_bbfile(bbfile)
34     except IOError, e:
35         bb.fatal("Unable to read %s: %s" % (bbfile, e))
36     except Exception, e:
37         bb.fatal("%s" % e)
38
39 # emit variables and shell functions
40 bb.data.emit_env(sys.__stdout__, d, True)
41 # emit the metadata which isnt valid shell
42 for e in d.keys():
43     if bb.data.getVarFlag(e, 'python', d):
44         sys.__stdout__.write("\npython %s () {\n%s}\n" % (e, bb.data.getVar(e, d, 1)))