-
Notifications
You must be signed in to change notification settings - Fork 3
/
setup.py
99 lines (85 loc) · 2.68 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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import shutil
import sys
from setuptools import setup
def read(*paths):
"""
Build a file path from paths and return the contents.
"""
with open(os.path.join(*paths), 'r') as f:
return f.read()
def get_version(package):
"""
Return package version as listed in `__version__` in `init.py`.
"""
init_py = open(os.path.join(package, '__init__.py')).read()
return re.search("__version__ = ['\"]([^'\"]+)['\"]", init_py).group(1)
def get_packages(package):
"""
Return root package and all sub-packages.
"""
return [
dirpath for dirpath, dirnames, filenames in os.walk(package)
if os.path.exists(os.path.join(dirpath, '__init__.py'))
]
install_requires = [
'wagtail>=2.0<3.0',
'jsonfield>=2.0.1<3.0',
'filepreviews>=2.0.2,<3.0',
'django-model-utils>=3.0.0,<4.0'
]
tests_require = [
'responses>=0.5.1,<1.0',
'flake8>=3.3.0<4.0',
'isort>=4.2.5,<5.0'
]
version = get_version('wagtaildocs_previews')
if sys.argv[-1] == 'publish':
os.system("python setup.py sdist bdist_wheel")
os.system("twine upload dist/*")
print("You probably want to also tag the version now:")
print(" git tag -a %s -m 'version %s'" % (version, version))
print(" git push --tags")
shutil.rmtree('dist')
shutil.rmtree('build')
shutil.rmtree('wagtaildocs_previews.egg-info')
sys.exit()
setup(
name='wagtaildocs_previews',
version=version,
description=(
'Extend Wagtail\'s Documents with image previews and '
'metadata from FilePreviews.io'
),
author='José Padilla',
author_email='[email protected]',
url='https://github.com/filepreviews/wagtail-filepreviews',
packages=get_packages('wagtaildocs_previews'),
license='MIT',
long_description=read('README.rst'),
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Framework :: Django',
'Framework :: Django :: 1.8',
'Framework :: Django :: 1.9',
'Framework :: Django :: 1.10',
'Topic :: Internet :: WWW/HTTP :: Site Management',
],
install_requires=install_requires,
extras_require={
'test': tests_require,
}
)