File: check-for-missing.py

package info (click to toggle)
cinnamon 6.4.13-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,300 kB
  • sloc: javascript: 54,298; ansic: 51,499; python: 21,971; xml: 2,803; sh: 96; makefile: 27; perl: 13
file content (25 lines) | stat: -rwxr-xr-x 785 bytes parent folder | download | duplicates (4)
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/python3
#
# 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.decode('utf-8').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)