poky/bitbake/lib/bb/parse/__init__.py
Ross Burton cd8b52418c Merged revisions 5189-5198 via svnmerge from
https://svn.o-hand.com/repos/poky/trunk

........
  r5189 | richard | 2008-09-11 23:41:08 +0100 (Thu, 11 Sep 2008) | 1 line
  
  local.conf.sample: Make the parallel threads documentation more visible and update with a quadcore example
........
  r5190 | richard | 2008-09-12 00:02:51 +0100 (Fri, 12 Sep 2008) | 1 line
  
  handbook/quickstart: Improve documentation on the options available in local.conf
........
  r5191 | richard | 2008-09-12 00:11:45 +0100 (Fri, 12 Sep 2008) | 1 line
  
  handbook/faq.xml: Add a QA about proxy server setup
........
  r5192 | ross | 2008-09-12 16:43:10 +0100 (Fri, 12 Sep 2008) | 1 line
  
  ref-variables.xml: Add POKY_EXTRA_INSTALL
........
  r5193 | ross | 2008-09-16 10:00:50 +0100 (Tue, 16 Sep 2008) | 1 line
  
  poky-fixed-revisions.inc: bump matchbox-wm-2
........
  r5194 | ross | 2008-09-16 16:36:32 +0100 (Tue, 16 Sep 2008) | 1 line
  
  poky-fixed-revisions: bump libowl srvrev
........
  r5195 | ross | 2008-09-16 17:24:31 +0100 (Tue, 16 Sep 2008) | 1 line
  
  poky-fixed-revisions.inc: bump matchbox-desktop srvrev
........
  r5196 | richard | 2008-09-16 20:14:49 +0100 (Tue, 16 Sep 2008) | 1 line
  
  bitbake parse/__init_.py: Add missing update_mtime function fixing bitbake shell reparse failures
........
  r5197 | richard | 2008-09-16 21:09:03 +0100 (Tue, 16 Sep 2008) | 1 line
  
  ConfHandler.py: revert accidental commit
........
  r5198 | ross | 2008-09-18 10:35:14 +0100 (Thu, 18 Sep 2008) | 1 line
  
  poky-eabi.conf: add dialer to as-needed blacklist
........


git-svn-id: https://svn.o-hand.com/repos/poky/branches/elroy@5284 311d38ba-8fff-0310-9ca6-ca027cbcb966
2008-09-26 08:58:28 +00:00

85 lines
2.4 KiB
Python

"""
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 version 2 as
# published by the Free Software Foundation.
#
# 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.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Based on functions from the base bb module, Copyright 2003 Holger Schurig
__all__ = [ 'ParseError', 'SkipPackage', 'cached_mtime', 'mark_dependency',
'supports', 'handle', 'init' ]
handlers = []
import bb, os
class ParseError(Exception):
"""Exception raised when parsing fails"""
class SkipPackage(Exception):
"""Exception raised to skip this package"""
__mtime_cache = {}
def cached_mtime(f):
if not __mtime_cache.has_key(f):
__mtime_cache[f] = os.stat(f)[8]
return __mtime_cache[f]
def cached_mtime_noerror(f):
if not __mtime_cache.has_key(f):
try:
__mtime_cache[f] = os.stat(f)[8]
except OSError:
return 0
return __mtime_cache[f]
def update_mtime(f):
__mtime_cache[f] = os.stat(f)[8]
return __mtime_cache[f]
def mark_dependency(d, f):
if f.startswith('./'):
f = "%s/%s" % (os.getcwd(), f[2:])
deps = bb.data.getVar('__depends', d) or []
deps.append( (f, cached_mtime(f)) )
bb.data.setVar('__depends', 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