diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2006-07-09 21:06:40 +0000 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2006-07-09 21:06:40 +0000 |
commit | 628e7791d754ad68b810f275bb346e3c04949026 (patch) | |
tree | 0e607b7c9c71cf8a2255634482b44e278744497b | |
parent | 4651e6cf84fea69c52d88b57f7ccc9a322933d7b (diff) | |
download | bitbake-628e7791d754ad68b810f275bb346e3c04949026.tar.gz |
bitbake c parser: first steps torwards a working parser
-rw-r--r-- | lib/bb/parse/parse_c/BBHandler.py | 16 | ||||
-rw-r--r-- | lib/bb/parse/parse_c/Makefile | 12 | ||||
-rw-r--r-- | lib/bb/parse/parse_c/bitbakec.pyx | 14 |
3 files changed, 22 insertions, 20 deletions
diff --git a/lib/bb/parse/parse_c/BBHandler.py b/lib/bb/parse/parse_c/BBHandler.py index d9f48db17..fd3be268e 100644 --- a/lib/bb/parse/parse_c/BBHandler.py +++ b/lib/bb/parse/parse_c/BBHandler.py @@ -61,13 +61,15 @@ def supports(fn, data): return fn[-3:] == ".bb" or fn[-8:] == ".bbclass" or fn[-4:] == ".inc" or fn[-5:] == ".conf" def init(fn, data): - if not data.getVar('TOPDIR'): + if not data.getVar('TOPDIR', False): bb.error('TOPDIR is not set') - if not data.getVar('BBPATH'): + if not data.getVar('BBPATH', False): bb.error('BBPATH is not set') def handle(fn, d, include): + from bb import data, parse + print "" print "fn: %s" % fn print "data: %s" % d @@ -77,15 +79,15 @@ def handle(fn, d, include): # check if we include or are the beginning if include: - oldfile = d.getVar('FILE') + oldfile = d.getVar('FILE', False) else: - #d.inheritFromOS() + if fn[-5:] == ".conf": + data.inheritFromOS(d) oldfile = None # find the file if not os.path.isabs(fn): - bb.error("No Absolute FILE name") - abs_fn = bb.which(d.getVar('BBPATH'), fn) + abs_fn = bb.which(d.getVar('BBPATH', True), fn) else: abs_fn = fn @@ -98,7 +100,7 @@ def handle(fn, d, include): parse.mark_dependency(d, abs_fn) # now parse this file - by defering it to C++ - parsefile(fn, d) + parsefile(abs_fn, d) # restore the original FILE if oldfile: diff --git a/lib/bb/parse/parse_c/Makefile b/lib/bb/parse/parse_c/Makefile index 9eb7ce9d0..741f74cdd 100644 --- a/lib/bb/parse/parse_c/Makefile +++ b/lib/bb/parse/parse_c/Makefile @@ -28,9 +28,9 @@ bitbakec.so: bitbakec.o bitbakeparser.o bitbakescanner.o g++ -shared -fPIC bitbakeparser.o bitbakescanner.o bitbakec.o -o bitbakec.so clean: - rm *.out - rm *.cc - rm bitbakec.c - rm bitbakec-processed.c - rm *.o - rm *.so + rm -f *.out + rm -f *.cc + rm -f bitbakec.c + rm -f bitbakec-processed.c + rm -f *.o + rm -f *.so diff --git a/lib/bb/parse/parse_c/bitbakec.pyx b/lib/bb/parse/parse_c/bitbakec.pyx index 8551ed473..be910e611 100644 --- a/lib/bb/parse/parse_c/bitbakec.pyx +++ b/lib/bb/parse/parse_c/bitbakec.pyx @@ -47,15 +47,15 @@ cdef public void e_export(lex_t* c, char* what): print "e_export", what #exp: # bb.data.setVarFlag(key, "export", 1, data) - d = <object>container.data - d.setVarFlag(key, "export", 1) + d = <object>c.data + d.setVarFlag(what, "export", 1) cdef public void e_immediate(lex_t* c, char* key, char* what): print "e_immediate", key, what #colon: # val = bb.data.expand(groupd["value"], data) d = <object>c.data - d.setVar(key, d.expand(what)) + d.setVar(key, d.expand(what,None)) cdef public void e_cond(lex_t* c, char* key, char* what): print "e_cond", key, what @@ -140,8 +140,8 @@ cdef public void e_inherit(lex_t* c, char* file): cdef public void e_include(lex_t* c, char* file): print "e_include", file d = <object>c.data - d.expand(file) - + d.expand(file,) + try: parsefile(file, d) except IOError: @@ -152,7 +152,7 @@ cdef public void e_require(lex_t* c, char* file): print "e_require", file d = <object>c.data d.expand(file) - + try: parsefile(file, d) except IOError: @@ -171,7 +171,7 @@ cdef public void e_proc_fakeroot(lex_t* c, char* key, char* what): pass cdef public void e_def(lex_t* c, char* a, char* b, char* d): - print "e_def", key, what + print "e_def", a, b, d pass cdef public void e_parse_error(lex_t* c): |