Skip to content

Commit 6b92294

Browse files
committed
DES-6613 Create destination dir if it doesn't exist.
1 parent a4d7ab3 commit 6b92294

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

build.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -189,12 +189,15 @@ def parse_version(version):
189189
return tuple([ int(n) for n in version.split('.') ])
190190

191191
def prepare_destination(destination_path):
192-
with os.scandir(destination_path) as entries:
193-
for entry in entries:
194-
if entry.is_dir() and not entry.is_symlink():
195-
shutil.rmtree(entry.path)
196-
else:
197-
os.remove(entry.path)
192+
if os.path.exists(destination_path):
193+
with os.scandir(destination_path) as entries:
194+
for entry in entries:
195+
if entry.is_dir() and not entry.is_symlink():
196+
shutil.rmtree(entry.path)
197+
else:
198+
os.remove(entry.path)
199+
else:
200+
os.makedirs(destination_path, 0o755)
198201
project_path = os.path.join(destination_path, 'project')
199202
os.mkdir(project_path, 0o755)
200203
shutil.copytree('scripts', os.path.join(destination_path, 'scripts'))

0 commit comments

Comments
 (0)