Package conary :: Package build :: Module tags
[hide private]
[frames] | no frames]

Source Code for Module conary.build.tags

  1  # 
  2  # Copyright (c) 2004-2008 rPath, Inc. 
  3  # 
  4  # This program is distributed under the terms of the Common Public License, 
  5  # version 1.0. A copy of this license should have been distributed with this 
  6  # source file in a file called LICENSE. If it is not present, the license 
  7  # is always available at http://www.rpath.com/permanent/licenses/CPL-1.0. 
  8  # 
  9  # This program is distributed in the hope that it will be useful, but 
 10  # without any warranty; without even the implied warranty of merchantability 
 11  # or fitness for a particular purpose. See the Common Public License for 
 12  # full details. 
 13  # 
 14   
 15  """ 
 16  Module implementing tag file handling 
 17  """ 
 18  import os 
 19   
 20  from conary.build import filter 
 21  from conary.lib.cfg import CfgCallBack, CfgEnum, CfgList, CfgString, ConfigFile, ParseError 
 22   
 23  EXCLUDE, INCLUDE = range(2) 
 24   
25 -class CfgImplementsItem(CfgEnum):
26 validValueDict = {'files': ('update', 'preremove', 'remove', 27 'preupdate'), 28 'handler': ('update', 'preremove'), 29 'description': ('update', 'preremove')} 30
31 - def __init__(self):
32 validValues = [] 33 for fileType, actionList in self.validValueDict.iteritems(): 34 validValues.extend(' '.join((fileType, x)) for x in actionList) 35 self.validValues = validValues 36 CfgEnum.__init__(self)
37
38 - def checkEntry(self, val):
39 if val.find(" ") < 0: 40 raise ParseError, \ 41 'missing type/action in "implements %s"' %val 42 CfgEnum.checkEntry(self, val)
43 # XXX missing check for description here 44 45 CfgImplements = CfgList(CfgImplementsItem) 46 47
48 -class CfgDataSource(CfgEnum):
49 validValues = ['args', 'stdin', 'multitag' ]
50 51
52 -class TagFile(ConfigFile):
53 - def filterCB(self, val, key):
54 if not self.macros: 55 return 56 if key == 'exclude': 57 keytype = EXCLUDE 58 elif key == 'include': 59 keytype = INCLUDE 60 self.filterlist.append((keytype, filter.Filter(val, self.macros)))
61 62 63 file = CfgString 64 name = CfgString 65 description = CfgString 66 datasource = (CfgDataSource, 'args') 67 implements = CfgImplements 68
69 - def __init__(self, filename, macros = {}, warn=False):