2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2025-01-25 01:39:59 +01:00

Set TaskBase.keep_last_cmd to keep the last command executed

This commit is contained in:
Thomas Nagy 2016-07-30 10:09:55 +02:00
parent 70e438393d
commit 7778868718
No known key found for this signature in database
GPG Key ID: 49B4C67C05277AAA
3 changed files with 8 additions and 8 deletions

View File

@ -4,6 +4,7 @@ NEW IN WAF 1.9.2
* Force qt5 static library detection with 'QT5_XCOMPILE=1 QT5_FORCE_STATIC=1 waf configure' #1588
* Remove the non-BSD code from the Waf archive file
* Update a few extensions: xcode, pytest, msvcdeps, cppcheck, win32_opts, codelite
* Store Task.last_cmd selectively, so that extensions can use them (clang_compilation_database)
NEW IN WAF 1.9.1
----------------

View File

@ -69,11 +69,6 @@ def f(tsk):
return tsk.exec_command(lst, cwd=cwdx, env=env.env or None)
'''
KEEP_LAST_CMD = False
"""
Whether the last executed command on task objects should be removed
"""
classes = {}
"""
The metaclass :py:class:`waflib.Task.store_task_type` stores all class tasks
@ -146,6 +141,11 @@ class TaskBase(evil):
hcode = ''
"""String representing an additional hash for the class representation"""
keep_last_cmd = False
"""Whether to keep the last command executed on the instance after execution.
This may be useful for certain extensions but it can a lot of memory.
"""
__slots__ = ('hasrun', 'generator')
def __init__(self, *k, **kw):
@ -690,8 +690,7 @@ class Task(TaskBase):
raise Errors.WafError(self.err_msg)
bld.node_sigs[node] = self.uid() # make sure this task produced the files in question
bld.task_sigs[self.uid()] = self.signature()
global KEEP_LAST_CMD
if not KEEP_LAST_CMD:
if not self.keep_last_cmd:
try:
del self.last_cmd
except AttributeError:

View File

@ -17,7 +17,7 @@ Usage:
import sys, os, json, shlex, pipes
from waflib import Logs, TaskGen, Task
Task.KEEP_LAST_CMD = True
Task.TaskBase.keep_last_cmd = True
if sys.hexversion >= 0x3030000:
quote = shlex.quote