-
-
Notifications
You must be signed in to change notification settings - Fork 855
/
setup.py
executable file
·144 lines (121 loc) · 4.45 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#!/usr/bin/env python
import os
import sys
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
from setuptools import Command
NAME = "jira"
#exec(open('%s/version.py' % NAME).read())
from jira import __version__
import warnings
import logging
class PyTest(TestCommand):
user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")]
def initialize_options(self):
TestCommand.initialize_options(self)
self.pytest_args = []
FORMAT = '%(levelname)-10s %(message)s'
logging.basicConfig(format=FORMAT)
logging.getLogger().setLevel(logging.INFO)
# if we have pytest-cache module we enable the test failures first mode
try:
import pytest_cache
self.pytest_args.append("--ff")
except ImportError:
pass
# try:
# import pytest_instafail
# self.pytest_args.append("--instafail")
# except ImportError:
# pass
self.pytest_args.append("-s")
if os.isatty(sys.stdout.fileno()):
# when run manually we enable fail fast
self.pytest_args.append("--maxfail=2")
try:
import coveralls
self.pytest_args.append("--cov=%s" % NAME)
self.pytest_args.extend(["--cov-report", "xml"])
except ImportError:
pass
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
# before running tests we need to run autopep8
r = os.system(
"python -m autopep8 -r --in-place jira/ tests/ examples/")
if r:
raise Exception("autopep8 failed")
# import here, cause outside the eggs aren't loaded
import pytest
errno = pytest.main(self.pytest_args)
sys.exit(errno)
class Release(Command):
user_options = []
def initialize_options(self):
# Command.initialize_options(self)
pass
def finalize_options(self):
# Command.finalize_options(self)
pass
def run(self):
import json
import urllib2
response = urllib2.urlopen(
"http://pypi.python.org/pypi/%s/json" % NAME)
data = json.load(response)
released_version = data['info']['version']
if released_version == __version__:
raise RuntimeError(
"This version was already released, remove it from PyPi if you want to release it again or increase the version number. http://pypi.python.org/pypi/%s/" % NAME)
elif released_version > __version__:
raise RuntimeError("Cannot release a version (%s) smaller than the PyPI current release (%s)." % (
__version__, released_version))
sys.exit()
setup(
name=NAME,
version=__version__,
cmdclass={'test': PyTest, 'release': Release},
packages=find_packages(exclude=['tests', 'tools']),
include_package_data=True,
# test_suite='nose.collector',
install_requires=['requests>=1.2.3',
'requests_oauthlib>=0.3.3',
'tlslite>=0.4.4',
'six>=1.5.2',
'requests_toolbelt'],
setup_requires=[],
tests_require=['pytest', 'tlslite>=0.4.4', 'requests>=2.0',
'setuptools', 'pep8', 'autopep8', 'sphinx', 'six>=1.9.0'],
extras_require={
'magic': ['filemagic>=1.6'],
'shell': ['ipython>=0.13'],
},
entry_points={
'console_scripts':
['jirashell = jira.jirashell:main'],
},
url='https://github.com/pycontribs/jira',
license='BSD',
description='Python library for interacting with JIRA via REST APIs.',
long_description=open("README.rst").read(),
author='Ben Speakmon',
author_email='ben.speakmon@gmail.com',
provides=[NAME],
keywords='jira atlassian rest api',
bugtrack_url='https://github.com/pycontribs/jira/issues',
home_page='https://github.com/pycontribs/jira',
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Topic :: Internet :: WWW/HTTP',
],
)