from setuptools import setup, find_packages
import os
from datetime import datetime

# 读取版本信息


# 读取README作为长描述
def get_long_description():
    """读取README.md并处理相对链接"""
    here = os.path.abspath(os.path.dirname(__file__))
    try:
        with open(os.path.join(here, 'README.md'), 'r', encoding='utf-8') as f:
            return f.read()
    except FileNotFoundError:
        return "SuiYue 文本加密解密工具"

# 读取依赖
def get_install_requires():
    """从requirements.txt读取依赖列表"""
    requires_file = os.path.join(os.path.dirname(__file__), 'requirements.txt')
    if os.path.exists(requires_file):
        with open(requires_file, 'r') as f:
            return [line.strip() for line in f if line.strip() and not line.startswith('#')]
    return ['pycryptodome>=3.9.9']

setup(
    name='suiyue',
    version='1.0.0',  # 动态获取版本号
    description='Suiyue: 文本加密解密工具，支持多种加密算法和自定义密钥。',
    long_description=get_long_description(),
    long_description_content_type='text/markdown',
    author='Sui Bo Zhu Liu',
    author_email='noreply@example.com',  # 补充邮箱（可填占位符）
    url='https://github.com/zb848/suiyue-crypto',
    project_urls={  # 添加项目的额外链接
        'Documentation': 'https://github.com/zb848/suiyue-crypto/wiki',
        'Bug Tracker': 'https://github.com/zb848/suiyue-crypto/issues',
        'Source Code': 'https://github.com/zb848/suiyue-crypto',
    },
    license='MIT',
    packages=find_packages(exclude=['tests', 'tests.*']),  # 排除测试目录
    include_package_data=True,  # 包含非Python文件
    python_requires='>=3.4',
    install_requires=get_install_requires(),
    platforms=["all"],
    classifiers=[
        'Development Status :: 5 - Production/Stable',
        'Intended Audience :: Developers',
        'Intended Audience :: Information Technology',
        'Intended Audience :: System Administrators',
        'License :: OSI Approved :: MIT License',
        'Operating System :: OS Independent',
        'Natural Language :: Chinese (Simplified)',
        'Programming Language :: Python',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.4',
        'Programming Language :: Python :: 3.5',
        'Programming Language :: Python :: 3.6',
        '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',
        'Topic :: Security :: Cryptography',
        'Topic :: Utilities',
        'Topic :: System :: Systems Administration',
        'Topic :: Text Processing',
    ],

    keywords='suiyue, encryption, decryption, cryptography',  # 扩展关键词，提高可搜索性
)