forked from internetstandards/Internet.nl-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
45 lines (36 loc) · 1.26 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 __future__ import print_function
import os
import sys
from subprocess import check_output
from setuptools import find_packages, setup
def get_version():
"""Determine the most appropriate version number for this package."""
# try to use git tag if building python package
try:
# append git sha to version
return '0.0.' + check_output("git rev-list --count HEAD",shell=True).decode('utf8')
except Exception as e:
print("Failed to acquire version info from git: {e}".format(e=e), file=sys.stderr)
return '0.0.0'
def requirements(extra=None):
"""Return list of required package names from requirements.txt."""
# strip trailing comments, and extract package name from git urls.
if extra:
filename = 'requirements.' + extra + '.txt'
else:
filename = 'requirements.txt'
requirements = [r.strip().split(' ', 1)[0].split('egg=', 1)[-1]
for r in open(filename) if not r.startswith('#')]
return requirements
setup(
name='dashboard',
version=get_version(),
packages=find_packages(),
install_requires=requirements(),
entry_points={
'console_scripts': [
'dashboard = dashboard.manage:main',
],
},
include_package_data=True,
)