зеркало из https://github.com/mozilla/pjs.git
Update pymake snapshot to r293.
This commit is contained in:
Родитель
48e64ed479
Коммит
6da18a5ee4
|
@ -105,9 +105,13 @@ class _MakeContext(object):
|
|||
makeflags=self.makeflags,
|
||||
makeoverrides=self.overrides,
|
||||
workdir=self.workdir,
|
||||
context=self.context, env=self.env, makelevel=self.makelevel,
|
||||
targets=self.targets, keepgoing=self.options.keepgoing,
|
||||
silent=self.options.silent)
|
||||
context=self.context,
|
||||
env=self.env,
|
||||
makelevel=self.makelevel,
|
||||
targets=self.targets,
|
||||
keepgoing=self.options.keepgoing,
|
||||
silent=self.options.silent,
|
||||
justprint=self.options.justprint)
|
||||
|
||||
self.restarts += 1
|
||||
|
||||
|
@ -189,6 +193,9 @@ def main(args, env, cwd, cb):
|
|||
dest="printdir", default=True)
|
||||
op.add_option('-s', '--silent', action="store_true",
|
||||
dest="silent", default=False)
|
||||
op.add_option('-n', '--just-print', '--dry-run', '--recon',
|
||||
action="store_true",
|
||||
dest="justprint", default=False)
|
||||
|
||||
options, arguments1 = op.parse_args(parsemakeflags(env))
|
||||
options, arguments2 = op.parse_args(args, values=options)
|
||||
|
@ -215,6 +222,9 @@ def main(args, env, cwd, cb):
|
|||
shortflags.append('s')
|
||||
options.printdir = False
|
||||
|
||||
if options.justprint:
|
||||
shortflags.append('n')
|
||||
|
||||
loglevel = logging.WARNING
|
||||
if options.verbose:
|
||||
loglevel = logging.DEBUG
|
||||
|
|
|
@ -1212,13 +1212,13 @@ def getcommandsforrule(rule, target, makefile, prerequisites, stem):
|
|||
cstring = c.resolvestr(makefile, v)
|
||||
for cline in splitcommand(cstring):
|
||||
cline, isHidden, isRecursive, ignoreErrors, isNative = findmodifiers(cline)
|
||||
if isHidden or makefile.silent:
|
||||
if (isHidden or makefile.silent) and not makefile.justprint:
|
||||
echo = None
|
||||
else:
|
||||
echo = "%s$ %s" % (c.loc, cline)
|
||||
if not isNative:
|
||||
yield _CommandWrapper(cline, ignoreErrors=ignoreErrors, env=env, cwd=makefile.workdir, loc=c.loc, context=makefile.context,
|
||||
echo=echo)
|
||||
echo=echo, justprint=makefile.justprint)
|
||||
else:
|
||||
f, s, e = v.get("PYCOMMANDPATH", True)
|
||||
if e:
|
||||
|
@ -1226,7 +1226,8 @@ def getcommandsforrule(rule, target, makefile, prerequisites, stem):
|
|||
yield _NativeWrapper(cline, ignoreErrors=ignoreErrors,
|
||||
env=env, cwd=makefile.workdir,
|
||||
loc=c.loc, context=makefile.context,
|
||||
echo=echo, pycommandpath=e)
|
||||
echo=echo, justprint=makefile.justprint,
|
||||
pycommandpath=e)
|
||||
|
||||
class Rule(object):
|
||||
"""
|
||||
|
@ -1372,7 +1373,7 @@ class Makefile(object):
|
|||
def __init__(self, workdir=None, env=None, restarts=0, make=None,
|
||||
makeflags='', makeoverrides='',
|
||||
makelevel=0, context=None, targets=(), keepgoing=False,
|
||||
silent=False):
|
||||
silent=False, justprint=False):
|
||||
self.defaulttarget = None
|
||||
|
||||
if env is None:
|
||||
|
@ -1387,6 +1388,7 @@ class Makefile(object):
|
|||
self._targets = {}
|
||||
self.keepgoing = keepgoing
|
||||
self.silent = silent
|
||||
self.justprint = justprint
|
||||
self._patternvariables = [] # of (pattern, variables)
|
||||
self.implicitrules = []
|
||||
self.parsingfinished = False
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
"""
|
||||
Implicit variables; perhaps in the future this will also include some implicit
|
||||
rules, at least match-anything cancellation rules.
|
||||
"""
|
||||
|
||||
variables = {
|
||||
'MKDIR': '%pymake.builtins mkdir',
|
||||
'RM': '%pymake.builtins rm -f',
|
||||
'SLEEP': '%pymake.builtins sleep',
|
||||
'TOUCH': '%pymake.builtins touch',
|
||||
'.LIBPATTERNS': 'lib%.so lib%.a',
|
||||
'.PYMAKE': '1',
|
||||
}
|
||||
|
||||
"""
|
||||
Implicit variables; perhaps in the future this will also include some implicit
|
||||
rules, at least match-anything cancellation rules.
|
||||
"""
|
||||
|
||||
variables = {
|
||||
'MKDIR': '%pymake.builtins mkdir',
|
||||
'RM': '%pymake.builtins rm -f',
|
||||
'SLEEP': '%pymake.builtins sleep',
|
||||
'TOUCH': '%pymake.builtins touch',
|
||||
'.LIBPATTERNS': 'lib%.so lib%.a',
|
||||
'.PYMAKE': '1',
|
||||
}
|
||||
|
||||
|
|
|
@ -14,18 +14,20 @@ if sys.platform=='win32':
|
|||
|
||||
_log = logging.getLogger('pymake.process')
|
||||
|
||||
_blacklist = re.compile(r'[$><;*?[{~`|&]|\\\n')
|
||||
_escapednewlines = re.compile(r'\\\n')
|
||||
_blacklist = re.compile(r'[$><;*?[{~`|&]')
|
||||
def clinetoargv(cline):
|
||||
"""
|
||||
If this command line can safely skip the shell, return an argv array.
|
||||
@returns argv, badchar
|
||||
"""
|
||||
|
||||
m = _blacklist.search(cline)
|
||||
str = _escapednewlines.sub('', cline)
|
||||
m = _blacklist.search(str)
|
||||
if m is not None:
|
||||
return None, m.group(0)
|
||||
|
||||
args = shlex.split(cline, comments=True)
|
||||
args = shlex.split(str, comments=True)
|
||||
|
||||
if len(args) and args[0].find('=') != -1:
|
||||
return None, '='
|
||||
|
@ -40,7 +42,7 @@ shellwords = (':', '.', 'break', 'cd', 'continue', 'exec', 'exit', 'export',
|
|||
'printf', 'read', 'shopt', 'source', 'type', 'typeset',
|
||||
'ulimit', 'unalias', 'set')
|
||||
|
||||
def call(cline, env, cwd, loc, cb, context, echo):
|
||||
def call(cline, env, cwd, loc, cb, context, echo, justprint=False):
|
||||
#TODO: call this once up-front somewhere and save the result?
|
||||
shell, msys = util.checkmsyscompat()
|
||||
|
||||
|
@ -60,7 +62,8 @@ def call(cline, env, cwd, loc, cb, context, echo):
|
|||
if len(cline) > 3 and cline[1] == ':' and cline[2] == '/':
|
||||
cline = '/' + cline[0] + cline[2:]
|
||||
cline = [shell, "-c", cline]
|
||||
context.call(cline, shell=not msys, env=env, cwd=cwd, cb=cb, echo=echo)
|
||||
context.call(cline, shell=not msys, env=env, cwd=cwd, cb=cb, echo=echo,
|
||||
justprint=justprint)
|
||||
return
|
||||
|
||||
if not len(argv):
|
||||
|
@ -81,12 +84,13 @@ def call(cline, env, cwd, loc, cb, context, echo):
|
|||
else:
|
||||
executable = None
|
||||
|
||||
context.call(argv, executable=executable, shell=False, env=env, cwd=cwd, cb=cb, echo=echo)
|
||||
context.call(argv, executable=executable, shell=False, env=env, cwd=cwd, cb=cb,
|
||||
echo=echo, justprint=justprint)
|
||||
|
||||
def call_native(module, method, argv, env, cwd, loc, cb, context, echo,
|
||||
def call_native(module, method, argv, env, cwd, loc, cb, context, echo, justprint=False,
|
||||
pycommandpath=None):
|
||||
context.call_native(module, method, argv, env=env, cwd=cwd, cb=cb,
|
||||
echo=echo, pycommandpath=pycommandpath)
|
||||
echo=echo, justprint=justprint, pycommandpath=pycommandpath)
|
||||
|
||||
def statustoresult(status):
|
||||
"""
|
||||
|
@ -242,36 +246,32 @@ class ParallelContext(object):
|
|||
assert self.jcount > 1 or not len(self.pending), "Serial execution error defering %r %r %r: currently pending %r" % (cb, args, kwargs, self.pending)
|
||||
self.pending.append((cb, args, kwargs))
|
||||
|
||||
def _docall(self, argv, executable, shell, env, cwd, cb, echo):
|
||||
def _docall_generic(self, pool, job, cb, echo, justprint):
|
||||
if echo is not None:
|
||||
print echo
|
||||
job = PopenJob(argv, executable=executable, shell=shell, env=env, cwd=cwd)
|
||||
self.threadpool.apply_async(job_runner, args=(job,), callback=job.get_callback(ParallelContext._condition))
|
||||
processcb = job.get_callback(ParallelContext._condition)
|
||||
if justprint:
|
||||
processcb(0)
|
||||
else:
|
||||
pool.apply_async(job_runner, args=(job,), callback=processcb)
|
||||
self.running.append((job, cb))
|
||||
|
||||
def _docallnative(self, module, method, argv, env, cwd, cb, echo,
|
||||
pycommandpath=None):
|
||||
if echo is not None:
|
||||
print echo
|
||||
job = PythonJob(module, method, argv, env, cwd, pycommandpath)
|
||||
self.processpool.apply_async(job_runner, args=(job,), callback=job.get_callback(ParallelContext._condition))
|
||||
self.running.append((job, cb))
|
||||
|
||||
def call(self, argv, shell, env, cwd, cb, echo, executable=None):
|
||||
def call(self, argv, shell, env, cwd, cb, echo, justprint=False, executable=None):
|
||||
"""
|
||||
Asynchronously call the process
|
||||
"""
|
||||
|
||||
self.defer(self._docall, argv, executable, shell, env, cwd, cb, echo)
|
||||
job = PopenJob(argv, executable=executable, shell=shell, env=env, cwd=cwd)
|
||||
self.defer(self._docall_generic, self.threadpool, job, cb, echo, justprint)
|
||||
|
||||
def call_native(self, module, method, argv, env, cwd, cb,
|
||||
echo, pycommandpath=None):
|
||||
echo, justprint=False, pycommandpath=None):
|
||||
"""
|
||||
Asynchronously call the native function
|
||||
"""
|
||||
|
||||
self.defer(self._docallnative, module, method, argv, env, cwd, cb,
|
||||
echo, pycommandpath)
|
||||
job = PythonJob(module, method, argv, env, cwd, pycommandpath)
|
||||
self.defer(self._docall_generic, self.processpool, job, cb, echo, justprint)
|
||||
|
||||
@staticmethod
|
||||
def _waitany(condition):
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#T returncode: 1
|
||||
#T returncode: 2
|
||||
all:
|
||||
mkdir newdir/subdir
|
||||
test ! -d newdir/subdir
|
||||
|
|
|
@ -78,12 +78,15 @@ def runTest(makefile, make, logfile, options):
|
|||
logfd.close()
|
||||
|
||||
if stdout.find('TEST-FAIL') != -1:
|
||||
print stdout
|
||||
return False, "FAIL (TEST-FAIL printed)"
|
||||
|
||||
if options['grepfor'] and stdout.find(options['grepfor']) == -1:
|
||||
return False, "FAIL (%s not in output)" % options['grepfor']
|
||||
print stdout
|
||||
return False, "FAIL (%s not in output)" % options['grepfor']
|
||||
|
||||
if options['returncode'] == 0 and stdout.find('TEST-PASS') == -1:
|
||||
print stdout
|
||||
return False, 'FAIL (No TEST-PASS printed)'
|
||||
|
||||
if options['returncode'] != 0:
|
||||
|
@ -123,6 +126,7 @@ for makefile in makefiles:
|
|||
|
||||
mdata = open(makefile)
|
||||
for line in mdata:
|
||||
line = line.strip()
|
||||
m = tre.search(line)
|
||||
if m is None:
|
||||
break
|
||||
|
|
Загрузка…
Ссылка в новой задаче