-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathsetup.py
95 lines (84 loc) · 3.1 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
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4
# spamc - Python spamassassin spamc client library
# Copyright (C) 2015 Andrew Colin Kissa <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
spamc: Python spamassassin spamc client library
Copyright 2015, Andrew Colin Kissa
Licensed under AGPLv3+
"""
import os
import sys
from imp import load_source
from setuptools import setup, find_packages
TESTS_REQUIRE = ['nose', 'coverage', 'mock', 'eventlet', 'gevent']
INSTALL_REQUIRES = []
if sys.version_info < (2, 7):
TESTS_REQUIRE.extend(['unittest2', 'importlib'])
INSTALL_REQUIRES.append('importlib')
def get_readme():
"""Generate long description"""
pandoc = None
for path in os.environ["PATH"].split(os.pathsep):
path = path.strip('"')
pandoc = os.path.join(path, 'pandoc')
if os.path.isfile(pandoc) and os.access(pandoc, os.X_OK):
break
else:
pandoc = None
try:
if pandoc:
cmd = [pandoc, '-t', 'rst', 'README.md']
long_description = os.popen(' '.join(cmd)).read()
else:
raise ValueError
except BaseException:
long_description = open("README.md").read()
return long_description
def main():
"""Main"""
lic = (
'License :: OSI Approved :: GNU Affero '
'General Public License v3 or later (AGPLv3+)')
version = load_source("version", os.path.join("spamc", "version.py"))
opts = dict(
name="spamc",
version=version.__version__,
description="Python spamassassin spamc client library",
long_description=get_readme(),
keywords="spam spamc spamassassin",
author="Andrew Colin Kissa",
author_email="[email protected]",
url="https://github.com/akissa/spamc",
license="AGPLv3+",
packages=find_packages(exclude=['tests']),
include_package_data=True,
zip_safe=False,
tests_require=TESTS_REQUIRE,
install_requires=INSTALL_REQUIRES,
classifiers=[
'Development Status :: 4 - Beta',
'Programming Language :: Python',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Topic :: Software Development :: Libraries :: Python Modules',
'Intended Audience :: Developers',
lic,
'Natural Language :: English',
'Operating System :: OS Independent'],)
setup(**opts)
if __name__ == "__main__":
main()