forked from barseghyanartur/django-fobi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
388 lines (331 loc) · 11.9 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
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
import os
import sys
from distutils.version import LooseVersion
from setuptools import setup, find_packages
version = '0.12.2'
# ***************************************************************************
# ************************** Python version *********************************
# ***************************************************************************
PY2 = sys.version_info[0] == 2
PY3 = sys.version_info[0] == 3
LTE_PY26 = PY2 and (7 > sys.version_info[1])
PYPY = hasattr(sys, 'pypy_translation_info')
# ***************************************************************************
# ************************** Django version *********************************
# ***************************************************************************
DJANGO_INSTALLED = False
try:
import django
DJANGO_INSTALLED = True
LOOSE_DJANGO_VERSION = LooseVersion(django.get_version())
LOOSE_DJANGO_MINOR_VERSION = LooseVersion(
'.'.join([str(i) for i in LOOSE_DJANGO_VERSION.version[0:2]])
)
# Loose versions
LOOSE_VERSIONS = (
'1.4', '1.5', '1.6', '1.7', '1.8', '1.9', '1.10', '1.11', '2.0', '2.1',
'2.2', '3.0'
)
for v in LOOSE_VERSIONS:
var_name = 'LOOSE_VERSION_{0}'.format(v.replace('.', '_'))
globals()[var_name] = LooseVersion(v)
# Exact versions
EXACT_VERSIONS = LOOSE_VERSIONS[:-1]
for i, v in enumerate(EXACT_VERSIONS):
l_cur = globals()['LOOSE_VERSION_{0}' \
''.format(LOOSE_VERSIONS[i].replace('.', '_'))]
l_nxt = globals()['LOOSE_VERSION_{0}' \
''.format(LOOSE_VERSIONS[i + 1].replace('.', '_'))]
var_name = 'DJANGO_{0}'.format(v.replace('.', '_'))
globals()[var_name] = (l_cur <= LOOSE_DJANGO_VERSION < l_nxt)
# LTE list
LTE_VERSIONS = LOOSE_VERSIONS[:-1]
for i, v in enumerate(EXACT_VERSIONS):
l_cur = globals()['LOOSE_VERSION_{0}' \
''.format(LOOSE_VERSIONS[i].replace('.', '_'))]
var_name = 'DJANGO_LTE_{0}'.format(v.replace('.', '_'))
globals()[var_name] = (LOOSE_DJANGO_MINOR_VERSION <= l_cur)
# GTE list
GTE_VERSIONS = LOOSE_VERSIONS[:-1]
for i, v in enumerate(EXACT_VERSIONS):
l_cur = globals()['LOOSE_VERSION_{0}' \
''.format(LOOSE_VERSIONS[i].replace('.', '_'))]
var_name = 'DJANGO_GTE_{0}'.format(v.replace('.', '_'))
globals()[var_name] = (
LOOSE_DJANGO_MINOR_VERSION >= l_cur
)
except Exception as err:
pass
# ***************************************************************************
# ***************************************************************************
# ***************************************************************************
try:
readme = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
screenshots = open(
os.path.join(os.path.dirname(__file__), 'docs/screenshots.rst.distrib')
).read()
screenshots = screenshots.replace(
'.. image:: _static',
'.. figure:: https://github.com/barseghyanartur/django-fobi/raw/'
'master/docs/_static'
)
except:
readme = ''
screenshots = ''
template_dirs = [
# Core templates
"src/fobi/templates/fobi",
# Bootstrap 3
"src/fobi/contrib/themes/bootstrap3/templates/bootstrap3",
# Foundation 5
"src/fobi/contrib/themes/foundation5/templates/foundation5",
# DB Store widget for Foundation 5
"src/fobi/contrib/themes/foundation5/widgets/form_handlers/"
"db_store_foundation5_widget",
# Simple
"src/fobi/contrib/themes/simple/templates/simple",
# djangocms_admin_style_theme
"src/fobi/contrib/themes/djangocms_admin_style_theme/templates/"
"djangocms_admin_style_theme",
# DjangoCMS integration
"src/fobi/contrib/apps/djangocms_integration/templates/"
"djangocms_integration",
# FeinCMS integration
# "src/fobi/contrib/apps/feincms_integration/templates/"
# "feincms_integration",
# Mezzanine integration
"src/fobi/contrib/apps/mezzanine_integration/templates/"
"mezzanine_integration",
# Wagtail integration
"src/fobi/contrib/apps/wagtail_integration/templates/"
"wagtail_integration",
# Content image
"src/fobi/contrib/plugins/form_elements/content/content_image/"
"templates/content_image",
# Content image URL
"src/fobi/contrib/plugins/form_elements/content/content_image_url/"
"templates/content_image_url",
# DB Store
"src/fobi/contrib/plugins/form_handlers/db_store/templates/db_store",
# Mail
"src/fobi/contrib/plugins/form_handlers/mail/templates/mail",
# Http re-post
"src/fobi/contrib/plugins/form_handlers/http_repost/templates/"
"http_repost",
# MailChimp importer
"src/fobi/contrib/plugins/form_importers/mailchimp_importer/templates/"
"mailchimp_importer",
]
static_dirs = [
# Core static
"src/fobi/static",
# Bootstrap3
"src/fobi/contrib/themes/bootstrap3/static",
# Bootstrap3 datetime widget
"src/fobi/contrib/themes/bootstrap3/widgets/form_elements/"
"datetime_bootstrap3_widget/static",
# Bootstrap3 date widget
"src/fobi/contrib/themes/bootstrap3/widgets/form_elements/"
"date_bootstrap3_widget/static",
# Bootstrap3 slider widget
"src/fobi/contrib/themes/bootstrap3/widgets/form_elements/"
"slider_bootstrap3_widget/static",
# Foundation5
"src/fobi/contrib/themes/foundation5/static",
# Foundation5 datetime widget
"src/fobi/contrib/themes/foundation5/widgets/form_elements/"
"datetime_foundation5_widget/static",
# Foundation5 date widget
"src/fobi/contrib/themes/foundation5/widgets/form_elements/"
"date_foundation5_widget/static",
# Simple
"src/fobi/contrib/themes/simple/static",
# djangocms_admin_style_theme
"src/fobi/contrib/themes/djangocms_admin_style_theme/static",
# DB Store
"src/fobi/contrib/plugins/form_handlers/db_store/static",
# Dummy
"src/fobi/contrib/plugins/form_elements/test/dummy/static",
]
locale_dirs = [
"src/fobi/locale/nl",
"src/fobi/locale/ru",
"src/fobi/locale/de",
]
templates = []
static_files = []
locale_files = []
for template_dir in template_dirs:
templates += [os.path.join(template_dir, f)
for f
in os.listdir(template_dir)]
for static_dir in static_dirs:
static_files += [os.path.join(static_dir, f)
for f
in os.listdir(static_dir)]
for locale_dir in locale_dirs:
locale_files += [os.path.join(locale_dir, f)
for f
in os.listdir(locale_dir)]
dependency_links = []
install_requires = []
# If certain version of Django is already installed, choose version agnostic
# dependencies.
if DJANGO_INSTALLED:
if DJANGO_1_5 or DJANGO_1_6 or DJANGO_1_7:
install_requires = [
'django-autoslug==1.7.1',
# 'django-formtools>=1.0',
'django-nine>=0.1.13',
'django-nonefield>=0.1',
# 'ordereddict>=1.1',
'Pillow>=2.0.0',
'requests>=1.0.0',
'six>=1.9',
'Unidecode>=0.04.1',
'vishap>=0.1.5,<2.0',
]
elif DJANGO_1_8:
install_requires = [
'django-autoslug==1.7.1',
'django-formtools>=1.0',
'django-nine>=0.1.13',
'django-nonefield>=0.1',
# 'ordereddict>=1.1',
'Pillow>=2.0.0',
'requests>=1.0.0',
'six>=1.9',
'Unidecode>=0.04.1',
'vishap>=0.1.5,<2.0',
]
elif DJANGO_1_9:
install_requires = [
'django-autoslug==1.9.3',
'django-formtools>=1.0',
'django-nine>=0.1.13',
'django-nonefield>=0.1',
# 'ordereddict>=1.1',
'Pillow>=2.0.0',
'requests>=1.0.0',
'six>=1.9',
'Unidecode>=0.04.1',
'vishap>=0.1.5,<2.0',
]
elif DJANGO_1_10:
install_requires = [
'django-autoslug==1.9.3',
'django-formtools>=1.0',
'django-nine>=0.1.13',
'django-nonefield>=0.1',
# 'ordereddict>=1.1',
'Pillow>=2.0.0',
'requests>=1.0.0',
'six>=1.9',
'Unidecode>=0.04.1',
'vishap>=0.1.5,<2.0',
]
elif DJANGO_1_11:
install_requires = [
'django-autoslug==1.9.3',
'django-formtools',
'django-nine>=0.1.13',
'django-nonefield>=0.1',
# 'ordereddict>=1.1',
'Pillow>=2.0.0',
'requests>=1.0.0',
'six>=1.9',
'Unidecode>=0.04.1',
'vishap>=0.1.5,<2.0',
]
dependency_links.append(
'https://github.com/django/django-formtools/archive/master.tar.gz'
'#egg=django-formtools'
)
# Fall back to the latest dependencies
if not install_requires:
install_requires = [
'django-autoslug>=1.9.3',
'django-formtools>=1.0',
'django-nine>=0.1.13',
'django-nonefield>=0.1',
# 'ordereddict>=1.1',
'Pillow>=2.0.0',
'requests>=1.0.0',
'six>=1.9',
'Unidecode>=0.04.1',
'vishap>=0.1.5,<2.0',
]
# There are also conditional PY3/PY2 requirements. Scroll down to see them.
tests_require = [
'selenium',
'Faker',
# 'factory_boy',
# 'fake-factory',
# 'Pillow',
# 'pytest',
# 'pytest-django',
# 'pytest-cov',
# 'tox',
]
if PY3:
install_requires.append('simplejson>=3.0.0') # When using Python 3
if DJANGO_INSTALLED and not DJANGO_1_11:
install_requires.append('easy-thumbnails>=2.3')
else:
install_requires.append('easy-thumbnails>=2.4.1')
# dependency_links.append(
# 'https://github.com/SmileyChris/easy-thumbnails/archive/'
# 'master.tar.gz'
# '#egg=easy-thumbnails'
# )
else:
install_requires.append('simplejson>=2.1.0') # When using Python 2.*
install_requires.append('ordereddict>=1.1')
if DJANGO_INSTALLED and not DJANGO_1_11:
install_requires.append('easy-thumbnails>=1.4')
else:
install_requires.append('easy-thumbnails>=2.4.1')
# dependency_links.append(
# 'https://github.com/SmileyChris/easy-thumbnails/archive/'
# 'master.tar.gz'
# '#egg=easy-thumbnails'
# )
setup(
name='django-fobi',
version=version,
description="Form generator/builder application for Django done right: "
"customisable, modular, user- and developer- friendly.",
long_description="{0}{1}".format(readme, screenshots),
classifiers=[
# "Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
# "Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Environment :: Web Environment",
"License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
"License :: OSI Approved :: GNU Lesser General Public License v2 or "
"later (LGPLv2+)",
"Framework :: Django",
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Development Status :: 4 - Beta",
],
keywords="django, form generator, form builder, visual form designer, "
"user generated forms",
author='Artur Barseghyan',
author_email='[email protected]',
url='https://github.com/barseghyanartur/django-fobi/',
package_dir={'': 'src'},
packages=find_packages(where='./src'),
license='GPL 2.0/LGPL 2.1',
install_requires=install_requires,
tests_require=tests_require,
dependency_links=dependency_links,
package_data={
'fobi': templates + static_files + locale_files
},
include_package_data=True,
)