#!/usr/bin/env python3
import os
import setuptools


def read(rel_path: str) -> str:
    here = os.path.abspath(os.path.dirname(__file__))
    with open(os.path.join(here, rel_path)) as fp:
        return fp.read()


def get_version(rel_path: str) -> str:
    for line in read(rel_path).splitlines():
        if line.startswith("__version__"):
            delim = '"' if '"' in line else "'"
            return line.split(delim)[1]
    raise RuntimeError("Unable to find version string in: %s" % rel_path)


# see pyproject.toml and setup.cfg (legacy) for declarative values for setuptools
setuptools.setup(
    name='apkg',
    version=get_version("apkg/__init__.py"),
)
