Skip to content

Commit

Permalink
util.py refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Obijuan committed Mar 15, 2024
1 parent 5ebeeae commit ae059f9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
7 changes: 5 additions & 2 deletions apio/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,12 @@ def _load_profile(self, profile: Path):
self.packages = data # Backward compatibility

def save(self):
"""DOC: todo"""
"""Save the profile file"""

util.mkdir(self._profile_path)
# -- Create the profile folder, if it does not exist yet
path = self._profile_path.parent
if not path.exists():
path.mkdir()

with open(self._profile_path, "w", encoding="utf8") as profile:
data = {
Expand Down
15 changes: 0 additions & 15 deletions apio/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,21 +628,6 @@ def print_exception_developers(e):
click.secho(f"{e}\n", fg="yellow")


def mkdir(path):
"""DOC: TODO"""

# path = dirname(path)
path = path.parent

if not path.exists():
path.mkdir()
# if not exists(path):
# try:
# os.makedirs(path)
# except OSError:
# pass


def check_dir(_dir: Path) -> Path:
"""Check if the given path is a folder. It it does not exists
the folder is created. If no path is given the current working
Expand Down

0 comments on commit ae059f9

Please sign in to comment.