-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.py
executable file
·88 lines (80 loc) · 3.12 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
#!/usr/bin/env python
import os
import re
import sys
from setuptools import setup, find_packages
def get_version(*file_paths):
"""Retrieves the version from vimage/__init__.py"""
filename = os.path.join(os.path.dirname(__file__), *file_paths)
version_file = open(filename).read()
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
version_file, re.M)
if version_match:
return version_match.group(1)
raise RuntimeError('Unable to find version string.')
version = get_version("vimage", "__init__.py")
if sys.argv[-1] == 'pypi':
try:
import twine
print(f'Twine version: {twine.__version__}')
except ImportError:
print('"twine" library is missing. Please run "pip install twine"')
sys.exit()
test = sys.argv[-2] == '--test'
repo_url = '--repository-url https://test.pypi.org/legacy/' if test else ''
# upon new release, create new source distribution and a
# new wheel distribution
print(f'[Step 1/3] creating source and wheel distributions '
f'for version {version}{"." * 10}')
os.system('python setup.py sdist bdist_wheel')
print('[Step 1/3] DONE!')
# # upon creation of the above two files, upload to pypi.org only
# # the newest version. First the source distribution
print(f'[Step 2/3] uploading source distribution{"." * 10}')
os.system(f'twine upload {repo_url} dist/django-vimage-{version}.tar.gz')
print('[Step 2/3] DONE!')
# # and then the wheel one.
print(f'[Step 3/3] uploading wheel distribution to pypi.org{"." * 10}')
os.system(f'twine upload {repo_url} '
f'dist/django_vimage-{version}-py3-none-any.whl')
print('[Step 3/3] DONE!')
print("Everything's done, congratulations!")
sys.exit()
readme = open('README.md').read()
setup(
name='django-vimage',
packages=find_packages(
include=('vimage', 'vimage.*'),
),
version='1.2.0',
description="""
Image validation (for the Django Admin) as a breeze.
Validations on: Size, Dimensions, Format and Aspect Ratio.
""",
long_description=readme,
long_description_content_type='text/markdown',
author='Nick Mavrakis',
author_email='[email protected]',
url='https://github.com/manikos/django-vimage',
include_package_data=True, # anything referred under MANIFEST.in
python_requires='>=3.6',
install_requires=['Django>=2', 'Pillow>=4.0.0'],
license='MIT',
zip_safe=False,
keywords='django image-validation django-admin easy-to-use',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Framework :: Django',
'Framework :: Django :: 2.0',
'Framework :: Django :: 3.0',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Natural Language :: English',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
],
)