Skip to content

Commit e859580

Browse files
committed
Updated setup.py
1 parent 04fea6b commit e859580

2 files changed

Lines changed: 34 additions & 30 deletions

File tree

ivona_api/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = '0.1.1'

setup.py

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,48 @@
11
# -*- coding: utf-8 -*-
2-
from __future__ import print_function
3-
import sys
4-
from setuptools import setup, find_packages
5-
from setuptools.command.test import test as TestCommand
6-
2+
from __future__ import unicode_literals
73

8-
class Tox(TestCommand):
9-
user_options = [('tox-args=', 'a', "Arguments to pass to tox")]
4+
import io
5+
import os
6+
import re
107

11-
def initialize_options(self):
12-
TestCommand.initialize_options(self)
13-
self.tox_args = None
14-
15-
def finalize_options(self):
16-
TestCommand.finalize_options(self)
17-
self.test_args = []
18-
self.test_suite = True
8+
from setuptools import setup, find_packages
199

20-
def run_tests(self):
21-
# import here, cause outside the eggs aren't loaded
22-
import tox
23-
import shlex
24-
args = self.tox_args
25-
if args:
26-
args = shlex.split(self.tox_args)
27-
errno = tox.cmdline(args=args)
28-
sys.exit(errno)
2910

3011
# Convert description from markdown to reStructuredText
3112
try:
3213
import pypandoc
33-
description = pypandoc.convert('README.md', 'rst')
34-
except (IOError, ImportError):
14+
description = pypandoc.convert('README.md', 'rst', 'markdown')
15+
except (OSError, ImportError):
3516
description = ''
3617

3718

19+
# Get package version number
20+
# Source: https://packaging.python.org/single_source_version/
21+
def read(*names, **kwargs):
22+
with io.open(
23+
os.path.join(os.path.dirname(__file__), *names),
24+
encoding=kwargs.get('encoding', 'utf8')
25+
) as fp:
26+
return fp.read()
27+
28+
29+
def find_version(*file_paths):
30+
version_file = read(*file_paths)
31+
version_match = re.search(
32+
r"^__version__ = ['\"]([^'\"]*)['\"]",
33+
version_file, re.M
34+
)
35+
if version_match:
36+
return version_match.group(1)
37+
raise RuntimeError("Unable to find version string.")
38+
3839
setup(
3940
name='ivona_api',
4041
url='https://github.com/Pythonity/python-ivona-api',
41-
download_url='https://github.com/Pythonity/python-ivona-api/releases/latest',
42+
download_url='https://github.com/Pythonity/python-ivona-api/releases/'
43+
'latest',
4244
bugtrack_url='https://github.com/Pythonity/python-ivona-api/issues',
43-
version='0.1.1',
45+
version=find_version('ivona_api', '__init__.py'),
4446
license='MIT License',
4547
author='Pythonity',
4648
author_email='pythonity@pythonity.com',
@@ -51,8 +53,6 @@ def run_tests(self):
5153
long_description=description,
5254
packages=find_packages(),
5355
include_package_data=True,
54-
tests_require=['tox'],
55-
cmdclass={'test': Tox},
5656
install_requires=[
5757
'requests[security]>=2.12.1',
5858
'requests-aws4auth>=0.9',
@@ -68,8 +68,11 @@ def run_tests(self):
6868
'License :: OSI Approved :: MIT License',
6969
'Operating System :: OS Independent',
7070
'Programming Language :: Python',
71+
'Programming Language :: Python :: 2',
72+
'Programming Language :: Python :: 2.7',
7173
'Programming Language :: Python :: 3',
7274
'Programming Language :: Python :: 3.4',
75+
'Programming Language :: Python :: 3.5',
7376
'Topic :: Software Development :: Libraries :: Python Modules',
7477
],
7578
)

0 commit comments

Comments
 (0)