~ubuntu-branches/ubuntu/oneiric/lightning-extension/oneiric-proposed

« back to all changes in this revision

Viewing changes to mozilla/build/pymake/pymake/process.py

  • Committer: Package Import Robot
  • Author(s): Chris Coulson
  • Date: 2011-12-29 12:14:14 UTC
  • mfrom: (1.1.12)
  • Revision ID: package-import@ubuntu.com-20111229121414-q6pyb0vyeprgpl4e
Tags: 1.1+build1-0ubuntu0.11.10.1
* New upstream stable release (CALENDAR_1_1_BUILD1) (LP: #909599)

* Refresh debian/patches/02_fix_system_libxul_build.patch
* Add debian/patches/03_maxversion_override.patch to ensure compatibility
  with Thunderbird 9 point releases
* Add the new python IDL parser to the tarball
  - update debian/rules

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 
6
6
#TODO: ship pyprocessing?
7
7
import multiprocessing, multiprocessing.dummy
8
 
import subprocess, shlex, re, logging, sys, traceback, os, imp
 
8
import subprocess, shlex, re, logging, sys, traceback, os, imp, glob
9
9
# XXXkhuey Work around http://bugs.python.org/issue1731717
10
10
subprocess._cleanup = lambda: None
11
11
import command, util
15
15
_log = logging.getLogger('pymake.process')
16
16
 
17
17
_escapednewlines = re.compile(r'\\\n')
18
 
_blacklist = re.compile(r'[$><;*?[{~`|&]')
 
18
_blacklist = re.compile(r'[$><;[{~`|&]')
 
19
_needsglob = re.compile(r'[\*\?]')
19
20
def clinetoargv(cline):
20
21
    """
21
22
    If this command line can safely skip the shell, return an argv array.
34
35
 
35
36
    return args, None
36
37
 
 
38
def doglobbing(args, cwd):
 
39
    """
 
40
    Perform any needed globbing on the argument list passed in
 
41
    """
 
42
    globbedargs = []
 
43
    for arg in args:
 
44
        if _needsglob.search(arg):
 
45
            globbedargs.extend(glob.glob(os.path.join(cwd, arg)))
 
46
        else:
 
47
            globbedargs.append(arg)
 
48
 
 
49
    return globbedargs
 
50
 
37
51
shellwords = (':', '.', 'break', 'cd', 'continue', 'exec', 'exit', 'export',
38
52
              'getopts', 'hash', 'pwd', 'readonly', 'return', 'shift', 
39
53
              'test', 'times', 'trap', 'umask', 'unset', 'alias',
55
69
            shellreason = "command contains shell-special character '%s'" % (badchar,)
56
70
        elif len(argv) and argv[0] in shellwords:
57
71
            shellreason = "command starts with shell primitive '%s'" % (argv[0],)
 
72
        else:
 
73
            argv = doglobbing(argv, cwd)
58
74
 
59
75
    if shellreason is not None:
60
76
        _log.debug("%s: using shell: %s: '%s'", loc, shellreason, cline)
89
105
 
90
106
def call_native(module, method, argv, env, cwd, loc, cb, context, echo, justprint=False,
91
107
                pycommandpath=None):
 
108
    argv = doglobbing(argv, cwd)
92
109
    context.call_native(module, method, argv, env=env, cwd=cwd, cb=cb,
93
110
                        echo=echo, justprint=justprint, pycommandpath=pycommandpath)
94
111
 
199
216
            return e.exitcode
200
217
        except:
201
218
            print >>sys.stderr, sys.exc_info()[1]
 
219
            print >>sys.stderr, traceback.print_exc()
202
220
            return -127
203
221
        finally:
204
222
            os.environ = oldenv