tools/makemanifest.py: Add check that freeze path is a directory.

Avoids accidentally writing

    freeze("path/to/file.py")

and getting unexpected results.
This commit is contained in:
Jim Mussared 2021-01-21 10:09:02 +11:00 committed by Damien George
parent 499e199add
commit 2aecf378be
1 changed files with 2 additions and 0 deletions

View File

@ -172,6 +172,8 @@ def mkdir(filename):
def freeze_internal(kind, path, script, opt): def freeze_internal(kind, path, script, opt):
path = convert_path(path) path = convert_path(path)
if not os.path.isdir(path):
raise FreezeError("freeze path must be a directory")
if script is None and kind == KIND_AS_STR: if script is None and kind == KIND_AS_STR:
if any(f[0] == KIND_AS_STR for f in manifest_list): if any(f[0] == KIND_AS_STR for f in manifest_list):
raise FreezeError("can only freeze one str directory") raise FreezeError("can only freeze one str directory")