-
-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathsetup.py
More file actions
113 lines (93 loc) · 2.82 KB
/
Copy pathsetup.py
File metadata and controls
113 lines (93 loc) · 2.82 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
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from __future__ import absolute_import, print_function
import io
import os
import re
from glob import glob
from os.path import basename
from os.path import dirname
from os.path import join
from os.path import relpath
from os.path import splitext
import sys
from setuptools import find_packages
from setuptools import setup
version = '0.0.1.beta'
#### Small hack to force using a plain version number if the option
#### --plain-version is passed to setup.py
USE_DEFAULT_VERSION = False
try:
sys.argv.remove('--use-default-version')
USE_DEFAULT_VERSION = True
except ValueError:
pass
####
def get_version(default=version, template='{commit}',
use_default=USE_DEFAULT_VERSION):
"""
Return a version collected from git. If `use_default` is True,
always use the default version.
"""
if use_default:
return default
try:
# TODO: When we add git tags, we will need to adjust this code
commit = get_git_version()
commit = '{}-{}'.format(version, commit)
return template.format(**locals())
except:
# no git data: use default version
return default
def get_git_version():
"""
Return version parts from Git or raise an exception.
"""
from subprocess import check_output, STDOUT
cmd = 'git', 'describe', '--tags', '--long', '--dirty', '--always'
# TODO: When we add git tags, we will need to adjust this code
version = check_output(cmd, stderr=STDOUT).strip()
return version
def read(*names, **kwargs):
return io.open(
join(dirname(__file__), *names),
encoding=kwargs.get('encoding', 'utf8')
).read()
setup(
name='deltacode',
version=get_version(),
license='Apache-2.0',
description='Utility for comparing codebases using scancode-toolkit',
long_description=read('README.rst'),
author='nexB Inc.',
author_email='info@nexb.com',
url='https://github.com/nexb/deltacode',
packages=find_packages('src'),
package_dir={'': 'src'},
py_modules=[splitext(basename(path))[0] for path in glob('src/*.py')],
include_package_data=True,
zip_safe=False,
classifiers=[
# complete classifier list: http://pypi.python.org/pypi?%3Aaction=list_classifiers
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Topic :: Utilities',
],
keywords=[],
install_requires=[
'click',
'scancode-toolkit',
'unicodecsv',
],
entry_points={
'console_scripts': [
'deltacode=deltacode.cli:cli',
],
},
extras_require={
# eg: 'rst': ['docutils>=0.11'],
}
)