@@ -48,6 +48,7 @@ import tempfile
from pathlib import Path
from typing import List, Dict, Set
+from urllib.error import HTTPError
CONFIG_REMOTE_URL = "https://git.yoctoproject.org/yocto-autobuilder2/plain/config.py"
@@ -250,12 +251,18 @@ def main():
exit(1)
if args.config_from_web:
- with urllib.request.urlopen(CONFIG_REMOTE_URL) as r:
- with tempfile.TemporaryDirectory() as tempdir:
- with open(Path(tempdir) / "config.py", "wb") as conf:
- conf.write(r.read())
- sys.path.append(tempdir)
- import config
+ try:
+ with urllib.request.urlopen(CONFIG_REMOTE_URL) as r:
+ with tempfile.TemporaryDirectory() as tempdir:
+ with open(Path(tempdir) / "config.py", "wb") as conf:
+ conf.write(r.read())
+ sys.path.append(tempdir)
+ import config
+ except HTTPError as e:
+ print(f"WARNING: HTTPError when trying to fetch the config.py file from {CONFIG_REMOTE_URL}:")
+ print(e)
+ print("Safely exiting...")
+ exit(0)
else:
sys.path.append(os.path.dirname(args.config))
import config