diff --git a/update.py b/update.py index a077e3fbef..c956c20313 100755 --- a/update.py +++ b/update.py @@ -50,26 +50,20 @@ from concurrent.futures import ThreadPoolExecutor from typing import Optional, Dict, List -if sys.version_info <= (3,11): - import distutils +from frontend.scripts import get_discourse_posts +import rst_table + +from codecs import open +from datetime import datetime try: - from sphinx.application import Sphinx + from sphinx.application import Sphinx # noqa: F401 except ModuleNotFoundError as e: - print("Please make sure that you have run the SphinxSetup script for your system and that you have activated the arudpilot-wiki-venv if it was created on your system") + print("Please make sure that you have run the SphinxSetup script for your system and that you have activated the", + "arudpilot-wiki-venv if it was created on your system") print(e) sys.exit(1) -from codecs import open -from datetime import datetime -# while flake8 says this is unused, distutils.dir_util.mkpath fails -# without the following import on old versions of Python: -if sys.version_info <= (3, 11): - from distutils import dir_util # noqa: F401 - -from frontend.scripts import get_discourse_posts -import rst_table - if sys.version_info < (3, 8): print("Minimum python version is 3.8") sys.exit(1) @@ -372,14 +366,14 @@ def make_backup(site, destdir, backupdestdir): debug('Backing up: %s' % wiki) targetdir = os.path.join(destdir, wiki) - distutils.dir_util.mkpath(targetdir) + os.makedirs(targetdir, exist_ok=True) if not os.path.exists(targetdir): fatal("FAIL backup when looking for folder %s" % targetdir) bkdir = os.path.join(backupdestdir, str(building_time + '-wiki-bkp'), str(wiki)) debug('Checking %s' % bkdir) - distutils.dir_util.mkpath(bkdir) + os.makedirs(bkdir, exist_ok=True) debug('Copying %s into %s' % (targetdir, bkdir)) try: subprocess.check_call(["rsync", "-a", "--delete", targetdir + "/", bkdir])