forked from Synerty/wstools-py3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
126 lines (109 loc) · 4.15 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
#!/usr/bin/env python
import codecs
import logging
import os
import re
import subprocess
import sys
import warnings
from setuptools import setup, find_packages, Command
NAME = "wstools-py3"
url = "https://github.com/Synerty/wstools-py3"
# Get the version - do not use normal import because it does break coverage
base_path = os.path.dirname(__file__)
fp = open(os.path.join(base_path, 'wstools', 'version.py'))
__version__ = re.compile(r".*__version__\s*=\s*['\"](.*?)['\"]",
re.S).match(fp.read()).group(1)
fp.close()
# this should help getting annoying warnings from inside distutils
warnings.simplefilter('ignore', UserWarning)
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
try:
from urllib.request import urlopen
except ImportError:
from urllib.request import urlopen
response = urlopen(
"http://pypi.python.org/pypi/%s/json" % NAME)
data = json.load(codecs.getreader("utf-8")(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))
class PreRelease(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
try:
from urllib.request import urlopen
except ImportError:
from urllib.request import urlopen
response = urlopen(
"http://pypi.python.org/pypi/%s/json" % NAME)
data = json.load(codecs.getreader("utf-8")(response))
released_version = data['info']['version']
if released_version >= __version__:
raise RuntimeError(
"Current version of the package is equal or lower than the already published ones (PyPi). Increse version to be able to pass prerelease stage.")
install_requires = [ 'six' ]
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
tests_require = [ 'py >= 1.4', 'hacking', 'pytest', 'pytest-cov' ]
setup(
name=NAME,
version=__version__,
cmdclass={'release': Release, 'prerelease': PreRelease},
packages=find_packages(exclude=['tests']),
include_package_data=True,
tests_require=tests_require,
setup_requires=['setuptools'],
install_requires=install_requires,
extras_require={
'testing': tests_require
},
license='BSD',
description="WSDL parsing services package for Web Services for Python. see" + url,
long_description=open("README.rst").read(),
maintainer="Synerty",
maintainer_email="[email protected]",
author='Makina Corpus',
author_email='[email protected]',
provides=['wstools'],
url=url,
bugtrack_url='%s/issues' % url,
home_page=url,
keywords='api wstools wdsl web',
classifiers=[
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Development Status :: 5 - Production/Stable',
'Environment :: Other Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Topic :: Software Development :: Libraries :: Python Modules',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Topic :: Internet :: WWW/HTTP',
],
)