Skip to content

Commit 6e59ee0

Browse files
author
Hugo Osvaldo Barrera
committed
Add a pre-commit hook to rebuild travis config
1 parent 82375f2 commit 6e59ee0

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

.pre-commit-config.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,12 @@ repos:
1414
hooks:
1515
- id: flake8
1616
additional_dependencies: [flake8-import-order, flake8-bugbear]
17+
- repo: local
18+
hooks:
19+
- id: update-travis
20+
name: Update travis job definition
21+
description: Ensures that travis job definition are up to date.
22+
entry: scripts/make_travisconf.py
23+
files: '.*travis.*'
24+
stages: [commit]
25+
language: script

Makefile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,6 @@ style:
9696
! git grep -i syncroniz */*
9797
! git grep -i 'text/icalendar' */*
9898
sphinx-build -W -b html ./docs/ ./docs/_build/html/
99-
python3 scripts/make_travisconf.py | diff -b .travis.yml -
100-
101-
travis-conf:
102-
python3 scripts/make_travisconf.py > .travis.yml
10399

104100
install-docs:
105101
pip install -Ur docs-requirements.txt

scripts/make_travisconf.py

100644100755
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
#!/usr/bin/env python
2+
13
import itertools
24
import json
3-
import sys
45

56
python_versions = ("3.5", "3.6")
67
latest_python = "3.6"
@@ -57,10 +58,8 @@
5758
job = {
5859
'python': python,
5960
'env': ("BUILD=test-storage "
60-
"DAV_SERVER={dav_server} "
61-
"REQUIREMENTS={requirements} "
62-
.format(dav_server=dav_server,
63-
requirements=requirements))
61+
f"DAV_SERVER={dav_server} "
62+
f"REQUIREMENTS={requirements} ")
6463
}
6564

6665
build_prs = dav_server not in ("fastmail", "davical", "icloud")
@@ -82,4 +81,5 @@
8281
# 'env': 'BUILD=test'
8382
# })
8483

85-
json.dump(cfg, sys.stdout, sort_keys=True, indent=2)
84+
with open('.travis.yml', 'w') as output:
85+
json.dump(cfg, output, sort_keys=True, indent=2)

0 commit comments

Comments
 (0)