Skip to content

Commit

Permalink
dcotor: make compileall check a bit more defensive
Browse files Browse the repository at this point in the history
  • Loading branch information
karlicoss committed Oct 27, 2023
1 parent 3a25c90 commit 32aa87b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions my/core/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,14 @@ def config_ok() -> bool:
# 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:
Expand Down

0 comments on commit 32aa87b

Please sign in to comment.