~ubuntu-branches/ubuntu/trusty/enigmail/trusty-updates

« back to all changes in this revision

Viewing changes to build/pymake/pymake/parserdata.py

  • Committer: Package Import Robot
  • Author(s): Chris Coulson
  • Date: 2011-06-07 14:35:53 UTC
  • mfrom: (0.12.1 upstream)
  • Revision ID: package-import@ubuntu.com-20110607143553-fbgqhhvh8g8h6j1y
Tags: 2:1.2~a2~cvs20110606t2200-0ubuntu1
* Update to latest trunk snapshot for Thunderbird beta compat

* Remove build/pgo/profileserver.py from debian/clean. The new build
  system has a target depending on this
  - update debian/clean
* Drop debian/patches/autoconf.diff, just generate this at build time
* Refresh debian/patches/build_system_dont_link_libxul.diff
* libipc seems to be renamed to libipc-pipe. Fix genxpi and chrome.manifest
  to fix this 
  - add debian/patches/ipc-pipe_rename.diff
  - update debian/patches/series
* The makefiles in extensions/enigmail/ipc have an incorrect DEPTH
  attribute. Fix this so that they can find the rest of the build system
  - add debian/patches/makefile_depth.diff
  - update debian/patches/series
* Drop debian/patches/makefile-in-empty-xpcom-fix.diff - fixed in the
  current version
* Don't register a class ID multiple times, as this breaks enigmail entirely
  - add debian/patches/dont_register_cids_multiple_times.diff
  - update debian/patches/series
* Look for the Thunderbird 5 SDK
  - update debian/rules
  - update debian/control
* Run autoconf2.13 at build time
  - update debian/rules
  - update debian/control
* Add useless mesa-common-dev build-dep, just to satisfy the build system.
  We should just patch this out entirely really, but that's for another upload
  - update debian/control

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
import logging, re, os
2
 
import data, functions, util, parser
 
2
import data, parser, functions, util
3
3
from cStringIO import StringIO
4
4
from pymake.globrelative import hasglob, glob
5
5
 
21
21
        self.line = line
22
22
        self.column = column
23
23
 
24
 
    def __add__(self, data):
 
24
    def offset(self, s, start, end):
25
25
        """
26
26
        Returns a new location offset by
27
27
        the specified string.
28
28
        """
29
29
 
30
 
        if data == '':
 
30
        if start == end:
31
31
            return self
32
32
        
33
 
        skiplines = data.count('\n')
 
33
        skiplines = s.count('\n', start, end)
34
34
        line = self.line + skiplines
35
35
        if skiplines:
36
 
            lastnl = data.rfind('\n')
 
36
            lastnl = s.rfind('\n', start, end)
37
37
            assert lastnl != -1
38
 
            data = data[lastnl + 1:]
 
38
            start = lastnl + 1
39
39
            column = 0
40
40
        else:
41
41
            column = self.column
42
42
 
43
 
        i = 0
44
43
        while True:
45
 
            j = data.find('\t', i)
 
44
            j = s.find('\t', start, end)
46
45
            if j == -1:
47
 
                column += len(data) - i
 
46
                column += end - start
48
47
                break
49
48
 
50
 
            column += j - i
 
49
            column += j - start
51
50
            column += _tabwidth
52
51
            column -= column % _tabwidth
53
 
            i = j + 1
 
52
            start = j + 1
54
53
 
55
54
        return Location(self.path, line, column)
56
55
 
135
134
            raise data.DataError("Mixed implicit and normal rule", self.targetexp.loc)
136
135
        ispattern, = ispatterns
137
136
 
 
137
        if ispattern and context.weak:
 
138
            raise data.DataError("Pattern rules not allowed in includedeps", self.targetexp.loc)
 
139
 
138
140
        deps = [p for p in _expandwildcards(makefile, data.stripdotslashes(self.depexp.resolvesplit(makefile, makefile.variables)))]
139
141
        if ispattern:
140
142
            rule = data.PatternRule(targets, map(data.Pattern, deps), self.doublecolon, loc=self.targetexp.loc)
141
143
            makefile.appendimplicitrule(rule)
142
144
        else:
143
 
            rule = data.Rule(deps, self.doublecolon, loc=self.targetexp.loc)
 
145
            rule = data.Rule(deps, self.doublecolon, loc=self.targetexp.loc, weakdeps=context.weak)
144
146
            for t in targets:
145
147
                makefile.gettarget(t.gettarget()).addrule(rule)
 
148
 
146
149
            makefile.foundtarget(targets[0].gettarget())
147
150
 
148
151
        context.currule = rule
164
167
        self.doublecolon = doublecolon
165
168
 
166
169
    def execute(self, makefile, context):
 
170
        if context.weak:
 
171
            raise data.DataError("Static pattern rules not allowed in includedeps", self.targetexp.loc)
 
172
 
167
173
        targets = list(_expandwildcards(makefile, data.stripdotslashes(self.targetexp.resolvesplit(makefile, makefile.variables))))
168
174
 
169
175
        if not len(targets):
202
208
 
203
209
    def execute(self, makefile, context):
204
210
        assert context.currule is not None
 
211
        if context.weak:
 
212
            raise data.DataError("rules not allowed in includedeps", self.exp.loc)
 
213
 
205
214
        context.currule.addcommand(self.exp)
206
215
 
207
216
    def dump(self, fd, indent):
336
345
        self.addcondition(loc, condition)
337
346
 
338
347
    def getloc(self):
339
 
        return self._groups[0][0].loc
 
348
        return self.loc
340
349
 
341
350
    def addcondition(self, loc, condition):
342
351
        assert isinstance(condition, Condition)
 
352
        condition.loc = loc
343
353
 
344
354
        if len(self._groups) and isinstance(self._groups[-1][0], ElseCondition):
345
355
            raise parser.SyntaxError("Multiple else conditions for block starting at %s" % self.loc, loc)
369
379
            print >>fd, "%s ~Condition" % (indent,)
370
380
        print >>fd, "%s~ConditionBlock" % (indent,)
371
381
 
 
382
    def __iter__(self):
 
383
        return iter(self._groups)
 
384
 
 
385
    def __len__(self):
 
386
        return len(self._groups)
 
387
 
 
388
    def __getitem__(self, i):
 
389
        return self._groups[i]
 
390
 
372
391
class Include(Statement):
373
 
    __slots__ = ('exp', 'required')
 
392
    __slots__ = ('exp', 'required', 'deps')
374
393
 
375
 
    def __init__(self, exp, required):
 
394
    def __init__(self, exp, required, weak):
376
395
        assert isinstance(exp, (data.Expansion, data.StringExpansion))
377
396
        self.exp = exp
378
397
        self.required = required
 
398
        self.weak = weak
379
399
 
380
400
    def execute(self, makefile, context):
381
401
        files = self.exp.resolvesplit(makefile, makefile.variables)
382
402
        for f in files:
383
 
            makefile.include(f, self.required, loc=self.exp.loc)
 
403
            makefile.include(f, self.required, loc=self.exp.loc, weak=self.weak)
384
404
 
385
405
    def dump(self, fd, indent):
386
406
        print >>fd, "%sInclude %s" % (indent, self.exp)
462
482
        print >>fd, "%sEmptyDirective: %s" % (indent, self.exp)
463
483
 
464
484
class _EvalContext(object):
465
 
    __slots__ = ('currule',)
 
485
    __slots__ = ('currule', 'weak')
 
486
 
 
487
    def __init__(self, weak):
 
488
        self.weak = weak
466
489
 
467
490
class StatementList(list):
468
491
    __slots__ = ('mtime',)
471
494
        assert isinstance(statement, Statement)
472
495
        list.append(self, statement)
473
496
 
474
 
    def execute(self, makefile, context=None):
 
497
    def execute(self, makefile, context=None, weak=False):
475
498
        if context is None:
476
 
            context = _EvalContext()
 
499
            context = _EvalContext(weak=weak)
477
500
 
478
501
        for s in self:
479
502
            s.execute(makefile, context)
486
509
        fd = StringIO()
487
510
        self.dump(fd, '')
488
511
        return fd.getvalue()
 
512
 
 
513
def iterstatements(stmts):
 
514
    for s in stmts:
 
515
        yield s
 
516
        if isinstance(s, ConditionBlock):
 
517
            for c, sl in s:
 
518
                for s2 in iterstatments(sl): yield s2