File: check-for-missing.py

package info (click to toggle)
cinnamon 3.2.7-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 11,624 kB
  • sloc: ansic: 33,269; python: 18,048; xml: 1,504; makefile: 780; sh: 90; cpp: 54
file content (25 lines) | stat: -rwxr-xr-x 754 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/python2
#
# This is a simple script that we use to check for files in git
# and not in the distribution. It was previously written in cinnamon
# and inlined in the Makefile.am, but 'git ls-files --exclude=<pattern>'
# was changed to no longer do anything useful, which made that
# too challenging to be worthwhile.

import fnmatch, os, subprocess, sys

srcdir=sys.argv[1]
distdir=sys.argv[2]
excludes=sys.argv[3:]

os.chdir(srcdir)

status=0
for f in subprocess.Popen(["git", "ls-files"], stdout=subprocess.PIPE).stdout:
    f = f.strip()
    if (not os.path.exists(os.path.join(distdir, f)) and
        not any((fnmatch.fnmatch(f, p) for p in excludes))):
        print "File missing from distribution:", f
        status=1

sys.exit(status)