sconpat.py :  » Build » Waf » waf-1.5.17 » playground » compat » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Build » Waf 
Waf » waf 1.5.17 » playground » compat » sconpat.py
#! /usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006-2008 (ita)

from hashlib import md5
import Utils, Configure, Action, Task, Params

class sconpat_error(Exception):
  pass

class Builder_class(object):
  def __init__(self):
    self.action = None
    self.generator = None
  def init(self, **kw):
    if kw.has_key('generator') and kw.has_key('action'):
      raise sconpat_error, 'do not mix action and generator in a builder'

    if kw.has_key('action'):

      a = kw['action'].replace('$SOURCES', '${SRC}')
      a = a.replace('$TARGETS', '${TGT}')
      a = a.replace('$TARGET', '${TGT[0].abspath(env)}')
      a = a.replace('$SOURCE', '${SRC[0].abspath(env)}')

      m = md5()
      m.update(a)
      key = m.hexdigest()

      Action.simple_action(key, a, kw.get('color', 'GREEN'))
      self.action=key
  def apply(self, target, source, **kw):
    #print "Builder_class apply called"
    #print kw['env']
    #print target
    #print source

    curdir = Params.g_build.m_curdirnode

    t = Task.Task(self.action, kw['env'], 10)
    t.set_inputs(curdir.find_source(source, create=1))
    t.set_outputs(curdir.find_build(target, create=1))

def Builder(**kw):
  ret = Builder_class()
  ret.init(**kw)
  return ret

def Environment(**kw):
  import Environment
  ret = Environment.Environment()
  if kw.has_key('BUILDERS'):
    bd = kw['BUILDERS']
    for k in bd:
      # store the builder name on the builder
      bd[k].name = k

      def miapply(self, *lst, **kw):
        if not 'env' in kw: kw['env']=ret
        bd[k].apply(*lst, **kw)

      ret.__class__.__dict__[k]=miapply
  return ret

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.