Make possible to start without a branches dir

Signed-off-by: Mattia Rizzolo's avatarMattia Rizzolo <mattia@debian.org>
parent ed9c1f9c
# A program which manages Ubuntu-it's web test server
# Copyright (C) 2015 Pietro Albini <pietroalbini@ubuntu.com>
# © 2019 Mattia Rizzolo <mapreri@ubuntu.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
......@@ -25,16 +26,19 @@ def is_root_valid(path):
path = pathlib.Path(path)
if not (path.exists() and path.is_dir()):
print(")he specified root directory doesn't exist, please create it.")
return False
required_dirs = ["branches"]
required_files = ["config.json", "details.json", "version"]
for dir in required_dirs:
dir = path / dir
if not (dir.exists() and dir.is_dir()):
print("The required directory %s does not exist" % dir)
return False
# make sure a branches directory is available:
dir = path / 'branches'
if not dir.exists():
print('Creating the branches directory...')
dir.mkdir()
elif not dir.is_dir():
print('There is a branches file conflicting with the expected directory')
return False
for file in required_files:
file = path / file
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment