forked from rvanlaar/djangorecipe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfabfile.py
40 lines (29 loc) · 1.09 KB
/
fabfile.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
import os
import re
from fabric.api import env, local
version_re = re.compile(r'''version\s*=\s*['"](?P<version>[\d\.]+)['"]''')
def get_version():
"""Extract the current version from the setup.py file."""
setup = open('setup.py').read()
return version_re.search(setup).group('version')
env.version = get_version()
def release_djangorecipe():
"""Release Djangorecipe to PyPi."""
version = get_version()
test()
local('python setup.py sdist')
# Make sure we have a proper release that could be installed.
local('tar xfz %s/dist/djangorecipe-%s.tar.gz -C /tmp' % (
os.path.abspath('.'), version))
local('cd /tmp/djangorecipe-$(version); python setup.py egg_info')
# Release the code.
local('python setup.py sdist register upload')
def release():
"""Release and tag djangorecipe."""
release_djangorecipe()
local('git tag -a release-%(version)s -m release-%(version)s' % env)
def test():
"""Create an in-place installation and run the tests."""
local('python bootstrap.py')
local('./bin/buildout -v')
local('./bin/test')