2018-10-09 16:19:30 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
'''
|
2018-10-09 19:10:23 +00:00
|
|
|
This script checks every role in the (Internet-in-a-Box) project and prints its
|
|
|
|
name to stdout if (1) the role directory does not contain a README file, and
|
|
|
|
(2) the role is not listed in /opt/iiab/iiab/unmaintained-roles.txt
|
2018-10-09 16:19:30 +00:00
|
|
|
|
|
|
|
For ease of use, you can pipe the output of this script to a file or to a
|
|
|
|
clipboard utility (e.g. pbcopy on macOS, xclip on Linux).
|
|
|
|
'''
|
|
|
|
|
2018-10-09 17:16:45 +00:00
|
|
|
import os
|
|
|
|
from os.path import join as make_path
|
|
|
|
from glob import glob
|
2018-10-09 16:19:30 +00:00
|
|
|
|
2018-10-09 17:16:45 +00:00
|
|
|
def included_roles():
|
2018-10-09 18:57:23 +00:00
|
|
|
all_roles = set(os.listdir("/opt/iiab/iiab/roles"))
|
2018-10-09 17:16:45 +00:00
|
|
|
excluded_roles = \
|
2018-10-09 19:10:23 +00:00
|
|
|
map(str.rstrip,
|
|
|
|
open(make_path("/opt/iiab/iiab/scripts",
|
|
|
|
"/opt/iiab/iiab/unmaintained-roles.txt")))
|
2018-10-09 17:16:45 +00:00
|
|
|
included_roles = list(all_roles.difference(excluded_roles))
|
|
|
|
included_roles.sort()
|
|
|
|
return included_roles
|
|
|
|
|
|
|
|
for role in included_roles():
|
2018-10-09 18:57:23 +00:00
|
|
|
readme = make_path("/opt/iiab/iiab/roles", role, "README.*")
|
2018-10-09 17:16:45 +00:00
|
|
|
if not glob(readme):
|
2018-10-09 16:19:30 +00:00
|
|
|
print(role)
|