forked from mutaku/python-amazon-product-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
executable file
·104 lines (89 loc) · 3.13 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
#!/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'))
extras = {
'setup_requires': [],
}
# for python2.4
if sys.version_info[:2] < (2, 5):
extras['setup_requires'] += ['pycrypto']
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_:
if 'local' in sys.argv:
extras['setup_requires'] += ['hgtools']
extras['use_hg_version'] = {'increment': '0.0.1'}
else:
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},
tests_require=[
'pytest>=2.0.3,<2.3',
'pytest-localserver',
'lxml',
'cElementTree',
'elementtree',
'tox',
'virtualenv<1.8', # for testing Python 2.4
],
classifiers=[
'Operating System :: OS Independent',
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2.4',
'Programming Language :: Python :: 2.5',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Software Development :: Libraries :: Python Modules',
],
**extras
)