From 3987569456ff3b0cfed0f2a85a6ded6ab7608f42 Mon Sep 17 00:00:00 2001 From: Ross McNairn Date: Fri, 31 May 2024 14:56:55 +0100 Subject: [PATCH] parametrise target path --- src/python_redlines/engines.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/python_redlines/engines.py b/src/python_redlines/engines.py index 4c3f3a0..be80512 100644 --- a/src/python_redlines/engines.py +++ b/src/python_redlines/engines.py @@ -14,7 +14,8 @@ class XmlPowerToolsEngine(object): - def __init__(self): + def __init__(self, target_path: Optional[str] = None): + self.target_path = target_path self.extracted_binaries_path = self.__unzip_binary() def __unzip_binary(self): @@ -23,7 +24,7 @@ def __unzip_binary(self): """ base_path = os.path.dirname(__file__) binaries_path = os.path.join(base_path, 'dist') - target_path = os.path.join(base_path, 'bin') + target_path = self.target_path if self.target_path else os.path.join(base_path, 'bin') if not os.path.exists(target_path): os.makedirs(target_path) @@ -47,7 +48,6 @@ def __extract_binary(self, zip_path: str, target_path: str): zip_path: str - The path to the zip file target_path: str - The path to extract the binary to """ - print(f"") if zip_path.endswith('.zip'): with zipfile.ZipFile(zip_path, 'r') as zip_ref: zip_ref.extractall(target_path)