import os
from setuptools import setup, find_packages

try:
    with open(os.path.join(os.path.dirname(__file__), 'VERSION.client')) as f:
        version = f.read().strip()
except IOError:
    version = "0.0.1.dev0"
    print(f"Warning: Could not read VERSION.client, falling back to version '{version}'")

# find_packages() will automatically discover 'ytops_client' and 'yt_ops_services'.
# We manually add the 'pangramia' packages because they are in a separate directory structure.
pangramia_packages = [
    'pangramia',
    'pangramia.base_service',
    'pangramia.yt',
    'pangramia.yt.common',
    'pangramia.yt.exceptions',
    'pangramia.yt.management',
    'pangramia.yt.tokens_ops',
]

setup(
    name='ytops-client-tools',
    version=version,
    packages=find_packages(exclude=['thrift_model*', 'tests*']) + pangramia_packages,
    package_dir={
        # This tells setuptools that the 'pangramia' package lives inside thrift_model/gen_py
        'pangramia': 'thrift_model/gen_py/pangramia',
    },
    entry_points={
        'console_scripts': [
            'ytops-client=ytops_client.cli:main',
        ],
    },
    install_requires=[
        'thrift>=0.16.0,<=0.20.0',
        'python-dotenv>=1.0.0',
        'psutil',
        'flask',
        'waitress',
        'yt_dlp>=2025.3.27',
        'yt-dlp-get-pot==0.3.0',
        'requests>=2.31.0',
        'ffprobe3',
        'redis',
        'PySocks',
        'tabulate',
        'PyYAML',
    ],
    python_requires='>=3.9',
)
