diff options
author | Thomas Nagy <tnagy@waf.io> | 2015-11-05 02:06:42 +0100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2015-11-06 10:37:24 +0100 |
commit | 963ccff806cf58898cdc8808138453d95df41b01 (patch) | |
tree | bebdc7816ef2d46c13d85b1a0dabf8c06c9213c1 /buildtools/wafsamba/samba_bundled.py | |
parent | 1f4f081b7aa7cbb8c9f92f0c5e39a870a5c1c6a3 (diff) | |
download | samba-963ccff806cf58898cdc8808138453d95df41b01.tar.gz |
build:wafsamba: Remove samba_utils.runonce
The decorator order matters in the following:
"""
@runonce
@conf
function()
"""
First, the @conf decorator binds the function to the configuration context
and then returns the same function. The @runonce decorator then takes
the output function and replaces it by another that performs caching. This new
function remains in the current script and is never bound to the configuration
context, so caching never occurs.
The declaration would have been correct if written like this:
"""
@conf
@runonce
function()
"""
Yet the decorator @run_once does not keep the function name (__name__), so the
annotation with @conf would fail. The straightforward approach is to remove
all the incorrect @runonce occurrences.
Besides that, the function Utils.run_once is already present in the Waf library,
and is sufficient for the current needs of the Samba code (it caches only the
first argument). Therefore samba_utils.runonce can be safely replaced by
Utils.run_once, which is also present in Waf 1.8.
Note: at runtime, only SETUP_BUILD_GROUPS seems to actually use caching.
Signed-off-by: Thomas Nagy <tnagy@waf.io>
Reviewed-by: Uri Simchoni uri@samba.org
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'buildtools/wafsamba/samba_bundled.py')
-rw-r--r-- | buildtools/wafsamba/samba_bundled.py | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/buildtools/wafsamba/samba_bundled.py b/buildtools/wafsamba/samba_bundled.py index bfc7ecc8bc7..ea88807578f 100644 --- a/buildtools/wafsamba/samba_bundled.py +++ b/buildtools/wafsamba/samba_bundled.py @@ -3,7 +3,7 @@ import sys import Build, Options, Logs from Configure import conf -from samba_utils import TO_LIST, runonce +from samba_utils import TO_LIST def PRIVATE_NAME(bld, name, private_extension, private_library): '''possibly rename a library to include a bundled extension''' @@ -108,7 +108,6 @@ def LIB_MUST_BE_PRIVATE(conf, libname): return ('ALL' in conf.env.PRIVATE_LIBS or libname in conf.env.PRIVATE_LIBS) -@runonce @conf def CHECK_BUNDLED_SYSTEM_PKG(conf, libname, minversion='0.0.0', onlyif=None, implied_deps=None, pkg=None): @@ -122,7 +121,6 @@ def CHECK_BUNDLED_SYSTEM_PKG(conf, libname, minversion='0.0.0', implied_deps=implied_deps, pkg=pkg) -@runonce @conf def CHECK_BUNDLED_SYSTEM(conf, libname, minversion='0.0.0', checkfunctions=None, headers=None, checkcode=None, @@ -219,7 +217,6 @@ def CHECK_BUNDLED_SYSTEM(conf, libname, minversion='0.0.0', def tuplize_version(version): return tuple([int(x) for x in version.split(".")]) -@runonce @conf def CHECK_BUNDLED_SYSTEM_PYTHON(conf, libname, modulename, minversion='0.0.0'): '''check if a python module is available on the system and |