-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.py
45 lines (36 loc) · 1.31 KB
/
setup.py
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
from setuptools import setup, find_packages
from setuptools.command.install import install
from flaterra.version import __version__
import sys
import os
def read_file(fname):
"""
return file contents
:param fname: path relative to setup.py
:return: file contents
"""
with open(os.path.join(os.path.dirname(__file__), fname), "r") as fd:
return fd.read()
class VerifyVersionCommand(install):
"""Custom command to verify that the git tag matches our version"""
description = "verify that the git tag matches our version"
def run(self):
tag = os.getenv("CIRCLE_TAG")
if tag != __version__:
info = "Git tag: {0} does not match the version of this app: {1}".format(
tag, __version__
)
sys.exit(info)
setup(
name="flaterra",
version=__version__,
license="MIT",
author="Daniel Luca",
author_email="[email protected]",
long_description=read_file("Readme.md") if os.path.isfile("Readme.md") else "",
long_description_content_type="text/markdown",
packages=find_packages(exclude=["contrib", "docs", "tests"]),
install_requires=read_file("requirements.txt").split("\n"),
entry_points={"console_scripts": ["flaterra=flaterra:main"]},
cmdclass={"verify": VerifyVersionCommand},
)