2014-08-29 10:23:56 -04:00
|
|
|
#!/usr/bin/python3
|
2010-02-22 19:21:42 -05:00
|
|
|
#
|
|
|
|
# This is a simple script that we use to check for files in git
|
|
|
|
# and not in the distribution. It was previously written in shell
|
|
|
|
# and inlined in the Makefile.am, but 'git ls-files --exclude=<pattern>'
|
2011-03-06 21:39:20 -05:00
|
|
|
# was changed to no longer do anything useful, which made that
|
2010-02-22 19:21:42 -05:00
|
|
|
# too challenging to be worthwhile.
|
|
|
|
|
|
|
|
import fnmatch, os, subprocess, sys
|
|
|
|
|
|
|
|
srcdir=sys.argv[1]
|
|
|
|
distdir=sys.argv[2]
|
|
|
|
excludes=sys.argv[3:]
|
|
|
|
|
2016-06-21 15:55:06 -04:00
|
|
|
cwd=os.getcwd()
|
2010-02-22 19:21:42 -05:00
|
|
|
os.chdir(srcdir)
|
|
|
|
|
|
|
|
status=0
|
|
|
|
for f in subprocess.Popen(["git", "ls-files"], stdout=subprocess.PIPE).stdout:
|
2014-08-29 10:23:56 -04:00
|
|
|
f = f.decode('utf-8').strip()
|
2016-06-21 15:55:06 -04:00
|
|
|
if (not os.path.exists(os.path.join(cwd, distdir, f)) and
|
2010-02-22 19:21:42 -05:00
|
|
|
not any((fnmatch.fnmatch(f, p) for p in excludes))):
|
2014-08-29 10:23:56 -04:00
|
|
|
print("File missing from distribution:", f)
|
2010-02-22 19:21:42 -05:00
|
|
|
status=1
|
|
|
|
|
|
|
|
sys.exit(status)
|