#!/usr/bin/env python
# -*- coding: utf-8 -*-

import io
import os
import typing

import setuptools

# --- Helper to read requirements files ---


def read_requirements(filename: str) -> typing.List[str]:
    """
    Read a requirements file and return a list of dependency strings,
    filtering out comments and blank lines.

    Parameters
    ----------
    filename : str
        The path to the requirements file.

    Returns
    -------
    List[str]
        A list of dependency strings.
    """
    with open(filename, "r") as f:
        return [
            line.strip()
            for line in f
            if line.strip() and not line.strip().startswith("#")
        ]


# --- Determine the base directory ---
here = os.path.abspath(os.path.dirname(__file__))

# --- Read long description from README.md (if exists) ---
readme_path = os.path.join(here, "README.md")
if os.path.exists(readme_path):
    with io.open(readme_path, encoding="utf-8") as f:
        long_description = f.read()
else:
    long_description = ""


# --- Read dependencies from requirements.txt and dev-requirements.txt ---
requirements_path = os.path.join(here, "requirements.txt")
dev_requirements_path = os.path.join(here, "dev-requirements.txt")

install_requires = (
    read_requirements(requirements_path)
    if os.path.exists(requirements_path)
    else []
)
dev_requires = (
    read_requirements(dev_requirements_path)
    if os.path.exists(dev_requirements_path)
    else []
)

print("install_requires:", install_requires)

# --- Setup configuration ---
setuptools.setup(
    name="chitragupt",
    version="0.2",
    author="xsyncio",
    description="ChitraGupt: A powerful OSINT framework with a plugin-based architecture.",
    long_description=long_description,
    long_description_content_type="text/markdown",
    url="https://github.com/xsyncio/ChitraGupt",  # Replace with your repository URL
    packages=setuptools.find_packages(exclude=["tests", "docs", "examples"]),
    include_package_data=True,
    package_data={
        "chitragupt": [
            "assets/banner.txt",
            "assets/user-agents.json",
            "assets/config.json",
            "modules/sysops/commands.py",
            "modules/sysops/plugin_cmds.py",
        ],
    },
    classifiers=[
        "Development Status :: 3 - Alpha",
        "Intended Audience :: Developers",
        "Intended Audience :: Information Technology",
        "Intended Audience :: Science/Research",
        "License :: OSI Approved :: MIT License",
        "Programming Language :: Python :: 3",
        "Programming Language :: Python :: 3.7",
        "Programming Language :: Python :: 3.8",
        "Programming Language :: Python :: 3.9",
        "Programming Language :: Python :: 3.10",
        "Programming Language :: Python :: 3.11",
        "Operating System :: OS Independent",
        "Topic :: Security",
        "Topic :: Scientific/Engineering :: Information Analysis",
    ],
    python_requires=">=3.7",
    install_requires=[
        "msgspec~=0.19.0",
        "colorama~=0.4.6",
        "folium~=0.19.4",
        "langdetect~=1.0.9",
        "numpy~=2.0.2",
        "requests~=2.32.3",
        "matplotlib~=3.10.0",
        "networkx~=3.4.2",
        "nltk~=3.9.1",
        "pillow~=11.1.0",
        "pytesseract~=0.3.13",
        "dnspython~=2.7.0",
        "sentence-transformers~=3.4.1",
        "scikit-learn~=1.6.1",
        "spacy~=3.8.4",
        "transformers~=4.48.3",
        "Pygments~=2.19.1",
        "tensorflow~=2.18.0",
        "wordcloud~=1.9.4",
        "bs4~=0.0.2",
        "beautifulsoup4~=4.13.3",
        "curl_cffi~=0.7.4",
        "playwright~=1.50.0",
        "SpeechRecognition~=3.14.1",
        "dateparser~=1.2.1",
        "phonenumbers~=8.13.54",
        "PyPDF2~=3.0.1",
        "crypto~=1.4.1",
        "textblob~=0.19.0",
        "lxml~=5.3.1",
        "tldextract~=5.1.3",
        "opencv-python~=4.11.0.86",
        "ImageHash~=4.3.2",
        "aiofiles~=24.1.0",
        "prompt_toolkit~=3.0.50",
    ],
    entry_points={
        "console_scripts": [
            "chitragupt = chitragupt.__main__:main",
        ],
    },
)
