Skip to content

Commit

Permalink
nit(signingscript): Revert utils.mkdir parameter for deleting before …
Browse files Browse the repository at this point in the history
…creating
  • Loading branch information
hneiva committed Apr 25, 2024
1 parent c26bafa commit df02a5c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
8 changes: 5 additions & 3 deletions signingscript/src/signingscript/sign.py
Original file line number Diff line number Diff line change
Expand Up @@ -1643,7 +1643,7 @@ async def apple_notarize(context, path, *args, **kwargs):
"""
# Setup workdir
notarization_workdir = os.path.join(context.config["work_dir"], "apple_notarize")
utils.mkdir(notarization_workdir, delete_before_create=True)
utils.mkdir(notarization_workdir)

_, extension = os.path.splitext(path)
if extension == ".pkg":
Expand All @@ -1659,7 +1659,8 @@ async def apple_notarize_geckodriver(context, path, *args, **kwargs):
"""
# Setup workdir
notarization_workdir = os.path.join(context.config["work_dir"], "apple_notarize")
utils.mkdir(notarization_workdir, delete_before_create=True)
shutil.rmtree(notarization_workdir, ignore_errors=True)
utils.mkdir(notarization_workdir)

return await _notarize_geckodriver(context, path, notarization_workdir)

Expand All @@ -1681,7 +1682,8 @@ async def apple_notarize_stacked(context, filelist_dict):
task_index += 1
relpath_index_map[relpath] = task_index
notarization_workdir = os.path.join(context.config["work_dir"], f"apple_notarize-{task_index}")
utils.mkdir(notarization_workdir, delete_before_create=True)
shutil.rmtree(notarization_workdir, ignore_errors=True)
utils.mkdir(notarization_workdir)
_, extension = os.path.splitext(relpath)
if extension == ".pkg":
path = os.path.join(notarization_workdir, relpath)
Expand Down
6 changes: 1 addition & 5 deletions signingscript/src/signingscript/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import json
import logging
import os
import shutil
from asyncio.subprocess import PIPE, STDOUT
from dataclasses import dataclass
from shutil import copyfile
Expand Down Expand Up @@ -36,15 +35,12 @@ class AppleNotarization:
private_key: str


def mkdir(path, delete_before_create=False):
def mkdir(path):
"""Equivalent to `mkdir -p`.
Args:
path (str): the path to mkdir
delete_before_create (bool, optional): whether to delete the path before creating it. Defaults to False
"""
if delete_before_create:
shutil.rmtree(path, ignore_errors=True)
try:
os.makedirs(path)
log.info("mkdir {}".format(path))
Expand Down

0 comments on commit df02a5c

Please sign in to comment.