summaryrefslogtreecommitdiffstats
path: root/waflib/extras/stale.py
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-04-21 23:05:06 +0200
committerDavid Robillard <d@drobilla.net>2019-04-21 23:05:06 +0200
commit202873cf9bfdeb669365a6d76e54ad657c550fe2 (patch)
tree79db4dee998f1ef093c3e81f1d0ea708901ab96c /waflib/extras/stale.py
parentde6492738adf1794bf5fa39c1fe1ebbd167727ac (diff)
downloadsratom-202873cf9bfdeb669365a6d76e54ad657c550fe2.tar.gz
sratom-202873cf9bfdeb669365a6d76e54ad657c550fe2.tar.bz2
sratom-202873cf9bfdeb669365a6d76e54ad657c550fe2.zip
Switch to using a submodule for autowaf
Diffstat (limited to 'waflib/extras/stale.py')
m---------waflib0
-rw-r--r--waflib/extras/stale.py98
2 files changed, 0 insertions, 98 deletions
diff --git a/waflib b/waflib
new file mode 160000
+Subproject 2314e236ca6e7d94a26c3c17091da0f25f5867f
diff --git a/waflib/extras/stale.py b/waflib/extras/stale.py
deleted file mode 100644
index cac3f46..0000000
--- a/waflib/extras/stale.py
+++ /dev/null
@@ -1,98 +0,0 @@
-#! /usr/bin/env python
-# encoding: UTF-8
-# Thomas Nagy, 2006-2015 (ita)
-
-"""
-Add a pre-build hook to remove build files (declared in the system)
-that do not have a corresponding target
-
-This can be used for example to remove the targets
-that have changed name without performing
-a full 'waf clean'
-
-Of course, it will only work if there are no dynamically generated
-nodes/tasks, in which case the method will have to be modified
-to exclude some folders for example.
-
-Make sure to set bld.post_mode = waflib.Build.POST_AT_ONCE
-"""
-
-from waflib import Logs, Build
-from waflib.Runner import Parallel
-
-DYNAMIC_EXT = [] # add your non-cleanable files/extensions here
-MOC_H_EXTS = '.cpp .cxx .hpp .hxx .h'.split()
-
-def can_delete(node):
- """Imperfect moc cleanup which does not look for a Q_OBJECT macro in the files"""
- if not node.name.endswith('.moc'):
- return True
- base = node.name[:-4]
- p1 = node.parent.get_src()
- p2 = node.parent.get_bld()
- for k in MOC_H_EXTS:
- h_name = base + k
- n = p1.search_node(h_name)
- if n:
- return False
- n = p2.search_node(h_name)
- if n:
- return False
-
- # foo.cpp.moc, foo.h.moc, etc.
- if base.endswith(k):
- return False
-
- return True
-
-# recursion over the nodes to find the stale files
-def stale_rec(node, nodes):
- if node.abspath() in node.ctx.env[Build.CFG_FILES]:
- return
-
- if getattr(node, 'children', []):
- for x in node.children.values():
- if x.name != "c4che":
- stale_rec(x, nodes)
- else:
- for ext in DYNAMIC_EXT:
- if node.name.endswith(ext):
- break
- else:
- if not node in nodes:
- if can_delete(node):
- Logs.warn('Removing stale file -> %r', node)
- node.delete()
-
-old = Parallel.refill_task_list
-def refill_task_list(self):
- iit = old(self)
- bld = self.bld
-
- # execute this operation only once
- if getattr(self, 'stale_done', False):
- return iit
- self.stale_done = True
-
- # this does not work in partial builds
- if bld.targets != '*':
- return iit
-
- # this does not work in dynamic builds
- if getattr(bld, 'post_mode') == Build.POST_AT_ONCE:
- return iit
-
- # obtain the nodes to use during the build
- nodes = []
- for tasks in bld.groups:
- for x in tasks:
- try:
- nodes.extend(x.outputs)
- except AttributeError:
- pass
-
- stale_rec(bld.bldnode, nodes)
- return iit
-
-Parallel.refill_task_list = refill_task_list
-