forked from watsonpy/watson-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
123 lines (100 loc) · 3.22 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# -*- coding: utf-8 -*-
import os
from setuptools import setup, Command, find_packages
import watson.framework
class BaseCommand(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
class PyTest(BaseCommand):
"""Runs all the unit tests.
"""
def run(self):
os.system('py.test')
clean()
class PyPiPublish(BaseCommand):
"""Publishes the code to PyPi.
"""
def run(self):
os.system('py.test')
if (confirm('Are you sure you want to push to PyPi?')):
os.system('python setup.py sdist upload')
clean()
def clean():
"""Cleans the source directory of all non-source files.
"""
os.system('rm -rf .coverage')
os.system('find . -name "__pycache__" -print0|xargs -0 rm -rf')
os.system('find . -name "*.egg-info" -print0|xargs -0 rm -rf')
os.system('rm -rf dist')
def confirm(prompt):
prompt += ' (Y/N) [n]: '
while True:
answer = input(prompt).upper()
if not answer:
answer = 'N'
return False if answer != 'Y' else True
path = os.path.dirname(os.path.abspath(__file__))
with open(os.path.join(path, 'LICENSE')) as f:
license = f.read()
with open(os.path.join(path, 'README.rst')) as f:
readme = f.read()
with open(os.path.join(path, 'requirements.txt')) as f:
requirements = f.read().splitlines()
with open(os.path.join(path, 'requirements-test.txt')) as f:
test_requirements = f.read().splitlines()
setup(
name='watson-framework',
version=watson.framework.__version__,
url='http://github.com/watsonpy/watson-framework',
description='A Python 3 web app framework.',
long_description=readme,
author='Simon Coulton',
author_email='simon at bespohk.com',
license=license,
classifiers=[
'Development Status :: 3 - Alpha',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: Implementation :: CPython',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Internet :: WWW/HTTP :: WSGI',
'Topic :: Internet :: WWW/HTTP :: WSGI :: Application',
'Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware',
'Topic :: Internet :: WWW/HTTP :: WSGI :: Server'
],
platforms=['Python 3.3'],
keywords=['watson',
'python3',
'web framework',
'framework',
'wsgi',
'web'],
packages=find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"]),
include_package_data=True,
zip_safe=False,
entry_points={
'console_scripts': [
'watson-console = watson.framework.bin:main'
]
},
install_requires=requirements,
extras_require={
'test': test_requirements,
'mako': [
'mako >= 0.9.1'
],
},
cmdclass={
'test': PyTest,
'publish': PyPiPublish
}
)