mirror of
https://github.com/kovidgoyal/kitty.git
synced 2024-08-17 10:30:25 +03:00
22 lines
805 B
Python
Executable File
22 lines
805 B
Python
Executable File
#!/usr/bin/env python
|
|
|
|
import subprocess
|
|
|
|
ignored = []
|
|
for line in subprocess.check_output(['git', 'status', '--ignored', '--porcelain']).decode().splitlines():
|
|
if line.startswith('!! '):
|
|
ignored.append(line[3:])
|
|
files_to_exclude = '\n'.join(ignored)
|
|
|
|
cp = subprocess.run(['git', 'check-attr', 'linguist-generated', '--stdin'],
|
|
check=True, stdout=subprocess.PIPE, input=subprocess.check_output([ 'git', 'ls-files']))
|
|
for line in cp.stdout.decode().splitlines():
|
|
if line.endswith(' true'):
|
|
files_to_exclude += '\n' + line.split(':')[0]
|
|
|
|
p = subprocess.Popen([
|
|
'cloc', '--exclude-list-file', '/dev/stdin', 'kitty', 'kittens', 'tools', 'kitty_tests', 'docs',
|
|
], stdin=subprocess.PIPE)
|
|
p.communicate(files_to_exclude.encode('utf-8'))
|
|
raise SystemExit(p.wait())
|