+if update_manifest:
+ #
+ # update scons_manifest.py
+ #
+ # When you run 'scons update_manifest', it tells you which files are missing
+ # and which files are not in the source tree. It also generates a
+ # scons_manifest.py.new file with all the missing files added to
+ # XXX_extra_files. It will *not* change other sections of existing
+ # manifest.py
+ #
+ print 'Validating development/scons/scons_manifest.py...'
+ #
+ manifest = open(env.File('$TOP_SRCDIR/development/scons/scons_manifest.py.new').abspath, 'w')
+ print >> manifest, 'from SCons.Util import Split\n'
+ #
+ ignore_dirs = ['boost/boost', 'm4', 'development',
+ utils.relativePath(env.Dir('$BUILDDIR').abspath, env.Dir('$TOP_SRCDIR').abspath)]
+ ignore_types = ['.svn', '.deps', '.cache', '.tmp', '.bak', '.gmo', '.pot',
+ '.pyc', '.pyo', '.o', '_moc.cpp', 'Makefile.in', 'config.h.in',
+ 'LaTeXConfig.lyx', 'version.cpp', 'Package.cpp']
+ ext_types = ['_header_files', '_files', '_pre_files', '_post_files', '_moc_files', '_inc_files',
+ '_copied_files', '_copied_header_files', '_extra_header_files', '_extra_src_files', '_extra_files']
+ for root,path,files in os.walk(env.Dir('$TOP_SRCDIR').abspath):
+ if os.path.split(root)[-1][0] == '.' \
+ or True in [x in root for x in ignore_types] \
+ or True in [utils.isSubDir(root, x) for x in ignore_dirs]:
+ continue
+ dirname = utils.relativePath(root, env.subst('$TOP_SRCDIR')).replace(os.sep, '_')
+ if dirname == '':
+ dirname = 'TOP'
+ # files in the current manifest.py
+ cur_files = []
+ for ext in ext_types:
+ if 'copied' not in ext and dirname + ext in locals():
+ cur_files.extend(eval(dirname + ext))
+ cur_files.sort()
+ # compare files with cur_files
+ files = [x for x in files if x[0] != '.' and True not in [len(x) >= len(y) and x[-len(y):] == y for y in ignore_types]]
+ files.sort()
+ if cur_files != files:
+ missing = []
+ for f in files:
+ if f not in cur_files:
+ missing.append(f)
+ extra = []
+ for f in cur_files:
+ if f not in files:
+ extra.append(f)
+ if len(missing) > 0:
+ print 'Missing: %s in %s' % (', '.join(missing), root)
+ if dirname + '_extra_files' in locals():
+ exec('%s_extra_files.extend(missing)' % dirname)
+ else:
+ exec('%s_extra_files = missing' % dirname)
+ if len(extra) > 0:
+ print 'Extra: %s in %s' % (', '.join(extra), root)
+ # write to a new manifest file
+ for ext in ext_types:
+ if dirname + ext in locals():
+ exec('%s%s.sort()' % (dirname, ext))
+ print >> manifest, "%s%s = Split('''\n " % (dirname, ext),
+ print >> manifest, eval(r"'\n '.join(%s%s)" % (dirname, ext))
+ print >> manifest, "''')\n\n"
+ manifest.close()
+ Alias('update_manifest', None)
+
+