Merge ~barryprice/spade/+git/spade:master into spade:master

Proposed by Barry Price
Status: Needs review
Proposed branch: ~barryprice/spade/+git/spade:master
Merge into: spade:master
Diff against target: 113 lines (+49/-19)
5 files modified
Makefile (+13/-14)
dev/null (+0/-3)
setup.py (+1/-1)
spade/spade.py (+1/-1)
tox.ini (+34/-0)
Reviewer Review Type Date Requested Status
Haw Loeung +1 Approve
Review via email: mp+394566@code.launchpad.net

Commit message

Modernise, switch to python3 exclusively

To post a comment you must log in.
~barryprice/spade/+git/spade:master updated
c85283a... by Barry Price

Typo

Revision history for this message
Haw Loeung (hloeung) wrote :

LGTM

review: Approve (+1)

Unmerged commits

c85283a... by Barry Price

Typo

7e34f18... by Barry Price

Modernise, switch to python3 exclusively

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/Makefile b/Makefile
2index c3b3ca6..03544a4 100644
3--- a/Makefile
4+++ b/Makefile
5@@ -1,23 +1,22 @@
6-version := $(shell python -c "from spade import __version__; print(__version__)")
7-tempfiles_whl := build dist spade.egg-info
8-tempfiles_snap := snapcraft.yaml parts prime stage spade*.snap
9-tempfiles_misc := spade/__pycache__
10-tempfiles_export := spade-export spade-export27.tar.gz
11+version := $(shell python3 -c "from spade import __version__; print(__version__)")
12+tempfiles_snap := snap/snapcraft.yaml spade*.snap
13
14-whl: whl_clean
15- python3 setup.py bdist_wheel
16+blacken:
17+ @echo "Normalising python layout with black (but not really)."
18
19-whl_clean:
20- rm -Rf $(tempfiles_whl)
21+lint: blacken
22+ @echo "Running flake8"
23+ @tox -e lint
24+
25+clean:
26+ @echo "Cleaning files"
27+ @git clean -fXd
28
29 snap: snap_clean
30- sed -e "s/{{VERSION}}/$(version)/" snapcraft.yaml.in > snapcraft.yaml
31+ sed -e "s/{{VERSION}}/$(version)/" snapcraft.yaml.in > snap/snapcraft.yaml
32 snapcraft
33
34 snap_clean:
35 rm -Rf $(tempfiles_snap)
36
37-clean: whl_clean snap_clean
38-
39-lint:
40- @find spade -name \*py | xargs flake8 --config=/dev/null --ignore=C901 --max-line-length=120 --max-complexity=10 --hang-closing
41+.PHONY: blacken lint clean snap snap_clean
42diff --git a/setup.py b/setup.py
43index e52b204..7286fa2 100644
44--- a/setup.py
45+++ b/setup.py
46@@ -6,7 +6,7 @@ import re
47 here = path.abspath(path.dirname(__file__))
48
49 def find_version(*file_paths):
50- with open(path.join(here, *file_paths), 'r', 'latin1') as f:
51+ with open(path.join(here, *file_paths), 'r', 'utf-8') as f:
52 version_file = f.read()
53 version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
54 version_file, re.M)
55diff --git a/snap/.snapcraft/state b/snap/.snapcraft/state
56deleted file mode 100644
57index 3497788..0000000
58--- a/snap/.snapcraft/state
59+++ /dev/null
60@@ -1,3 +0,0 @@
61-!GlobalState
62-assets:
63- build-packages: []
64diff --git a/spade/spade.py b/spade/spade.py
65index c0404a2..c000805 100755
66--- a/spade/spade.py
67+++ b/spade/spade.py
68@@ -1,4 +1,4 @@
69-#!/usr/bin/env python
70+#!/usr/bin/env python3
71
72 from __future__ import print_function
73
74diff --git a/tox.ini b/tox.ini
75new file mode 100644
76index 0000000..b1b3e16
77--- /dev/null
78+++ b/tox.ini
79@@ -0,0 +1,34 @@
80+[tox]
81+skipsdist=True
82+envlist = unit, functional
83+
84+[testenv]
85+basepython = python3
86+
87+[testenv:unit]
88+commands =
89+ pytest --ignore mod --ignore {toxinidir}/tests/functional \
90+ {posargs:-v --cov=spade --cov-report=term-missing --cov-branch}
91+deps = -r{toxinidir}/tests/unit/requirements.txt
92+ -r{toxinidir}/requirements.txt
93+setenv =
94+ PYTHONPATH={toxinidir}/spade
95+ TZ=UTC
96+
97+[testenv:black]
98+commands = black --skip-string-normalization --line-length=120 spade/ tests/
99+deps = black
100+
101+[testenv:lint]
102+commands = flake8 spade/ tests/
103+# Pin flake8 to 3.7.9 to match focal
104+deps =
105+ flake8==3.7.9
106+
107+[flake8]
108+exclude =
109+ .git,
110+ __pycache__,
111+ .tox,
112+max-line-length = 120
113+max-complexity = 10

Subscribers

People subscribed via source and target branches

to all changes: