# -*- coding: utf-8 -*-
# Copyright 2019 Tomaz Muraus
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import codecs
import sys
import os.path

from setuptools import setup
from setuptools import find_packages

from dist_utils import fetch_requirements
from dist_utils import parse_version_string

PY2 = sys.version_info[0] == 2
PY2_or_3_pre_34 = sys.version_info < (3, 4, 0)

BASE_DIR = os.path.dirname(os.path.abspath(__file__))
REQUIREMENTS_FILE = os.path.join(BASE_DIR, 'requirements.txt')
INIT_FILE = os.path.join(BASE_DIR, 'protobuf_cloud_datastore_translator', '__init__.py')

version = parse_version_string(INIT_FILE)
install_reqs, dep_links = fetch_requirements(REQUIREMENTS_FILE)

if PY2_or_3_pre_34:
    install_reqs.append('typing')

with codecs.open(os.path.join(BASE_DIR, 'README.md'), encoding='utf-8') as f:
    LONG_DESCRIPTION = f.read()

setup(
    name='protobuf-cloud-datastore-translator',
    version=version,
    description=('Library which converts arbitrary Protobuf message objects into '
                 'Entity Protobuf objects which can be used with Google Datastore.'),
    long_description=LONG_DESCRIPTION,
    long_description_content_type='text/markdown',
    author='Tomaz Muraus',
    author_email='tomaz@tomaz.me',
    license='Apache License (2.0)',
    classifiers=[
        'Intended Audience :: Information Technology',
        'Operating System :: POSIX :: Linux',
        'Programming Language :: Python',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.6',
        'Programming Language :: Python :: 3.7',
    ],
    install_requires=install_reqs,
    dependency_links=dep_links,
    zip_safe=False,
    include_package_data=True,
    packages=find_packages(exclude=['setuptools', 'tests']),
    package_data={
        'protobuf_cloud_datastore_translator': ['py.typed']
    }
)
