mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-11-17 07:48:18 +01:00
Updated for pathlib
This commit is contained in:
parent
78132b29b3
commit
a54a8002f4
3 changed files with 8 additions and 10 deletions
|
@ -1,7 +1,6 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import tomli
|
||||
import platform
|
||||
from pathlib import Path
|
||||
|
@ -63,7 +62,7 @@ class Configs:
|
|||
config = configs['CONFIGS']
|
||||
|
||||
os_arch: str = config['OS_ARCH']
|
||||
download_only_path: Path = config['DOWNLOAD_ONLY_PATH']
|
||||
download_only_path: Path = Path(config['DOWNLOAD_ONLY_PATH'])
|
||||
ask_question: bool = config['ASK_QUESTION']
|
||||
installpkg: str = config['INSTALLPKG']
|
||||
reinstall: str = config['REINSTALL']
|
||||
|
@ -131,5 +130,5 @@ class Configs:
|
|||
]
|
||||
|
||||
for path in paths:
|
||||
if not os.path.isdir(path):
|
||||
os.makedirs(path)
|
||||
if not path.is_dir():
|
||||
path.mkdir(parents=True, exist_ok=True)
|
||||
|
|
|
@ -581,7 +581,7 @@ class Argparse(Configs):
|
|||
views.question()
|
||||
|
||||
self.utils.remove_folder_if_exists(Path(self.tmp_path, self.prog_name))
|
||||
self.utils.create_folder(path=self.tmp_slpkg, folder='build')
|
||||
self.utils.create_folder(self.build_path)
|
||||
print(f"The folder '{self.tmp_path}{self.prog_name}' was cleaned!")
|
||||
|
||||
raise SystemExit()
|
||||
|
|
|
@ -69,11 +69,10 @@ class Utilities(Configs):
|
|||
shutil.rmtree(folder)
|
||||
|
||||
@staticmethod
|
||||
def create_folder(path: Path, folder: str) -> None:
|
||||
""" Creates folder. """
|
||||
directory = Path(path, folder)
|
||||
if not directory.exists():
|
||||
directory.mkdir(parents=True, exist_ok=True)
|
||||
def create_folder(folder: Path) -> None:
|
||||
""" Creates folder like mkdir -p. """
|
||||
if not folder.is_dir():
|
||||
folder.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
@staticmethod
|
||||
def split_binary_pkg(package: str) -> list:
|
||||
|
|
Loading…
Reference in a new issue