forked from 2general/django-js-utils
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
101 lines (79 loc) · 2.86 KB
/
setup.py
File metadata and controls
101 lines (79 loc) · 2.86 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
from os import system
from os.path import dirname, join
from setuptools import setup
from distutils.core import Command
import django_js_utils
install_requires = [
'simplejson',
]
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 = django_js_utils.__version__
new_version = v[:-1] + (v[-1] + 1, )
new_version_str = '.'.join(map(str, new_version))
initfile = join(dirname(django_js_utils.__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)
setup(
name='django-js-utils-ng',
version=django_js_utils.__versionstr__,
description='Django URL Exposure to Javascript',
long_description=long_description,
author='Dimitri Gnidash, Jiri Suchan',
author_email='dimitri.gnidash@gmail.com',
url='https://github.com/SanomaCZ/django-js-utils',
packages=('django_js_utils', ),
license='BSD',
include_package_data=True,
cmdclass={
'bump_version': BumpVersion,
},
classifiers=[
"Development Status :: 4 - Beta",
"Environment :: Web Environment",
"Intended Audience :: Developers",
"License :: BSD",
"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
)