from setuptools import setup, find_packages
import os


# 读取版本号
def read_version():
    here = os.path.abspath(os.path.dirname(__file__))
    version_file = os.path.join(here, "lanyora", "__init__.py")

    # 使用 'utf-8' 编码读取文件
    with open(version_file, "r", encoding="utf-8") as f:
        for line in f:
            if line.startswith("__version__"):
                delim = '"' if '"' in line else "'"
                return line.split(delim)[1]
    raise RuntimeError("Unable to find version string.")


# 读取 README
def read_readme():
    here = os.path.abspath(os.path.dirname(__file__))
    readme_path = os.path.join(here, "README.md")
    if os.path.exists(readme_path):
        # 使用 'utf-8' 编码读取文件
        with open(readme_path, "r", encoding="utf-8") as f:
            return f.read()
    return ""


setup(
    name="lanyora",
    version=read_version(),
    author="Lanyora",
    author_email="Lanyora@qq.com",
    description="A collection of cloud utilities and decorators",
    long_description=read_readme(),
    long_description_content_type="text/markdown",
    url="https://github.com/Lanyora/lanyora",  # 如果你有GitHub仓库
    packages=find_packages(),
    classifiers=[
        "Development Status :: 3 - Alpha",
        "Intended Audience :: Developers",
        "License :: OSI Approved :: MIT License",
        "Operating System :: OS Independent",
        "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",
        "Programming Language :: Python :: 3.12",
        "Topic :: Software Development :: Libraries :: Python Modules",
    ],
    python_requires=">=3.7",
    keywords="cloud, decorators, utilities, tools",
    project_urls={
        "Bug Reports": "https://github.com/Lanyora/lanyora/issues",
        "Source": "https://github.com/Lanyora/lanyora",
    },
)