Files
mongo/dist/dist.py
Keith Bostic d3a8060e5b WT-2658 Only include PPC-specific files in PPC builds (#2758)
* WT-2658 Only include PPC-specific files in PPC builds

* Add support for conditional file inclusion by adding a second argument on lines in dist/filelist.  Add a new automake conditional, POWERPC_HOST, set for the various PPC host CPUs.  Change dist/filelist to only compile the checksum/power8 files if POWERPC_HOST is set.

* Merge the Windows and POSIX file lists, use POSIX_HOST and WINDOWS_HOST to mark source files needed for builds on those systems.
2016-06-03 12:54:40 +10:00

35 lines
1.0 KiB
Python

import filecmp, glob, os, re, shutil
# source_files --
# Return a list of the WiredTiger source file names.
def source_files():
file_re = re.compile(r'^\w')
for line in glob.iglob('../src/include/*.[hi]'):
yield line
for line in open('filelist', 'r'):
if file_re.match(line):
yield os.path.join('..', line.split()[0])
for line in open('extlist', 'r'):
if file_re.match(line):
yield os.path.join('..', line.split()[0])
# source_dirs --
# Return a list of the WiredTiger source directory names.
def source_dirs():
dirs = set()
for f in source_files():
dirs.add(os.path.dirname(f))
return dirs
def print_source_dirs():
for d in source_dirs():
print d
# compare_srcfile --
# Compare two files, and if they differ, update the source file.
def compare_srcfile(tmp, src):
if not os.path.isfile(src) or not filecmp.cmp(tmp, src, shallow=False):
print('Updating ' + src)
shutil.copyfile(tmp, src)
os.remove(tmp)