-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathsetup.py
66 lines (59 loc) · 2.38 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import os
from subprocess import check_output, run, CalledProcessError, DEVNULL
from setuptools import setup
# ref: http://blogs.nopcode.org/brainstorm/2013/05/20/pragmatic-python-versioning-via-setuptools-and-git-tags/
# Fetch version from git tags, and write to version.py.
# Also, when git is not available (PyPi package), use stored version.py.
version_py = os.path.join(os.path.dirname(__file__), "version.py")
try:
is_on_tag = run(["git", "describe"], stdout=DEVNULL, stderr=DEVNULL).returncode == 0
version_git = check_output(["git", "describe", "--abbrev=0", "--tags"]).rstrip().decode("ascii")
if not is_on_tag:
dev_revision = check_output(["git", "rev-list", "--count", version_git + "..HEAD"]).rstrip().decode("ascii")
version_git += ".dev" + dev_revision
except (CalledProcessError, OSError):
try:
version_git = open(version_py).read().strip().split("=")[-1].replace("'", "").strip()
except FileNotFoundError:
version_git = "0.0.0"
version_msg = "# Do not edit this file, pipeline versioning is governed by git tags"
open(version_py, "w").write(version_msg + os.linesep + "__version__ = '" + str(version_git) + "'\n")
install_requires = [
"beautifulsoup4",
"sortedcontainers",
"humanfriendly",
"requests",
"PyYAML",
"pika",
"certifi",
]
setup(
name="openqa_review",
version="{ver}".format(ver=version_git),
install_requires=install_requires,
tests_require=[
"pytest-mock",
],
author="Oliver kurz",
author_email="[email protected]",
description="review helper script for openQA",
license="MIT",
keywords="openQA webscraping script helper review",
url="https://github.com/os-autoinst/openqa_review",
packages=["openqa_review"],
py_modules=["version"],
long_description=open(os.path.join(os.path.dirname(__file__), "README.md"), encoding="utf-8").read(),
classifiers=[
"Development Status :: 5 - Production/Stable",
"Topic :: Utilities",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
],
entry_points={
"console_scripts": [
"openqa-review=openqa_review.openqa_review:main",
"tumblesle-release=openqa_review.tumblesle_release:main",
],
},
scripts=["bin/openqa-review-sles-ha", "bin/openqa-review-daily-email", "bin/openqa-review-functional_yast_concise"],
)