These..."}"""
content = ""
if path:
# Read file
with open(path, encoding="utf-8") as handle:
content = handle.read()
else:
# Download wiki page
url = "http://wiki.postmarketos.org/wiki/Devices"
content = urllib.request.urlopen(url).read().decode("utf-8")
# Split into booting and not booting
split = content.split("")
if len(split) != 2:
print("*** Failed to parse wiki page")
sys.exit(2)
return {"booting": split[0], "not_booting": split[1]}
def check_device(device, html, is_booting):
""":param is_booting: require the device to be in the booting section, not
just anywhere in the page (i.e. in the not booting
table).
:returns: True when the device is in the appropriate section."""
if device in html["booting"]:
return True
if device in html["not_booting"]:
if is_booting:
print(device + ": still in 'not booting' section (if this is a"
" merge request, your device should be in the booting"
" section already)")
return False
return True
print(device + ": not in the wiki yet.")
return False
def main():
# Parse arguments
parser = argparse.ArgumentParser()
parser.add_argument("--booting", help="devices must be in the upper table,"
" being in the 'not booting' table below is not"
" enough (all devices in pmbootstrap master should be"
" in the upper table)", action="store_true")
parser.add_argument("--path", help="instead of downloading the devices"
" page from the wiki, use a local HTML file",
default=None)
args = parser.parse_args()
# Check all devices
html = get_wiki_devices_html(args.path)
error = False
for device in get_devices():
if not check_device(device, html, args.booting):
error = True
# Ask to adjust the wiki
if error:
print("*** Wiki check failed!")
print("Thank you for porting postmarketOS to a new device! \o/")
print("")
print("Now it's time to add some documentation:")
print("1) Create a device specific wiki page as described here:")
print("