summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2005-07-11 16:24:44 +0000
committerHolger Hans Peter Freyther <zecke@selfish.org>2005-07-11 16:24:44 +0000
commit19257c3a8b3a7c8690b9ecf6c53b3c8c0619f81b (patch)
treec2a994b1c498ebf66d96a43283c82653841da6cc
parent3e179a3126ba139c95cb65731f4cde0cf7560e4a (diff)
downloadbitbake-19257c3a8b3a7c8690b9ecf6c53b3c8c0619f81b.tar.gz
Sorry for the inconvience and add the missing file
I wonder what would happen if I only commit after getting enough donations for a file... Currently it defaults to the python implementation
-rw-r--r--lib/bb/parse/__init__.py70
1 files changed, 70 insertions, 0 deletions
diff --git a/lib/bb/parse/__init__.py b/lib/bb/parse/__init__.py
new file mode 100644
index 000000000..b8839c09f
--- /dev/null
+++ b/lib/bb/parse/__init__.py
@@ -0,0 +1,70 @@
+"""
+BitBake Parsers
+
+File parsers for the BitBake build tools.
+
+Copyright (C) 2003, 2004 Chris Larson
+Copyright (C) 2003, 2004 Phil Blundell
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+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., 59 Temple
+Place, Suite 330, Boston, MA 02111-1307 USA.
+
+Based on functions from the base bb module, Copyright 2003 Holger Schurig
+"""
+
+__all__ = [ 'ParseError', 'SkipPackage', 'cached_mtime', 'mark_dependency',
+ 'supports', 'handle', 'init' ]
+handlers = []
+
+class ParseError(Exception):
+ """Exception raised when parsing fails"""
+
+class SkipPackage(Exception):
+ """Exception raised to skip this package"""
+
+__mtime_cache = {}
+def cached_mtime(f):
+ import os
+ if not __mtime_cache.has_key(f):
+ __mtime_cache[f] = os.stat(f)[8]
+ return __mtime_cache[f]
+
+def mark_dependency(d, f):
+ import bb, os
+ if f.startswith('./'):
+ f = "%s/%s" % (os.getcwd(), f[2:])
+ deps = (bb.data.getVar('__depends', d) or "").split()
+ deps.append("%s@%s" % (f, cached_mtime(f)))
+ bb.data.setVar('__depends', " ".join(deps), d)
+
+def supports(fn, data):
+ """Returns true if we have a handler for this file, false otherwise"""
+ for h in handlers:
+ if h['supports'](fn, data):
+ return 1
+ return 0
+
+def handle(fn, data, include = 0):
+ """Call the handler that is appropriate for this file"""
+ for h in handlers:
+ if h['supports'](fn, data):
+ return h['handle'](fn, data, include)
+ raise ParseError("%s is not a BitBake file" % fn)
+
+def init(fn, data):
+ for h in handlers:
+ if h['supports'](fn):
+ return h['init'](data)
+
+
+from parse_py import __version__, ConfHandler, BBHandler