-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.py
More file actions
executable file
·71 lines (58 loc) · 1.87 KB
/
setup.py
File metadata and controls
executable file
·71 lines (58 loc) · 1.87 KB
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
67
68
69
70
71
#!/usr/bin/env python3
#from distutils.core import setup
import os
import subprocess
import sys
from setuptools import setup
import re
with open("src/elnok/__init__.py") as f:
text = f.read()
VERSION = re.search("__version__ = \"(.*?)\"", text).groups()[0]
# almost copy from elnok.__init__.py, but we cannot load it as it's not installed yet
def _get_version_git():
"""
Get the version via git
raises LookupError if no version info found
"""
# change directory to root
rootdir = os.path.dirname(__file__)
try:
out = subprocess.check_output(
args=["git", "describe", "--tags", "--dirty", "--always"], cwd=rootdir
)
return out.strip().decode("utf-8")
except EnvironmentError:
raise LookupError("Unable to run git")
# Check version
try:
gver = _get_version_git()
if "-" in gver:
sys.stderr.write("Warning: packaging a non-tagged version: %s\n" % gver)
if VERSION != gver:
sys.stderr.write(
"Warning: package version and git version don't match:" " %s <> %s\n" % (VERSION, gver)
)
except LookupError:
pass
with open("requirements.txt") as f:
required = f.read().splitlines()
setup(name='elnok',
version=VERSION,
packages=['elnok'],
package_dir={'': 'src'},
description='A light front-end to Logstash/Elasticsearch',
author="Éric Piel",
author_email="piel@delmic.com",
url="https://github.com/delmic/elnok",
entry_points={
"console_scripts": [
"elnok = elnok.__main__:main"
]
},
license="GPL-2",
platforms="Linux",
# For building the debian package we specify the dependencies in control file (Depends:)
# hence the install_requires is commented out
# uncomment it if you want to install the package with pip
# install_requires=required,
)