Completed
Pull Request — master (#27)
by Jerome
32s
created

get_buildnr()   A

Complexity

Conditions 2

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 2
c 2
b 0
f 0
dl 0
loc 15
rs 9.4285
1
#!/usr/bin/env python
2
# -*- encoding: utf-8 -*-
3
from __future__ import absolute_import
4
from __future__ import print_function
5
6
import io
7
import re
8
from glob import glob
9
from os import environ
10
from os.path import basename
11
from os.path import dirname
12
from os.path import join
13
from os.path import splitext
14
15
from setuptools import find_packages
16
from setuptools import setup
17
18
19
def read(*names, **kwargs):
20
    return io.open(
21
        join(dirname(__file__), *names),
22
        encoding=kwargs.get('encoding', 'utf8')
23
    ).read()
24
25
26
# subprocess.check_output(['git', 'rev-list', '--count', 'HEAD']).decode('latin-1').strip()
27
28
29
def get_buildnr():
30
    buildnr = "."
31
    """
32
    try:
33
        buildnr += subprocess.check_output(['git', 'show', '-s', '--format=%ct', 'HEAD^{commit}']).decode(
34
            'latin-1').strip()
35
    except Exception:
36
        buildnr = ""
37
    """
38
    tmp = environ.get("TRAVIS_BUILD_NUMBER", None)
39
    if tmp:
40
        buildnr += tmp
41
    else:
42
        buildnr = ""
43
    return buildnr
44
45
46
setup(
47
    name='msquaredc',
48
    version='0.1.1{}'.format(get_buildnr()),
49
    license='BSD',
50
    description='A Tool for more independent data coding.',
51
    long_description='%s\n%s' % (
52
        re.compile('^.. start-badges.*^.. end-badges', re.M | re.S).sub('', read('README.rst')),
53
        re.sub(':[a-z]+:`~?(.*?)`', r'``\1``', read('CHANGELOG.rst'))
54
    ),
55
    author='Jerome Bergmann',
56
    author_email='[email protected]',
57
    url='https://github.com/j340m3/python-msquaredc',
58
    packages=find_packages('src'),
59
    package_dir={'': 'src'},
60
    py_modules=[splitext(basename(path))[0] for path in glob('src/*.py')],
61
    include_package_data=True,
62
    zip_safe=False,
63
    classifiers=[
64
        # complete classifier list: http://pypi.python.org/pypi?%3Aaction=list_classifiers
65
        'Development Status :: 1 - Planning',
66
        'Intended Audience :: Developers',
67
        'License :: OSI Approved :: BSD License',
68
        'Operating System :: Unix',
69
        'Operating System :: POSIX',
70
        'Operating System :: Microsoft :: Windows',
71
        'Programming Language :: Python',
72
        'Programming Language :: Python :: 2.7',
73
        'Programming Language :: Python :: 3',
74
        'Programming Language :: Python :: 3.3',
75
        'Programming Language :: Python :: 3.4',
76
        'Programming Language :: Python :: 3.5',
77
        'Programming Language :: Python :: 3.6',
78
        'Programming Language :: Python :: Implementation :: CPython',
79
        'Programming Language :: Python :: Implementation :: PyPy',
80
        # uncomment if you test on these interpreters:
81
        # 'Programming Language :: Python :: Implementation :: IronPython',
82
        # 'Programming Language :: Python :: Implementation :: Jython',
83
        # 'Programming Language :: Python :: Implementation :: Stackless',
84
        'Topic :: Utilities',
85
    ],
86
    keywords=[
87
        # eg: 'keyword1', 'keyword2', 'keyword3',
88
    ],
89
    install_requires=[
90
        'click',
91
        'PyYAML',
92
        'urwid',
93
        'six'
94
    ],
95
    extras_require={
96
        # eg:
97
        #   'rst': ['docutils>=0.11'],
98
        #   ':python_version=="2.6"': ['argparse'],
99
    },
100
    entry_points={
101
        'console_scripts': [
102
            'msquaredc = msquaredc.cli:main',
103
        ]
104
    },
105
)
106