From fcf4b0adb5b5c7d5c7eeb67ce2530db731fdab76 Mon Sep 17 00:00:00 2001 From: Stanislav Pankevich Date: Thu, 6 Feb 2025 23:32:49 +0100 Subject: [PATCH] Use a default cache location by web_driver_manager --- html2print/html2print.py | 6 +----- tasks.py | 13 +++++++------ 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/html2print/html2print.py b/html2print/html2print.py index fe93e42..e46d2c0 100644 --- a/html2print/html2print.py +++ b/html2print/html2print.py @@ -23,7 +23,7 @@ from webdriver_manager.core.http import HttpClient from webdriver_manager.core.os_manager import OperationSystemManager -__version__ = "0.0.7" +__version__ = "0.0.8" PATH_TO_HTML2PDF_JS = os.path.join( os.path.dirname(os.path.join(__file__)), "html2pdf_js", "html2pdf.min.js" @@ -239,10 +239,6 @@ def create_webdriver(chromedriver: Optional[str], path_to_cache_dir: str): def main(): - # By default, all driver binaries are saved to user.home/.wdm folder. - # You can override this setting and save binaries to project.root/.wdm. - os.environ["WDM_LOCAL"] = "1" - if not os.path.isfile(PATH_TO_HTML2PDF_JS): raise RuntimeError( f"Corrupted html2print package bundle. " diff --git a/tasks.py b/tasks.py index 8fe996b..4ade146 100644 --- a/tasks.py +++ b/tasks.py @@ -64,12 +64,13 @@ def build(context): context, "cd submodules/html2pdf && npm install && npm run build" ) # Windows can't do slashes for this one. - run_invoke( - context, - """ - cd html2print && mkdir html2pdf_js - """, - ) + if not os.path.isdir(os.path.join("html2print", "html2pdf_js")): + run_invoke( + context, + """ + cd html2print && mkdir html2pdf_js + """, + ) run_invoke( context, """