-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfabfile.py
71 lines (49 loc) · 1.53 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
from fabric.api import lcd, local, settings
import fabfile
import os
import podparser
import sys
import types
def build_docs():
"""
Create parser documentation
requires: python-sphinx
"""
with lcd('docs'):
fname = 'docs.zip'
with settings(warn_only=True):
local('rm %s' % fname)
local('rm -rf html/%s' % podparser.get_version())
local('make clean html', capture=False)
# copy current version to root and versioned directory
local('cp -rf _build/html html/%s' % podparser.get_version())
local('cp -rf _build/html .')
with lcd('html'):
local('zip -r ../%s .' % fname)
def upload():
"""Upload new package to pypi"""
code_check()
run_tests()
local('python setup.py sdist upload', capture=False)
def upload_docs():
"""
Upload sphinx documentation to pypi
requires: Sphinx-PyPI-upload
"""
build_docs()
local('python setup.py upload_sphinx --upload-dir=docs/html')
def code_check():
"""Run code style checker"""
local('find podparser -name "*.py" | xargs pep8 --ignore=E221',
capture=False)
def run_tests():
"""Run parser tests"""
local('python -m unittest test.tests', capture=False)
def release():
"""Create a new version of the podparser"""
# upload new package to pypi
upload()
# upload new package to pypi
upload_docs()
# create new tag
local('git tag -a %s -m "release version %s"' % (podparser.get_version(), podparser.get_version()))