setup.py 1.73 KB
Newer Older
Siarhei Khaletski (EPAM)'s avatar
Siarhei Khaletski (EPAM) committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#  Copyright 2021 Google LLC
#  Copyright 2021 EPAM Systems
#
#  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 os

import setuptools

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

def get_version_from_file():
    with open("VERSION", "r") as fh:
        return fh.read().strip()

def prepare_version():
28
    version = os.getenv("BUILD_TAG", '')
Siarhei Khaletski (EPAM)'s avatar
Siarhei Khaletski (EPAM) committed
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}"
Siarhei Khaletski (EPAM)'s avatar
Siarhei Khaletski (EPAM) committed
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54

    return version

setuptools.setup(
    name="osdu_airflow",
    version=prepare_version(),
    author="OSDU team",
    description="A package with Airflow dependencies specific for OSDU",
    packages=setuptools.find_packages(exclude=["*test*"]),
    classifiers=[
        "Programming Language :: Python :: 3",
        "License :: OSI Approved :: Apache License",
        "Operating System :: OS Independent",
    ],
    python_requires='>=3.6',
)