-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.pushrc
64 lines (46 loc) · 1.96 KB
/
.pushrc
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
# vi:syntax=python
from pushlib.tasks import *
from pushlib.tools import copy, abort
# which clone target do we want to deploy to
env.clone_path = "push/push"
# we also want to skip tests on ourself
# env.skip_tests = True
# don't want to require a tag
# env.no_tag = True
# don't want to create wrappers for anything in bin/sbin (only used by the
# wrappers contrib module.)
# env.skip_wrappers = True
# we want to remove the old push directory
env.force_clean_remote = True
# override the test task
class TestTask(TestTask):
def before(self, c):
super().before(c)
# copy files into the test directory to do testing
for path in [".pushrc", "push", "pushlib"]:
copy(path, env.test_dir)
# run pycodestyle against this project. this runs against pythone files
# in the test directory, copied above.
ignore = ['E121', 'E123', 'E126', 'E133', 'E226', 'E241', 'E242', 'E704', 'W503', 'W504', 'W505', 'E501']
test = c.run("find {} -type f -print0 | xargs -0 pycodestyle --ignore={}".format(env.test_dir, ",".join(ignore)), warn=True)
if (not test.ok):
abort("Tests failed.")
# override the archive task
class ArchiveTask(ArchiveTask):
def before(self, c):
super().before(c)
# copy each of these from .push/build to .push/release/push which will
# then deploy to /netops/push (or /clone/sources/push/common)
for path in ["push", "pushlib"]:
copy(path, "push")
# override the deploy task
class DeployTask(DeployTask):
def before(self):
super().before()
# remove this directory on the remote host before deploying. this will
# automatically prepend either /srv or /clone/sources/<target>
# to the path before removing it.
self.clean("push")
# if we're deploying ourselves we must do it from the dev version
if (__file__.startswith(env.host_path)):
abort("Must deploy push using \"./push\" and not \"push\".")