'''
    This is the install file for pymagmodel.

    Copyright (C) 2019 Helmholtz Centre Potsdam GFZ,
        German Research Centre for Geosciences, Potsdam, Germany

    Cite as:
    TODO

    This file is part of pymagmodel.

    pymagmodel is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    pymagmodel is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with pymagmodel. If not, see <https://www.gnu.org/licenses/>.
'''

import os
import codecs
from setuptools import setup


# https://packaging.python.org/guides/single-sourcing-package-version/
def read(rel_path):
    here = os.path.abspath(os.path.dirname(__file__))
    with codecs.open(os.path.join(here, rel_path), 'r') as fp:
        return fp.read()


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

description = ''' python interface for global geomagnetic field models '''

setup(
    name='pymagglobal',
    version=get_version('pymagglobal/__init__.py'),
    author='Maximilian Schanner',
    author_email='arthus@gfz-potsdam.de',
    packages=['pymagglobal'],
    license='GPL v3',
    description=description,
    long_description=description,
    install_requires=[],
    package_data={'pymagglobal': ['dat/*']},
    include_package_data=True,
)