from setuptools import setup, find_packages
import os
from pathlib import Path

package_name = "uuts"

# def prepare_init_files():
#     # Determine source and destination paths
#     init_path = Path(__file__).parent / "package" / package_name / "init"
#     init_files_path = init_path / "init_files"
#     init_files_script_path = init_path / "init_files.py"
#     # list files in source directory
#     source_files = os.listdir(init_files_path)
#     result = {}
#     # create dictionary of file names and their content
#     for file in source_files:
#         source_file = init_files_path / file
#         pure_file_name = os.path.basename(file)
#         if source_file.is_file():
#             with open(source_file, "rb") as fsrc:
#                 result[pure_file_name] = fsrc.read().decode('utf-8')
#     # write the dictionary to init_files.py
#     with open(init_files_script_path, "w", encoding="utf-8") as fdst:
#         fdst.write(f'init_files = {result}\n')

# prepare_init_files()

with open(f'./package/readme.md', f'r') as f:
    long_description = f.read()
long_description = f'\n' + long_description.replace('\r', '')

# increment version
with open("./version.txt", "r") as file:
    version = file.read()

version = int(version) + 1

with open("./version.txt", "w") as file:
    file.write(str(version))

setup(
    name=package_name,
    version=f'1.0.{version}',
    package_dir={"": "package"},
    long_description=long_description,
    long_description_content_type="text/markdown",
    description='uuts library for Time Series Metamodel documentation generation',
    author='Jaromir Sivic',
    author_email='unknown@unknown.com',
    license="MIT",
    packages=find_packages(where="package"),
    dynamic=["licernse"],
    keywords=['time series', 'metamodel', 'documentation', 'uuts'],
    classifiers=[
        "Programming Language :: Python :: 3.13",
        "Operating System :: OS Independent"
    ],
    install_requires=[
        'fetchx'
    ],
    extras_require={
        "dev": ["twine>=4.0.2"]
    },
    python_requires=">=3.13"
)
