File: dist.py

package info (click to toggle)
wiredtiger 3.2.1-1
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 25,456 kB
  • sloc: ansic: 102,922; python: 52,573; sh: 6,915; java: 6,130; cpp: 2,311; makefile: 1,018; xml: 176
file content (68 lines) | stat: -rw-r--r-- 2,161 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
from __future__ import print_function
import filecmp, fnmatch, glob, os, re, shutil, subprocess

# 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])

# all_c_files --
#       Return list of all WiredTiger C source file names.
def all_c_files():
    file_re = re.compile(r'^\w')
    for line in glob.iglob('../src/*/*.[ci]'):
        yield line
    files = list()
    for (dirpath, dirnames, filenames) in os.walk('../test'):
        files += [os.path.join(dirpath, file) for file in filenames]
    for file in files:
        if fnmatch.fnmatch(file, '*.[ci]'):
            yield file

# all_h_files --
#       Return list of all WiredTiger C include file names.
def all_h_files():
    file_re = re.compile(r'^\w')
    for line in glob.iglob('../src/*/*.h'):
        yield line
    yield "../src/include/wiredtiger.in"
    files = list()
    for (dirpath, dirnames, filenames) in os.walk('../test'):
        files += [os.path.join(dirpath, file) for file in filenames]
    for file in files:
        if fnmatch.fnmatch(file, '*.h'):
            yield file

# 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)

# format_srcfile --
#    Format a source file.
def format_srcfile(src):
    src = os.path.abspath(src)
    subprocess.check_call(['./s_clang-format', src])