File: Errors.py

package info (click to toggle)
pyinstaller 6.18.0%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,824 kB
  • sloc: python: 41,828; ansic: 12,123; makefile: 171; sh: 131; xml: 19
file content (51 lines) | stat: -rw-r--r-- 1,248 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file

import traceback, sys


class WafError(Exception):
    def __init__(self, msg='', ex=None):
        Exception.__init__(self)
        self.msg = msg
        assert not isinstance(msg, Exception)
        self.stack = []
        if ex:
            if not msg:
                self.msg = str(ex)
            if isinstance(ex, WafError):
                self.stack = ex.stack
            else:
                self.stack = traceback.extract_tb(sys.exc_info()[2])
        self.stack += traceback.extract_stack()[:-1]
        self.verbose_msg = ''.join(traceback.format_list(self.stack))

    def __str__(self):
        return str(self.msg)


class BuildError(WafError):
    def __init__(self, error_tasks=[]):
        self.tasks = error_tasks
        WafError.__init__(self, self.format_error())

    def format_error(self):
        lst = ['Build failed']
        for tsk in self.tasks:
            txt = tsk.format_error()
            if txt:
                lst.append(txt)
        return '\n'.join(lst)


class ConfigurationError(WafError):
    pass


class TaskRescan(WafError):
    pass


class TaskNotReady(WafError):
    pass