post_one.py :  » Build » Waf » waf-1.5.17 » playground » post_one_file » 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 » post_one_file » post_one.py
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2009 (ita)

import datetime
import Task, Build, Options, Constants
from Logs import debug

# assumptions
Task.algotype = Task.MAXPARALLEL
Task.file_deps = Task.extract_deps

def set_options(opt):
  opt.add_option('--bf', type='string', default='', dest='bf', help='space-separated list of specific files to build')

old = Build.BuildContext.flush

def flush(self):
  if not Options.options.bf:
    return old(self)

  lst = Options.options.bf.split(',')

  self.ini = datetime.datetime.now()
  # force the initialization of the mapping name->object in flush
  # name_to_obj can be used in userland scripts, in that case beware of incomplete mapping
  self.task_gen_cache_names = {}
  self.name_to_obj('', self.env)

  debug('build: delayed operation TaskGen.flush() called')

  ln = self.srcnode

  for i in xrange(len(self.task_manager.groups)):
    g = self.task_manager.groups[i]
    self.task_manager.current_group = i
    for tg in g.tasks_gen:
      if not tg.path.is_child_of(ln):
        continue
      tg.post()

  # find the nodes corresponding to the names given
  nodes = []
  alltasks = []
  for i in xrange(len(self.task_manager.groups)):
    g = self.task_manager.groups[i]
    self.task_manager.current_group = i
    for t in g.tasks:
      alltasks.append(t)
      for k in t.outputs:
        if k.name in lst:
          nodes.append(k)
          break

  # and now we must perform a search over all tasks to find what might generate the nodes from the above
  while True:
    newnodes = []
    skipped = []
    for t in alltasks:
      for x in nodes:
        if x in t.outputs:
          newnodes.extend(t.inputs)
          break
      else:
        skipped.append(t)
    alltasks = skipped

    if newnodes:
      nodes = nodes + newnodes
    else:
      break

  # the tasks that need not be executed remain
  for x in alltasks:
    x.hasrun = Constants.SKIPPED

setattr(Build.BuildContext, 'flush', flush)

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