forked from orb-framework/pyramid_orb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
80 lines (68 loc) · 2.56 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
import os
import re
import subprocess
import sys
from setuptools import setup, find_packages, Command
from setuptools.command.test import test as TestCommand
try:
with open('pyramid_orb/_version.py', 'r') as f:
content = f.read()
major = re.search('__major__ = (\d+)', content).group(1)
minor = re.search('__minor__ = (\d+)', content).group(1)
rev = re.search('__revision__ = "(\d+)"', content).group(1)
version = '.'.join((major, minor, rev))
except StandardError:
version = '0.0.0'
class tag(Command):
description = 'Command used to release new versions of the website to the internal pypi server.'
user_options = [
('no-tag', None, 'Do not tag the repo before releasing')
]
def initialize_options(self):
self.no_tag = False
def finalize_options(self):
pass
def run(self):
# generate the version information from the current git commit
cmd = ['git', 'describe', '--match', 'v[0-9]*.[0-9]*.0']
desc = subprocess.check_output(cmd).strip()
result = re.match('v([0-9]+)\.([0-9]+)\.0-([0-9]+)-(.*)', desc)
print 'generating version information from:', desc
with open('./pyramid_orb/_version.py', 'w') as f:
f.write('__major__ = {0}\n'.format(result.group(1)))
f.write('__minor__ = {0}\n'.format(result.group(2)))
f.write('__revision__ = "{0}"\n'.format(result.group(3)))
f.write('__hash__ = "{0}"'.format(result.group(4)))
# tag this new release version
if not self.no_tag:
version = '.'.join([result.group(1), result.group(2), result.group(3)])
print 'creating git tag:', 'v' + version
os.system('git tag -a v{0} -m "releasing {0}"'.format(version))
os.system('git push --tags')
else:
print 'warning: tagging ignored...'
setup(
name='pyramid_orb',
version=version,
author='Eric Hulser',
author_email='[email protected]',
maintainer='Eric Hulser',
maintainer_email='[email protected]',
description='Bindings for the pyramid webframework and the ORB database ORM library.',
license='MIT',
keywords='',
url='https://github.com/ProjexSoftware/pyramid_orb',
include_package_data=True,
packages=find_packages(),
install_requires=[
'projex',
'orb-api',
'pyramid',
'pyramid_restful'
],
cmdclass={
'tag': tag
},
long_description='Bindings for the pyramid webframework and the ORB database ORM library.',
classifiers=[],
)