diff --git a/setup.py b/setup.py index 4a2c346d..bee477d7 100644 --- a/setup.py +++ b/setup.py @@ -1,18 +1,18 @@ from setuptools import setup, find_packages import os from pathlib import Path -import subprocess -from setuptools.command.install import install +import shutil # Create the .crawl4ai folder in the user's home directory if it doesn't exist # If the folder already exists, remove the cache folder -crawl4ai_folder = os.path.join(Path.home(), ".crawl4ai") -if os.path.exists(f"{crawl4ai_folder}/cache"): - subprocess.run(["rm", "-rf", f"{crawl4ai_folder}/cache"]) -os.makedirs(crawl4ai_folder, exist_ok=True) -os.makedirs(f"{crawl4ai_folder}/cache", exist_ok=True) +crawl4ai_folder = Path.home() / ".crawl4ai" +cache_folder = crawl4ai_folder / "cache" +if cache_folder.exists(): + shutil.rmtree(cache_folder) +crawl4ai_folder.mkdir(exist_ok=True) +cache_folder.mkdir(exist_ok=True) # Read the requirements from requirements.txt with open("requirements.txt") as f: