-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
131 lines (106 loc) · 3.57 KB
/
setup.py
File metadata and controls
131 lines (106 loc) · 3.57 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
from os import system
from os.path import dirname, join
from setuptools import setup
from distutils.core import Command
import stock
install_requires = [
'Django>=1.5.1,<1.6',
'South==0.7.6',
'Pillow>=2.0',
'sorl-thumbnail==11.12',
'django-grappelli==2.4.5',
'uwsgi==1.9.13',
'raven==3.4.0',
]
tests_require = [
'nose',
'coverage',
]
setup_requires = []
with open('README.rst') as readmefile:
long_description = readmefile.read()
class BumpVersion(Command):
description = "Bump version automatically (by your CI tool)"
user_options = [
('commit', None, 'Commit changed files to VCS (no push)'),
('tag', None, 'Create release tag in VCS (no push)'),
]
boolean_options = ['commit', 'tag']
def initialize_options(self):
self.commit = False
self.tag = False
def finalize_options(self):
pass
def run(self):
v = stock.__version__
new_version = v[:-1] + (v[-1] + 1, )
new_version_str = '.'.join(map(str, new_version))
initfile = join(dirname(stock.__file__), '__init__.py')
with open(initfile, 'r') as ifile:
print "Reading old package init file..."
istr = ifile.read()
istr = istr.replace(str(v), str(new_version))
with open(initfile, 'w') as ifile:
print "Writing new init file with version %s..." % new_version_str
ifile.write(istr)
if self.commit:
print "Committing version file to VCS..."
system('git commit %s -m "Version bump %s"' % (initfile, new_version_str))
if self.tag:
print "Creating tag r/%s in VCS..." % new_version_str
system('git tag r/%s' % new_version_str)
class MakeStatic(Command):
description = "Compile LESS files into CSS, combine javascripts etc"
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
params = {
'pth': 'stock/project_static',
'lessc_opts': '--yui-compress --verbose -O2',
'xjs_opts': ''
}
system('lessc %(lessc_opts)s %(pth)s/less/master.less %(pth)s/css/master.css' % params)
system('r.js %(xjs_opts)s -o %(pth)s/_dev/build.js' % params)
setup(
name='stock',
version=stock.__versionstr__,
description='stock',
long_description=long_description,
author='Sanoma Online Dev',
author_email='online-dev@sanomamedia.cz',
license='Proprietal',
#url='',
packages=('stock',),
include_package_data=True,
cmdclass={
'bump_version': BumpVersion,
'make_static': MakeStatic
},
classifiers=[
"Development Status :: 4 - Beta",
"Environment :: Web Environment",
"Intended Audience :: Developers",
"License :: Proprietal",
"Operating System :: OS Independent",
"Framework :: Django",
"Programming Language :: Python",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
"Topic :: Software Development :: Libraries :: Python Modules",
],
install_requires=install_requires,
test_suite='nose.collector',
tests_require=tests_require,
setup_requires=setup_requires,
entry_points={
'console_scripts': [
'stock-manage = stock.custom_manage:main',
],
},
)