forked from softlayer/softlayer-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fabfile.py
49 lines (33 loc) · 1.1 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
41
42
43
44
45
46
47
48
49
import os.path
import shutil
from fabric.api import local, lcd, puts, abort
def make_html():
"Build HTML docs"
with lcd('docs'):
local('make html')
def upload():
"Upload distribution to PyPi"
local('python setup.py sdist upload')
local('python setup.py bdist_wheel upload')
def clean():
puts("* Cleaning Repo")
directories = ['.tox', 'SoftLayer.egg-info', 'build', 'dist']
for directory in directories:
if os.path.exists(directory) and os.path.isdir(directory):
shutil.rmtree(directory)
def release(version, force=False):
"""Perform a release. Example:
$ fab release:3.0.0
"""
if version.startswith("v"):
abort("Version should not start with 'v'")
version_str = "v%s" % version
clean()
local("pip install wheel")
puts(" * Uploading to PyPI")
upload()
puts(" * Tagging Version %s" % version_str)
force_option = 'f' if force else ''
local("git tag -%sam \"%s\" %s" % (force_option, version_str, version_str))
puts(" * Pushing Tag to upstream")
local("git push upstream %s" % version_str)