Ben Greear wrote:
Mkdir fails if directory already exists, which breaks (re)build on Linux, at
least.
Using this:
# Mkdir fails if dir already exists..use this instead.
def mkdir_path(path):
if not os.access(path, os.F_OK):
os.mkdirs(path)
and then calling mkdir_path instead of Execute(Mkdir
fixes the problem for me.
Hmm, haven't seen anything like this, and have done a number of
incremental rebuilds since checking it in (this is on FreeBSD).
Can you provide more details about the error, and are you using a
different SCons version?
I'm using SCons 1.2.0.d20090223 here.
mkdir_func() in SCons/Defaults.py looks as though it should ignore
EEXISTS correctly already, so I wonder why this would cause a problem.
Having said that, SCons' support for symlinks is very poor.
I fought with SCons for a while before I could get it to work, and
what's in tree is not 100% 'the SCons way' as the .so symlinks are not
in the dependency graph; they're just actions.
cheers,
BMS
Index: SConstruct
===================================================================
--- SConstruct (revision 11673)
+++ SConstruct (working copy)
@@ -208,6 +208,14 @@
SConsEnvironment.Chmod = SCons.Action.ActionFactory(os.chmod,
lambda dest, mode: 'Chmod("%s", 0%o)' % (dest, mode))
+# XXX Temporary workaround. Ben Greear reports a problem with
+# Mkdir() on Linux when the directory already exists.
+def XMkdir(path):
+ if not os.access(path, os.F_OK):
+ os.makedirs(path)
+SConsEnvironment.XMkdir = SCons.Action.ActionFactory(XMkdir,
+ lambda path: 'XMkdir("%s")' % (path))
+
def Symlink(src, link_name):
try:
os.unlink(link_name)
@@ -605,7 +613,7 @@
# $BUILDIR/lib will contain .so symlinks
#
xorp_alias_libdir = os.path.join(builddir, 'lib')
- Execute(Mkdir(xorp_alias_libdir))
+ Execute(XMkdir(xorp_alias_libdir))
env['xorp_alias_libdir'] = xorp_alias_libdir
#
# Build a further alias for the benefit of entities which
@@ -614,7 +622,7 @@
# $BUILDIR/lib/xorp/lib will point to $BUILDIR/lib
#
xorp_alias_subdir = os.path.join(xorp_alias_libdir, 'xorp')
- Execute(Mkdir(xorp_alias_subdir))
+ Execute(XMkdir(xorp_alias_subdir))
#
xorp_module_alias_libdir = os.path.join(xorp_alias_subdir, 'lib')
Execute(env.Symlink(xorp_alias_libdir, xorp_module_alias_libdir))
_______________________________________________
Xorp-hackers mailing list
[email protected]
http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/xorp-hackers