-
Notifications
You must be signed in to change notification settings - Fork 21
/
setup.py
executable file
·92 lines (79 loc) · 2.78 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
import os
import shutil
import sys
from setuptools import (find_packages, setup)
__VERSION__ = '1.1.1'
def read_md(f):
try:
from pypandoc import convert
return convert(f, 'rst')
except ImportError:
return open(f, 'r').read()
def check_installed(*packages):
exit = False
# if not a list, let's make it into one
for package in packages:
if os.system('pip freeze | grep {} >/dev/null'.format(package)):
print('{0} not installed: use `pip install {0}`'.format(package))
exit = True
if exit:
print('Exiting.')
sys.exit()
def check_tagged_version(version):
current_branch_is_master = not os.system(
'git rev-parse --abbrev-ref HEAD | grep master >/dev/null')
master_is_tagged = not os.system(
'git tag --points-at master | grep {} >/dev/null'.format(version))
if not current_branch_is_master:
print('Publish can only be done from the master branch.')
if not master_is_tagged:
print('`{}` tag has not been created on the master branch.'.format(
version))
if not (current_branch_is_master and master_is_tagged):
print('Exiting.')
sys.exit()
try:
REQUIREMENTS = open('requirements/base.txt').read()
except Exception:
REQUIREMENTS = None
if sys.argv[-1] == 'publish':
check_installed('pypandoc', 'twine')
check_tagged_version(__VERSION__)
os.system("python setup.py sdist bdist_wheel")
os.system("twine upload dist/*")
shutil.rmtree('build')
shutil.rmtree('dist')
sys.exit()
setup(
name='django-arctic',
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'Topic :: Software Development :: Libraries',
'Topic :: Software Development :: Libraries :: Application Frameworks',
'Topic :: Internet :: WWW/HTTP',
'Framework :: Django',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
],
version=__VERSION__,
long_description=read_md('README.md'),
install_requires=REQUIREMENTS,
packages=find_packages(),
include_package_data=True,
entry_points={
'console_scripts': [
'arctic = arctic.bin.arctic:main',
]},
license='MIT',
url='https://github.com/sanoma/django-arctic',
author='Sanoma Netherlands',
author_email='opensource@sanoma.com',
description="Django framework to create custom content management systems",
)