forked from nicfit/eyeD3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fabfile.py
57 lines (50 loc) · 2.11 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
# -*- coding: utf-8 -*-
################################################################################
# Copyright (C) 2012 Travis Shirk <travis@pobox.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
################################################################################
import os
from fabric.api import run, put, local, task
from pavement import SRC_DIST_TGZ, DOC_DIST, SRC_DIST_ZIP
RELEASE_D = "~/www/eyeD3/releases"
@task
def deploy_sdist(test=False):
'''Deploy .tgz, .zip, and .md5'''
test = bool(test) # string from cmd line, not-empty is True
for pkg in (SRC_DIST_TGZ, SRC_DIST_ZIP):
put("./dist/%s" % pkg, RELEASE_D)
local("md5sum dist/%s >> dist/%s.md5" % (pkg, pkg))
put("./dist/%s.md5" % pkg, RELEASE_D)
twine(test)
@task
def deploy_docs():
'''Deploy docs tarball and install.'''
local("paver docdist")
local("md5sum dist/%s >> dist/%s.md5" % (DOC_DIST, DOC_DIST))
put("./dist/%s" % DOC_DIST, RELEASE_D)
run("tar xzf %s -C ./www/eyeD3 --strip-components=1" %
os.path.join(RELEASE_D, DOC_DIST))
@task
def deploy():
deploy_sdist()
deploy_docs()
@task
def twine(test=True):
# These repo names are defined in ~/pypirc
repo = "pypi" if not test else "pypitest"
local("twine register -r {repo} dist/{file}".format(repo=repo,
file=SRC_DIST_TGZ))
local("twine upload -r {repo} dist/{file}".format(repo=repo,
file=SRC_DIST_TGZ))