This repository has been archived by the owner on Feb 15, 2020. It is now read-only.
forked from solex/python-odesk
-
Notifications
You must be signed in to change notification settings - Fork 3
/
setup.py
98 lines (76 loc) · 2.98 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
# Copyright (c) 2010-2014, oDesk http://www.odesk.com
# All rights reserved.
from __future__ import print_function
import re
import os
from setuptools import setup, find_packages
from distutils.core import Command
readme = open(os.path.join(os.path.dirname(__file__), 'README.rst'))
README = readme.read()
readme.close()
VERSION = (0, 6, 0, 'alpha', 0)
def get_version():
version = '{0}.{1}'.format(VERSION[0], VERSION[1])
if VERSION[2]:
version = '{0}.{1}'.format(version, VERSION[2])
if VERSION[3:] == ('alpha', 0):
version = '{0} pre-alpha'.format(version)
else:
if VERSION[3] != 'final':
version = "{0} {1}".format(version, VERSION[3])
if VERSION[4] != 0:
version = '{0} {1}'.format(version, VERSION[4])
return version
def update_init(version):
"""Update version number in the ``odesk/__init__.py``.
"""
print('Updating ``odesk/__init__.py`` to version "{0}"'.format(version))
# Update 'VERSION' variable in ``odesk/__init__.py``
with open('odesk/__init__.py', 'r') as f:
init_contents = f.read()
new_init = re.sub(
'(VERSION = \'[a-zA-Z0-9\.\s]*\')',
'VERSION = \'{0}\''.format(version), init_contents)
# Write backup
with open('odesk/__init__.py.back', 'w') as f:
f.write(init_contents)
# Write new init
with open('odesk/__init__.py', 'w') as f:
f.write(new_init)
print('OK')
class UpdateVersion(Command):
description = 'update version in ``odesk/__init__.py``'
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
update_init(get_version())
# NOTE: as official oauth2 not supporting python3,
# branch https://github.com/tseaver/python-oauth2/tree/py3-redux used insted
# setuptools cannot install from githubbranch, so you need to install manually
# pip install -e git+https://github.com/tseaver/python-oauth2@py3-redux#egg=oauth
setup(cmdclass={'update_version': UpdateVersion},
name='python-odesk',
version=get_version(),
description='Python bindings to oDesk API',
long_description=README,
author='oDesk',
author_email='[email protected]',
maintainer='Kirill Panshin',
maintainer_email='[email protected]',
install_requires=['oauth2', 'urllib3', 'six'],
packages=find_packages(),
license='BSD',
download_url='http://github.com/odesk/python-odesk',
url='http://odesk.github.com/python-odesk',
classifiers=['Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Topic :: Software Development '
':: Libraries :: Python Modules',
'Topic :: Utilities'])