summaryrefslogtreecommitdiff
path: root/tools/makemanifest.py
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2020-08-22 01:07:57 +1000
committerDamien George <damien@micropython.org>2020-08-22 11:18:48 +1000
commit448319a7450714efd72ae527e184a247a82ee39d (patch)
treea85a575efaf2a83e975ad3b6ab8edbc635124a9f /tools/makemanifest.py
parent492cf34fd860330f44a74732d89e9db8bc02a4e8 (diff)
tools/makemanifest.py: Use os.makedirs to make path for generated files.
The existing implementation of mkdir() in this file is not sophisticated enough to work correctly on all operating systems (eg Mac can raise EISDIR). Using the standard os.makedirs() function handles all cases correctly. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'tools/makemanifest.py')
-rw-r--r--tools/makemanifest.py16
1 files changed, 4 insertions, 12 deletions
diff --git a/tools/makemanifest.py b/tools/makemanifest.py
index b7d4a4d4a..377f24559 100644
--- a/tools/makemanifest.py
+++ b/tools/makemanifest.py
@@ -25,7 +25,6 @@
# THE SOFTWARE.
from __future__ import print_function
-import errno
import sys
import os
import subprocess
@@ -165,17 +164,10 @@ def get_timestamp_newest(path):
return ts_newest
-def mkdir(path):
- cur_path = ""
- for p in path.split("/")[:-1]:
- cur_path += p + "/"
- try:
- os.mkdir(cur_path)
- except OSError as er:
- if er.args[0] == errno.EEXIST:
- pass
- else:
- raise er
+def mkdir(filename):
+ path = os.path.dirname(filename)
+ if not os.path.isdir(path):
+ os.makedirs(path)
def freeze_internal(kind, path, script, opt):