forked from davidfischer-ch/pytoolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
executable file
·162 lines (146 loc) · 6.18 KB
/
setup.py
File metadata and controls
executable file
·162 lines (146 loc) · 6.18 KB
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#**********************************************************************************************************************#
# PYTOOLBOX - TOOLBOX FOR PYTHON SCRIPTS
#
# Main Developer : David Fischer (david.fischer.ch@gmail.com)
# Copyright : Copyright (c) 2012-2015 David Fischer. All rights reserved.
#
#**********************************************************************************************************************#
#
# This file is part of David Fischer's pytoolbox Project.
#
# This project is free software: you can redistribute it and/or modify it under the terms of the EUPL v. 1.1 as provided
# by the European Commission. This project 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 European Union Public License for more details.
#
# You should have received a copy of the EUPL General Public License along with this project.
# If not, see he EUPL licence v1.1 is available in 22 languages:
# 22-07-2013, <https://joinup.ec.europa.eu/software/page/eupl/licence-eupl>
#
# Retrieved from https://github.com/davidfischer-ch/pytoolbox.git
from __future__ import absolute_import, division, print_function
import itertools, os, sys
from codecs import open
from setuptools import setup, find_packages
from setuptools.command import develop, install, test
try:
# Check if import succeed and print the exception because setup() ciphered stack-trace is not useful
from tests import pytoolbox_runtests
except Exception as e:
sys.stderr.write('WARNING importing pytoolbox_runtests raised the following error: {0}{1.linesep}'.format(e, os))
install_requires = [
'argparse',
'jinja2',
'mock',
'nose',
'passlib',
'pyaml',
'pycallgraph',
'pygal',
'pymongo',
'python-magic',
'pytz',
'six',
'termcolor'
]
extras_require = {
'atlassian': ['jira'],
'django': ['django'],
'django_filter': ['django-filter'],
'django_formtools': ['django-formtools'],
'flask': ['flask'],
'mongo': ['celery'],
'rest_framework': ['django-oauth-toolkit', 'djangorestframework>=3'],
'selenium': ['selenium'],
'smpte2022': ['fastxor'],
'voluptuous': ['voluptuous']
}
# Why not installing following packages for python 3 ?
#
# * hashlib, ipaddr: Part of python 3 standard library
# * sudo pip-3.3 install kitchen -> AttributeError: 'module' object has no attribute 'imap'
# * sudo pip-3.3 install ming -> File "/tmp/pip_build_root/ming/setup.py", line 5, SyntaxError: invalid syntax
if sys.version_info[0] < 3:
extras_require['ming'] = ['ming']
try:
import hashlib
except ImportError:
install_requires.append('hashlib')
install_requires.extend([
'backports.lzma',
'ipaddr',
'kitchen'
])
def get_command_with_extras(cls, extras_require):
class WithExtra(cls):
user_options = list(itertools.chain(cls.user_options, [
('extra-all', None, 'Install dependencies for all features.')
], [
('extra-{0}'.format(e.replace('_', '-')), None, 'Install dependencies for the feature {0}.'.format(e))
for e in sorted(extras_require.keys())
]))
boolean_options = list(itertools.chain(
getattr(cls, 'boolean_options', []), ['extra-all'], [o[0] for o in user_options]
))
def initialize_options(self):
cls.initialize_options(self)
self.extra_all = None
for extra in extras_require.keys():
setattr(self, 'extra_{0}'.format(extra), None)
def finalize_options(self):
cls.finalize_options(self)
for extra in extras_require.keys():
if (self.extra_all or getattr(self, 'extra_{0}'.format(extra))) and extra in extras_require:
print('Enable dependencies for feature/module {0}'.format(extra))
self.distribution.install_requires.extend(self.distribution.extras_require[extra])
return WithExtra
setup(
cmdclass={
'develop': get_command_with_extras(develop.develop, extras_require),
'install': get_command_with_extras(install.install, extras_require),
'test': get_command_with_extras(test.test, extras_require)
},
name='pytoolbox',
version='10.4.0',
packages=find_packages(exclude=['tests']),
extras_require=extras_require,
install_requires=install_requires,
tests_require=['coverage', 'mock', 'nose', 'nose-exclude'],
test_suite='tests.pytoolbox_runtests.main',
use_2to3=True,
use_2to3_exclude_fixers=['lib2to3.fixes.fix_import'],
# Meta-data for upload to PyPI
author='David Fischer',
author_email='david.fischer.ch@gmail.com',
classifiers=[
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Framework :: Flask',
'License :: OSI Approved :: European Union Public Licence 1.1 (EUPL 1.1)',
'Natural Language :: English',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Software Development :: Libraries :: Python Modules'
],
description='Toolbox for Python scripts',
keywords=[
'celery', 'ffmpeg', 'django', 'flask', 'json', 'juju', 'mock', 'mongodb', 'rsync', 'rtp', 'selenium',
'smpte 2022-1', 'screen', 'subprocess'
],
license='EUPL 1.1',
long_description=open('README.rst', 'r', encoding='utf-8').read(),
url='https://github.com/davidfischer-ch/pytoolbox'
)