summaryrefslogtreecommitdiffstats
path: root/bin/oe/parse/__init__.py
blob: 8ff3574526c9a683de51dfdcdae1d909280bc7a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
"""
OpenEmbedded Parsers

File parsers for the OpenEmbedded 
(http://openembedded.org) build infrastructure.

Copyright: (c) 2003 Chris Larson

Based on functions from the base oe module, Copyright 2003 Holger Schurig
"""
__version__ = '1.0'

__all__ = [ 'handlers', 'supports', 'handle', 'init' ]
handlers = []

import ConfHandler
import OEHandler

def supports(fn):
	"""Returns true if we have a handler for this file, false otherwise"""
	for h in handlers:
		if h['supports'](fn):
			return True
	return False

def handle(fn, data = {}):
	"""Call the handler that is appropriate for this file"""
	for h in handlers:
		if h['supports'](fn):
			return h['handle'](fn, data)
	return None

def init(fn, data = {}):
	for h in handlers:
		if h['supports'](fn):
			return h['init'](data)