Skip to content

Commit 94c315a

Browse files
authored
Merge pull request #44 from bbc/dev
Merge dev -> master
2 parents 3319e60 + 4468030 commit 94c315a

23 files changed

Lines changed: 517 additions & 2598 deletions

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
# mediatimestamp Changelog
22

3+
## 2.0.0
4+
- Dropped all support for python 2.7
5+
- Swapped the mutable and immutable defaults
6+
- Removed the inclusion of the constants at the top level
7+
- Removed all mutable timestamps
8+
39
## 1.7.3
410
- Normalise time ranges where start > end to equal TimeRange.never().
511
- Normalise inclusivity for unbounded time ranges to equal TimeRange.eternity().
612

713
## 1.7.2
8-
- Require Python version 3.6 rather than 3.
14+
- This is the final version of this library to support Python 2.7
915

1016
## 1.7.1
1117
- Correct inclusivity names in `timerange_between` method.

Jenkinsfile

Lines changed: 116 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -47,91 +47,88 @@ pipeline {
4747
sh "pyenv local 3.6.8"
4848
}
4949
}
50-
stage ("Parallel Jobs") {
51-
parallel {
52-
stage ("Linting Check") {
53-
steps {
54-
script {
55-
env.lint_result = "FAILURE"
56-
}
57-
bbcGithubNotify(context: "lint/flake8", status: "PENDING")
58-
sh 'flake8'
59-
script {
60-
env.lint_result = "SUCCESS" // This will only run if the sh above succeeded
61-
}
62-
}
63-
post {
64-
always {
65-
bbcGithubNotify(context: "lint/flake8", status: env.lint_result)
66-
}
67-
}
50+
stage ("Clean") {
51+
steps {
52+
sh 'git clean -dfx'
53+
sh 'make clean'
54+
}
55+
}
56+
stage ("Linting Check") {
57+
steps {
58+
script {
59+
env.lint_result = "FAILURE"
6860
}
69-
stage ("Build Docs") {
70-
steps {
71-
sh 'TOXDIR=/tmp/$(basename ${WORKSPACE})/tox-docs make docs'
72-
}
73-
}
74-
stage ("Unit Tests") {
75-
stages {
76-
stage ("Python 2.7 Unit Tests") {
77-
steps {
78-
script {
79-
env.py27_result = "FAILURE"
80-
}
81-
bbcGithubNotify(context: "tests/py27", status: "PENDING")
82-
// Use a workdirectory in /tmp to avoid shebang length limitation
83-
sh 'tox -e py27 --recreate --workdir /tmp/$(basename ${WORKSPACE})/tox-py27'
84-
script {
85-
env.py27_result = "SUCCESS" // This will only run if the sh above succeeded
86-
}
87-
}
88-
post {
89-
always {
90-
bbcGithubNotify(context: "tests/py27", status: env.py27_result)
91-
}
92-
}
93-
}
94-
stage ("Python 3 Unit Tests") {
95-
steps {
96-
script {
97-
env.py3_result = "FAILURE"
98-
}
99-
bbcGithubNotify(context: "tests/py3", status: "PENDING")
100-
// Use a workdirectory in /tmp to avoid shebang length limitation
101-
sh 'tox -e py3 --recreate --workdir /tmp/$(basename ${WORKSPACE})/tox-py3'
102-
script {
103-
env.py3_result = "SUCCESS" // This will only run if the sh above succeeded
104-
}
105-
}
106-
post {
107-
always {
108-
bbcGithubNotify(context: "tests/py3", status: env.py3_result)
109-
}
110-
}
111-
}
112-
}
61+
bbcGithubNotify(context: "lint/flake8", status: "PENDING")
62+
sh 'make lint'
63+
script {
64+
env.lint_result = "SUCCESS" // This will only run if the sh above succeeded
11365
}
114-
stage ("Debian Source Build") {
115-
steps {
116-
script {
117-
env.debSourceBuild_result = "FAILURE"
118-
}
119-
bbcGithubNotify(context: "deb/sourceBuild", status: "PENDING")
66+
}
67+
post {
68+
always {
69+
bbcGithubNotify(context: "lint/flake8", status: env.lint_result)
70+
}
71+
}
72+
}
73+
stage ("Type Check") {
74+
steps {
75+
script {
76+
env.mypy_result = "FAILURE"
77+
}
78+
bbcGithubNotify(context: "type/mypy", status: "PENDING")
79+
sh 'make mypy'
80+
script {
81+
env.mypy_result = "SUCCESS" // This will only run if the sh above succeeded
82+
}
83+
}
84+
post {
85+
always {
86+
bbcGithubNotify(context: "type/mypy", status: env.mypy_result)
87+
}
88+
}
89+
}
90+
stage ("Build Docs") {
91+
steps {
92+
sh 'make docs'
93+
}
94+
}
95+
stage ("Python 3 Unit Tests") {
96+
steps {
97+
script {
98+
env.py3_result = "FAILURE"
99+
}
100+
bbcGithubNotify(context: "tests/py3", status: "PENDING")
101+
// Use a workdirectory in /tmp to avoid shebang length limitation
102+
sh 'make test'
103+
script {
104+
env.py3_result = "SUCCESS" // This will only run if the sh above succeeded
105+
}
106+
}
107+
post {
108+
always {
109+
bbcGithubNotify(context: "tests/py3", status: env.py3_result)
110+
}
111+
}
112+
}
113+
stage ("Debian Source Build") {
114+
steps {
115+
script {
116+
env.debSourceBuild_result = "FAILURE"
117+
}
118+
bbcGithubNotify(context: "deb/sourceBuild", status: "PENDING")
120119

121-
sh 'rm -rf deb_dist'
122-
sh 'python ./setup.py sdist'
123-
sh 'make dsc'
124-
bbcPrepareDsc()
125-
stash(name: "deb_dist", includes: "deb_dist/*")
126-
script {
127-
env.debSourceBuild_result = "SUCCESS" // This will only run if the steps above succeeded
128-
}
129-
}
130-
post {
131-
always {
132-
bbcGithubNotify(context: "deb/sourceBuild", status: env.debSourceBuild_result)
133-
}
134-
}
120+
sh 'rm -rf deb_dist'
121+
sh 'python ./setup.py sdist'
122+
sh 'make dsc'
123+
bbcPrepareDsc()
124+
stash(name: "deb_dist", includes: "deb_dist/*")
125+
script {
126+
env.debSourceBuild_result = "SUCCESS" // This will only run if the steps above succeeded
127+
}
128+
}
129+
post {
130+
always {
131+
bbcGithubNotify(context: "deb/sourceBuild", status: env.debSourceBuild_result)
135132
}
136133
}
137134
}
@@ -159,14 +156,14 @@ pipeline {
159156
expression { return params.FORCE_DEBUPLOAD }
160157
expression { return params.FORCE_DOCSUPLOAD }
161158
expression {
162-
bbcShouldUploadArtifacts(branches: ["master"])
159+
bbcShouldUploadArtifacts(branches: ["master", "dev"])
163160
}
164161
}
165162
}
166-
parallel {
163+
stages {
167164
stage ("Upload Docs") {
168165
when {
169-
anyOf {
166+
anyOf {
170167
expression { return params.FORCE_DOCSUPLOAD }
171168
expression {
172169
bbcShouldUploadArtifacts(branches: ["master"])
@@ -192,9 +189,8 @@ pipeline {
192189
}
193190
bbcGithubNotify(context: "pypi/upload", status: "PENDING")
194191
sh 'rm -rf dist/*'
195-
bbcMakeGlobalWheel("py27")
196-
bbcMakeGlobalWheel("py3")
197-
bbcTwineUpload(toxenv: "py3", pypi: true)
192+
bbcMakeGlobalWheel("py36")
193+
bbcTwineUpload(toxenv: "py36", pypi: true)
198194
script {
199195
env.pypiUpload_result = "SUCCESS" // This will only run if the steps above succeeded
200196
}
@@ -205,6 +201,33 @@ pipeline {
205201
}
206202
}
207203
}
204+
stage ("Upload to Artifactory") {
205+
when {
206+
anyOf {
207+
expression { return params.FORCE_PYUPLOAD }
208+
expression {
209+
bbcShouldUploadArtifacts(branches: ["dev"])
210+
}
211+
}
212+
}
213+
steps {
214+
script {
215+
env.artifactoryUpload_result = "FAILURE"
216+
}
217+
bbcGithubNotify(context: "artifactory/upload", status: "PENDING")
218+
sh 'rm -rf dist/*'
219+
bbcMakeGlobalWheel("py36")
220+
bbcTwineUpload(toxenv: "py36", pypi: false)
221+
script {
222+
env.artifactoryUpload_result = "SUCCESS" // This will only run if the steps above succeeded
223+
}
224+
}
225+
post {
226+
always {
227+
bbcGithubNotify(context: "artifactory/upload", status: env.artifactoryUpload_result)
228+
}
229+
}
230+
}
208231
stage ("Upload deb") {
209232
when {
210233
anyOf {
@@ -238,11 +261,11 @@ pipeline {
238261
}
239262
}
240263
}
241-
}
242-
}
243-
post {
244-
always {
245-
bbcSlackNotify(channel: "#apmm-cloudfit")
264+
post {
265+
always {
266+
bbcSlackNotify(channel: "#apmm-cloudfit")
267+
}
268+
}
246269
}
247270
}
248271
}

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) BBC 2017
1+
Copyright (c) BBC 2017-2020
22

33
Licensed under the Apache License, Version 2.0 (the "License");
44
you may not use this Specification except in compliance with the License.

MANIFEST.in

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ include stdeb.cfg
77
include ICLA.md
88
include ICLA.pdf
99
include LICENSE.md
10-
include NOTICE.md
10+
include NOTICE.md
11+
include mediatimestamp/py.typed
12+
unclude mediatimestamp/hypothesis/py.typed

Makefile

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
PYTHON=`which python`
2-
PYTHON2=`which python2`
3-
PYTHON3=`which python3`
1+
PYTHON=`which python3`
42
PY2DSC=`which py2dsc`
53

6-
PY2DSC_PARAMS?=--with-python2=true --with-python3=true
4+
PY2DSC_PARAMS?=--with-python2=false --with-python3=true
75

86
topdir := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
97
topbuilddir := $(realpath .)
@@ -15,7 +13,7 @@ MODNAME=$(PROJECT)
1513

1614
# The rules for names and versions in python, rpm, and deb are different
1715
# and not entirely compatible. As such py2dsc will automatically convert
18-
# your package name into a suitable deb name and version number, and this
16+
# your package name into a suitable deb name and version number, and this
1917
# code replicates that.
2018
DEBNAME=$(shell echo $(MODNAME) | tr '[:upper:]_' '[:lower:]-')
2119
DEBVERSION=$(shell echo $(VERSION) | sed 's/\.dev/~dev/')
@@ -30,6 +28,8 @@ RPMDIRS=BUILD BUILDROOT RPMS SOURCES SPECS SRPMS
3028
RPMBUILDDIRS=$(patsubst %, $(RPM_PREFIX)/%, $(RPMDIRS))
3129

3230
TOXDIR?=$(topbuilddir)/.tox/
31+
TOXENV?=py36
32+
TOX_ACTIVATE=$(TOXDIR)/$(TOXENV)/bin/activate
3333

3434
all:
3535
@echo "$(PROJECT)-$(VERSION)"
@@ -67,13 +67,10 @@ clean:
6767
find $(topdir) -name '*.py,cover' -delete
6868
rm -rf $(topbuilddir)/docs
6969

70-
testenv: $(TOXDIR)/py27/bin/activate $(TOXDIR)/py3/bin/activate
70+
testenv: $(TOX_ACTIVATE)
7171

72-
$(TOXDIR)/py3/bin/activate: tox.ini
73-
tox -e py3 --recreate --workdir $(TOXDIR)
74-
75-
$(TOXDIR)/py27/bin/activate: tox.ini
76-
tox -e py27 --recreate --workdir $(TOXDIR)
72+
$(TOX_ACTIVATE): tox.ini setup.py
73+
tox -e $(TOXENV) --recreate --notest --workdir $(TOXDIR)
7774

7875
test:
7976
tox --workdir $(TOXDIR)
@@ -96,7 +93,7 @@ deb: source deb_dist $(DEBIANOVERRIDES)
9693
$(RPM_PREFIX)/$(MODNAME).spec: rpm_spec
9794

9895
rpm_spec: $(topdir)/setup.py
99-
$(PYTHON3) $(topdir)/setup.py bdist_rpm $(RPM_PARAMS) --spec-only --dist-dir=$(RPM_PREFIX) --python=python3.4
96+
$(PYTHON3) $(topdir)/setup.py bdist_rpm $(RPM_PARAMS) --spec-only --dist-dir=$(RPM_PREFIX) --python=python3.6
10097
# END OF RPM SPEC RULES
10198

10299
$(RPMBUILDDIRS):
@@ -117,20 +114,24 @@ rpm: $(RPM_PREFIX)/SPECS/$(MODNAME).spec $(RPM_PREFIX)/SOURCES/$(MODNAME)-$(VERS
117114
cp $(RPM_PREFIX)/RPMS/*/*.rpm $(topbuilddir)/dist
118115

119116
wheel:
120-
$(PYTHON2) $(topdir)/setup.py bdist_wheel
121-
$(PYTHON3) $(topdir)/setup.py bdist_wheel
117+
$(PYTHON) $(topdir)/setup.py bdist_wheel
122118

123119
egg:
124-
$(PYTHON2) $(topdir)/setup.py bdist_egg
125-
$(PYTHON3) $(topdir)/setup.py bdist_egg
120+
$(PYTHON) $(topdir)/setup.py bdist_egg
126121

127122
docs: $(topbuilddir)/docs/$(MODNAME).html
128123

129124
$(topbuilddir)/docs/$(MODNAME):
130125
mkdir -p $(topbuilddir)/docs
131126
ln -s $(topdir)/$(MODNAME) $(topbuilddir)/docs/
132127

133-
$(topbuilddir)/docs/$(MODNAME).html: $(topbuilddir)/docs/$(MODNAME) $(TOXDIR)/py3/bin/activate
134-
. $(TOXDIR)/py3/bin/activate && cd $(topbuilddir)/docs/ && pydoc -w ./
128+
$(topbuilddir)/docs/$(MODNAME).html: $(topbuilddir)/docs/$(MODNAME) $(TOX_ACTIVATE)
129+
. $(TOX_ACTIVATE) && cd $(topbuilddir)/docs/ && pydoc -w ./
130+
131+
lint: $(TOX_ACTIVATE)
132+
. $(TOX_ACTIVATE) && flake8 $(MODNAME) tests
133+
134+
mypy: $(TOX_ACTIVATE)
135+
. $(TOX_ACTIVATE) && python -m mypy -p $(MODNAME)
135136

136-
.PHONY: test testenv clean install source deb dsc rpm wheel egg all rpm_dirs rpm_spec docs
137+
.PHONY: test testenv clean install source deb dsc rpm wheel egg all rpm_dirs rpm_spec docs lint mypy

0 commit comments

Comments
 (0)