forked from cfpb/ccdb5-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
98 lines (78 loc) · 2.64 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
import os
from codecs import open
from setuptools import find_packages, setup
from subprocess import check_output
# -----------------------------------------------------------------------------
# Version handler
command = 'git describe --tags --long --dirty --always'
fmt = '{tag}.dev{commitcount}+{gitsha}'
def format_version(version, fmt=fmt):
parts = version.split('-')
# This is an unknown fork/branch being run in the CI
if len(parts) == 1:
return fmt.format(tag='ci', commitcount=0, gitsha=version)
# Sometimes the closest tag has '-dev' and messes everything up
if len(parts) == 5 and parts[1] == 'dev':
parts = [parts[0] + '-dev', parts[2], parts[3], parts[4]]
assert len(parts) in (3, 4), '|'.join(parts)
dirty = len(parts) == 4
tag, count, sha = parts[:3]
if count == '0' and not dirty:
return tag
return fmt.format(tag=tag, commitcount=count, gitsha=sha.lstrip('g'))
def get_git_version():
git_version = check_output(command.split()).decode('utf-8').strip()
return format_version(version=git_version)
# -----------------------------------------------------------------------------
# Readme Importer
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
install_requires = [
'Django>=1.11,<2.3',
'djangorestframework>=3.9.1,<4.0',
'django-rest-swagger>=2.2.0',
'requests>=2.18,<3',
'elasticsearch>=2.4.1,<3',
'django-localflavor>=1.1,<3.1',
'django-flags>=4.0.1,<5',
]
testing_extras = [
'coverage>=4.5.1,<5',
'mock==2.0.0',
'deep==0.10',
'deepdiff>=3.3,<5.0',
'django-nose==1.4.1',
'parameterized==0.6.1',
]
docs_extras = [
'mkdocs==0.17.5',
'mkDOCter==1.0.5',
]
setup(
name='ccdb5-api',
version=get_git_version(),
description='Complaint Search API',
long_description=long_description,
url='https://github.com/cfpb/ccdb5-api',
author='CFPB',
author_email='[email protected]',
license='CC0',
classifiers=[
'Development Status :: 2 - Pre-Alpha',
'Intended Audience :: Developers',
'Topic :: Internet :: WWW/HTTP :: Indexing/Search',
'License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Framework :: Django',
],
keywords='complaint search api',
packages=find_packages(exclude=['contrib', 'docs', 'tests']),
setup_requires=[],
install_requires=install_requires,
extras_require={
'docs': docs_extras,
'testing': testing_extras,
}
)