s3: popt: When using a global variable, don't hide it by helper locals.
[Samba.git] / script / compare_cc_results.py
blob1ab92490426a1e6c6336134104794ba755b7f0a6
1 #!/usr/bin/env python
4 # Compare the results of native and cross-compiled configure tests
7 import sys
8 import difflib
10 exceptions = [
11 'BUILD_DIRECTORY', 'SELFTEST_PREFIX', 'defines',
12 'CROSS_COMPILE', 'CROSS_ANSWERS', 'CROSS_EXECUTE',
13 'LIBSOCKET_WRAPPER_SO_PATH',
14 'LIBNSS_WRAPPER_SO_PATH',
15 'LIBPAM_WRAPPER_SO_PATH',
16 'LIBUID_WRAPPER_SO_PATH',
17 'LIBRESOLV_WRAPPER_SO_PATH',
20 base_lines = list()
21 base_fname = ''
23 found_diff = False
25 for fname in sys.argv[1:]:
26 lines = list()
27 f = open(fname, 'r')
28 for line in f:
29 if len(line.split('=', 1)) == 2:
30 key = line.split('=', 1)[0].strip()
31 if key in exceptions:
32 continue
33 lines.append(line)
34 f.close()
35 if base_fname:
36 diff = list(difflib.unified_diff(base_lines,lines,base_fname,fname))
37 if diff:
38 print 'configuration files %s and %s do not match' % (base_fname, fname)
39 for l in diff:
40 sys.stdout.write(l)
41 found_diff = True
42 else:
43 base_fname = fname
44 base_lines = lines
46 if found_diff:
47 sys.exit(1)