-
Notifications
You must be signed in to change notification settings - Fork 4
/
setup.py
executable file
·86 lines (74 loc) · 2.58 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
#!/usr/bin/python
from setuptools import setup, find_packages, Command
import os.path, sys
import re
_here = os.path.abspath(os.path.dirname(__file__))
def version():
# This rather complicated mechanism is employed to avoid importing any
# yet unfulfilled dependencies, for instance when installing under
# Python 2.4 from scratch
import imp
path = os.path.join(_here, 'amazonproduct', 'version.py')
mod = imp.load_source('version', path)
return mod.VERSION
def read(fname):
try:
# makes sure that setup can be executed from a different location
return open(os.path.join(_here, fname)).read()
except IOError:
return ''
def readme():
# substitute all include statements.
def insert_include(matchobj):
return read(matchobj.group(1))
return re.sub(r'\.\. include:: (\w+)', insert_include, read('README'))
class PyTest(Command):
"""
setuptools/distutils command to run py.test.
"""
user_options = []
def initialize_options(self): pass
def finalize_options(self): pass
def run(self):
import subprocess
errno = subprocess.call([
sys.executable, os.path.join(_here, 'tests', 'runtests.py'), '-vl'])
raise SystemExit(errno)
# make sure that no development version end up on PyPI
if 'register' in sys.argv or 'upload' in sys.argv:
version_ = version()
if '/' in version_ or '+' in version_:
print('ERROR: Version %r has not been adjusted yet!' % version_)
sys.exit(1)
setup(
name='python-amazon-product-api',
version=version(),
author='Sebastian Rahlf',
author_email='basti AT redtoad DOT de',
url="http://bitbucket.org/basti/python-amazon-product-api/downloads/",
license='bsd',
description='A Python wrapper for the Amazon Product Advertising API.',
long_description=readme(),
zip_safe=False, # we want to find README.rst and version.py
keywords='amazon product advertising api wrapper signed requests',
packages=find_packages(_here, exclude=['tests']),
cmdclass={'test': PyTest},
install_requires=[
'requests',
'six',
],
tests_require=[
'pytest-localserver>=0.3',
'lxml',
],
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.3',
],
)