[PR PATCH] build:wafsamba: Remove samba_utils.runonce

github at samba.org github at samba.org
Thu Nov 5 01:20:56 UTC 2015


There is a new pull request by ita1024 against master on the Samba Samba Github repository

https://github.com/ita1024/samba runonce
https://github.com/samba-team/samba/pull/33

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 at waf.io>

A patch file from https://github.com/samba-team/samba/pull/33.patch is attached
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: github-pr-runonce-33.patch
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20151105/f5b80bf4/github-pr-runonce-33.patch>


More information about the samba-technical mailing list