setup.py 1.99 KB
Newer Older
ethiraj krishnamanaidu's avatar
ethiraj krishnamanaidu committed
1
#  Copyright 2020 Google LLC
Sutton's avatar
Sutton committed
2
#  Copyright © 2020 Amazon Web Services
ethiraj krishnamanaidu's avatar
ethiraj krishnamanaidu committed
3
4
5
6
7
8
9
10
11
12
13
14
15
#
#  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.

16
17
import os

ethiraj krishnamanaidu's avatar
ethiraj krishnamanaidu committed
18
19
20
21
22
import setuptools

with open("README.md", "r") as fh:
    long_description = fh.read()

23
24
25
def get_version_from_file():
    with open("VERSION", "r") as fh:
        return fh.read().strip()
26
27

def prepare_version():
28
    version = os.getenv("BUILD_TAG", '')
29
30
31
32
33
34
35

    if version.startswith('v'):
        # release tag version, e.g. v0.9.0
        version = version[1:]
    else:
        # we assume that it is commit version
        # https://packaging.python.org/guides/distributing-packages-using-setuptools/#local-version-identifiers
36
37
38
        commit = os.environ["BUILD_COMMIT_SHORT_SHA"]
        build_id = os.environ["BUILD_ID"]
        version = f"{get_version_from_file()}.dev{build_id}+{commit}"
39
40
41

    return version

ethiraj krishnamanaidu's avatar
ethiraj krishnamanaidu committed
42
43
setuptools.setup(
    name="osdu_api",
44
    version=prepare_version(),
ethiraj krishnamanaidu's avatar
ethiraj krishnamanaidu committed
45
46
    author="OSDU team",
    description="A package to interface with OSDU microservices",
47
    packages=setuptools.find_packages(exclude=["*test*"]),
ethiraj krishnamanaidu's avatar
ethiraj krishnamanaidu committed
48
49
50
51
52
    classifiers=[
        "Programming Language :: Python :: 3",
        "License :: OSI Approved :: Apache License",
        "Operating System :: OS Independent",
    ],
53
54
55
56
57
58
59
    install_requires=[
        "jsonschema==3.2.0",
        "pyyaml==5.4.1",
        "strict-rfc3339==0.7",
        "toposort==1.6",
        "dataclasses==0.8;python_version<'3.7'"
    ],
60
61
62
    extras_require={
        "all": ["requests==2.25.1", "tenacity==6.2.0"]
    },
ethiraj krishnamanaidu's avatar
ethiraj krishnamanaidu committed
63
    python_requires='>=3.6',
64
)