# a waf tool to add autoconf-like macros to the configure section
# and for SAMBA_ macros for building libraries, binaries etc
+import errno
import os, sys, re, fnmatch, shlex, inspect
from optparse import SUPPRESS_HELP
from waflib import Build, Options, Utils, Task, Logs, Configure, Errors, Context
return ret
+def symlink(src, dst, force=True):
+ """Can create symlink by force"""
+ try:
+ os.symlink(src, dst)
+ except OSError as exc:
+ if exc.errno == errno.EEXIST and force:
+ os.remove(dst)
+ os.symlink(src, dst)
+ else:
+ raise
+
+
def mkdir_p(dir):
'''like mkdir -p'''
if not dir:
# bring in the other samba modules
from samba_utils import *
+from samba_utils import symlink
from samba_version import *
from samba_autoconf import *
from samba_patterns import *
for (source, target) in [('shared', 'shared'), ('modules', 'modules'), ('python', 'python')]:
link_target = os.path.join(conf.env.BUILD_DIRECTORY, 'default/' + target)
if not os.path.lexists(link_target):
- os.symlink('../' + source, link_target)
+ symlink('../' + source, link_target)
# get perl to put the blib files in the build directory
blib_bld = os.path.join(conf.env.BUILD_DIRECTORY, 'default/pidl/blib')
if os.path.exists(link_dst):
os.unlink(link_dst)
Logs.info("symlink: %s -> %s/%s" % (s, installdir, iname))
- os.symlink(link_src, link_dst)
+ symlink(link_src, link_dst)
Build.BuildContext.SAMBA_SCRIPT = SAMBA_SCRIPT