"""
安装配置文件
"""
from setuptools import setup, find_packages
from pathlib import Path

# 读取 README
readme_file = Path(__file__).parent / "README.md"
long_description = readme_file.read_text(encoding="utf-8") if readme_file.exists() else ""

# 读取版本号
def get_version():
    version_file = Path(__file__).parent / "bilibili_dl" / "__init__.py"
    with open(version_file, encoding="utf-8") as f:
        for line in f:
            if line.startswith("__version__"):
                return line.split("=")[1].strip().strip('"').strip("'")
    return "1.1.0"

version = get_version()

setup(
    name="railgun-bili-tools",
    version=version,
    author="KC",
    author_email="1549665943@qq.com",
    description="B站视频下载工具 - 支持扫码登录、高清下载、智能目录管理",
    long_description=long_description,
    long_description_content_type="text/markdown",
    url="https://github.com/railgun9983/bilibili-download",
    project_urls={
        "Bug Reports": "https://github.com/railgun9983/bilibili-download/issues",
        "Source": "https://github.com/railgun9983/bilibili-download",
        "Documentation": "https://github.com/railgun9983/bilibili-download#readme",
    },
    packages=find_packages(exclude=["tests", "tests.*", "examples", "docs"]),
    include_package_data=True,
    classifiers=[
        "Development Status :: 4 - Beta",
        "Intended Audience :: End Users/Desktop",
        "Topic :: Multimedia :: Video",
        "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",
        "Environment :: Console",
    ],
    keywords="bilibili video download downloader b站 视频下载",
    python_requires='>=3.7',
    install_requires=[
        'requests>=2.31.0',
        'qrcode[pil]>=7.4.2',
        'cryptography>=41.0.0',
        'click>=8.1.7',
        'tqdm>=4.66.0',
        'Pillow>=10.0.0',
    ],
    extras_require={
        'dev': [
            'pytest>=7.4.0',
            'pytest-cov>=4.1.0',
            'black>=23.7.0',
            'flake8>=6.1.0',
            'mypy>=1.5.0',
        ],
    },
    entry_points={
        'console_scripts': [
            'bili-dl=bilibili_dl.cli:main',
            'bilibili-dl=bilibili_dl.cli:main',
        ],
    },
    zip_safe=False,
)
