~ubuntu-branches/ubuntu/raring/xmms2/raring

« back to all changes in this revision

Viewing changes to waflib/Errors.py

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler
  • Date: 2012-11-25 19:23:15 UTC
  • mto: This revision was merged to the branch mainline in revision 51.
  • Revision ID: package-import@ubuntu.com-20121125192315-m9z6nu9wwlzrrz9z
ImportĀ upstreamĀ versionĀ 0.8+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /usr/bin/env python
 
2
# encoding: utf-8
 
3
# WARNING! Do not edit! http://waf.googlecode.com/svn/docs/wafbook/single.html#_obtaining_the_waf_file
 
4
 
 
5
import traceback,sys
 
6
class WafError(Exception):
 
7
        def __init__(self,msg='',ex=None):
 
8
                self.msg=msg
 
9
                assert not isinstance(msg,Exception)
 
10
                self.stack=[]
 
11
                if ex:
 
12
                        if not msg:
 
13
                                self.msg=str(ex)
 
14
                        if isinstance(ex,WafError):
 
15
                                self.stack=ex.stack
 
16
                        else:
 
17
                                self.stack=traceback.extract_tb(sys.exc_info()[2])
 
18
                self.stack+=traceback.extract_stack()[:-1]
 
19
                self.verbose_msg=''.join(traceback.format_list(self.stack))
 
20
        def __str__(self):
 
21
                return str(self.msg)
 
22
class BuildError(WafError):
 
23
        def __init__(self,error_tasks=[]):
 
24
                self.tasks=error_tasks
 
25
                WafError.__init__(self,self.format_error())
 
26
        def format_error(self):
 
27
                lst=['Build failed']
 
28
                for tsk in self.tasks:
 
29
                        txt=tsk.format_error()
 
30
                        if txt:lst.append(txt)
 
31
                return'\n'.join(lst)
 
32
class ConfigurationError(WafError):
 
33
        pass
 
34
class TaskRescan(WafError):
 
35
        pass
 
36
class TaskNotReady(WafError):
 
37
        pass