From 32aa87b3ecef292ac99d374c34e40e4b1d6b7b71 Mon Sep 17 00:00:00 2001 From: Dima Gerasimov Date: Fri, 27 Oct 2023 01:31:36 +0100 Subject: [PATCH] dcotor: make compileall check a bit more defensive --- my/core/__main__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/my/core/__main__.py b/my/core/__main__.py index 643df50..ca88513 100644 --- a/my/core/__main__.py +++ b/my/core/__main__.py @@ -174,13 +174,14 @@ See https://github.com/karlicoss/HPI/blob/master/doc/SETUP.org#setting-up-module # note: ugh, annoying that copytree requires a non-existing dir before 3.8. # once we have min version 3.8, can use dirs_exist_ok=True param tdir = Path(td) / 'cfg' - # this will resolve symlinks when copying - shutil.copytree(cfg_path, tdir) # NOTE: compileall still returns code 0 if the path doesn't exist.. # but in our case hopefully it's not an issue cmd = [sys.executable, '-m', 'compileall', '-q', str(tdir)] try: + # this will resolve symlinks when copying + # should be under try/catch since might fail if some symlinks are missing + shutil.copytree(cfg_path, tdir) check_call(cmd) info('syntax check: ' + ' '.join(cmd)) except Exception as e: