import Build, Options, preproc, Logs
from Configure import conf
from TaskGen import feature
-from samba_utils import TO_LIST, GET_TARGET_TYPE, SET_TARGET_TYPE, runonce, unique_list, mkdir_p
+from samba_utils import TO_LIST, GET_TARGET_TYPE, SET_TARGET_TYPE, unique_list, mkdir_p
missing_headers = set()
# to waf a bit easier for those used to autoconf
# m4 files
-@runonce
@conf
def DEFINE(conf, d, v, add_to_cflags=False, quote=False):
'''define a config option'''
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'''
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):
implied_deps=implied_deps,
pkg=pkg)
-@runonce
@conf
def CHECK_BUNDLED_SYSTEM(conf, libname, minversion='0.0.0',
checkfunctions=None, headers=None, checkcode=None,
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
@conf
def SAMBA_CHECK_PERL(conf, mandatory=True, version=(5,0,0)):
- #
- # TODO: use the @runonce mechanism for this.
- # The problem is that @runonce currently does
- # not seem to work together with @conf...
- # So @runonce (and/or) @conf needs fixing.
- #
if "done" in done:
return
done["done"] = True
return cache[target]
-######################################################
-# this is used as a decorator to make functions only
-# run once. Based on the idea from
-# http://stackoverflow.com/questions/815110/is-there-a-decorator-to-simply-cache-function-return-values
-def runonce(function):
- runonce_ret = {}
- def runonce_wrapper(*args):
- if args in runonce_ret:
- return runonce_ret[args]
- else:
- ret = function(*args)
- runonce_ret[args] = ret
- return ret
- return runonce_wrapper
-
-
def ADD_LD_LIBRARY_PATH(path):
'''add something to LD_LIBRARY_PATH'''
if 'LD_LIBRARY_PATH' in os.environ:
-@runonce
+@Utils.run_once
def SETUP_BUILD_GROUPS(bld):
'''setup build groups used to ensure that the different build
phases happen consecutively'''
metavar="PYTHON", dest='EXTRA_PYTHON', default=None)
-@wafsamba.runonce
+@Utils.run_once
def configure(conf):
conf.env.hlist = []
conf.env.srcdir = conf.srcdir
sys.path.insert(0, srcdir + '/buildtools/wafsamba')
import wafsamba, samba_dist
-import Options
+import Options, Utils
samba_dist.DIST_DIRS('lib/replace buildtools:buildtools third_party/waf:third_party/waf')
opt.PRIVATE_EXTENSION_DEFAULT('')
opt.RECURSE('buildtools/wafsamba')
-@wafsamba.runonce
+@Utils.run_once
def configure(conf):
conf.RECURSE('buildtools/wafsamba')