Javier Jardón pushed to branch jjardon/pycodestyle at BuildStream / buildstream
Commits:
-
10eeb503
by Javier Jardón at 2018-08-28T22:22:00Z
-
d3c32ca2
by Javier Jardón at 2018-08-28T22:22:00Z
-
3ae5fd05
by Javier Jardón at 2018-08-28T22:22:00Z
-
c6fb5ba7
by Javier Jardón at 2018-08-28T22:22:00Z
-
c5eca59d
by Tristan Van Berkom at 2018-08-29T10:45:33Z
-
8d608e6d
by Javier Jardón at 2018-08-29T11:04:33Z
-
46ffa1bd
by Javier Jardón at 2018-08-29T11:04:33Z
-
5fc75cb2
by Javier Jardón at 2018-08-29T11:04:33Z
14 changed files:
- .gitlab-ci.yml
- buildstream/_ostree.py
- buildstream/_signals.py
- buildstream/element.py
- buildstream/plugins/sources/tar.py
- buildstream/plugins/sources/zip.py
- buildstream/utils.py
- dev-requirements.txt
- doc/bst2html.py
- doc/source/conf.py
- setup.cfg
- tests/cachekey/cachekey.py
- tests/cachekey/update.py
- tests/frontend/buildcheckout.py
Changes:
... | ... | @@ -71,6 +71,8 @@ source_dist: |
71 | 71 |
- chown -R buildstream:buildstream buildstream
|
72 | 72 |
- cd buildstream
|
73 | 73 |
|
74 |
+ - pip3 install pytest-codestyle
|
|
75 |
+ |
|
74 | 76 |
# Run the tests from the source distribution, We run as a simple
|
75 | 77 |
# user to test for permission issues
|
76 | 78 |
- su buildstream -c 'python3 setup.py test --index-url invalid://uri --addopts --integration'
|
... | ... | @@ -120,6 +122,8 @@ tests-unix: |
120 | 122 |
# Unpack and get into dist/buildstream
|
121 | 123 |
- cd dist && ./unpack.sh && cd buildstream
|
122 | 124 |
|
125 |
+ - pip3 install pytest-codestyle
|
|
126 |
+ |
|
123 | 127 |
# Since the unix platform is required to run as root, no user change required
|
124 | 128 |
- python3 setup.py test --index-url invalid://uri --addopts --integration
|
125 | 129 |
|
... | ... | @@ -34,7 +34,7 @@ from ._exceptions import BstError, ErrorDomain |
34 | 34 |
|
35 | 35 |
# pylint: disable=wrong-import-position,wrong-import-order
|
36 | 36 |
gi.require_version('OSTree', '1.0')
|
37 |
-from gi.repository import GLib, Gio, OSTree # nopep8
|
|
37 |
+from gi.repository import GLib, Gio, OSTree # noqa
|
|
38 | 38 |
|
39 | 39 |
|
40 | 40 |
# For users of this file, they must expect (except) it.
|
... | ... | @@ -38,7 +38,7 @@ def terminator_handler(signal_, frame): |
38 | 38 |
terminator_ = terminator_stack.pop()
|
39 | 39 |
try:
|
40 | 40 |
terminator_()
|
41 |
- except: # pylint: disable=bare-except
|
|
41 |
+ except: # pylint: disable=bare-except # noqa
|
|
42 | 42 |
# Ensure we print something if there's an exception raised when
|
43 | 43 |
# processing the handlers. Note that the default exception
|
44 | 44 |
# handler won't be called because we os._exit next, so we must
|
... | ... | @@ -1519,7 +1519,7 @@ class Element(Plugin): |
1519 | 1519 |
utils._force_rmtree(rootdir)
|
1520 | 1520 |
|
1521 | 1521 |
with _signals.terminator(cleanup_rootdir), \
|
1522 |
- self.__sandbox(rootdir, output_file, output_file, self.__sandbox_config) as sandbox: # nopep8
|
|
1522 |
+ self.__sandbox(rootdir, output_file, output_file, self.__sandbox_config) as sandbox: # noqa
|
|
1523 | 1523 |
|
1524 | 1524 |
sandbox_vroot = sandbox.get_virtual_directory()
|
1525 | 1525 |
|
... | ... | @@ -127,7 +127,7 @@ class TarSource(DownloadableFileSource): |
127 | 127 |
if not base_dir.endswith(os.sep):
|
128 | 128 |
base_dir = base_dir + os.sep
|
129 | 129 |
|
130 |
- l = len(base_dir)
|
|
130 |
+ L = len(base_dir)
|
|
131 | 131 |
for member in tar.getmembers():
|
132 | 132 |
|
133 | 133 |
# First, ensure that a member never starts with `./`
|
... | ... | @@ -145,9 +145,9 @@ class TarSource(DownloadableFileSource): |
145 | 145 |
# base directory.
|
146 | 146 |
#
|
147 | 147 |
if member.type == tarfile.LNKTYPE:
|
148 |
- member.linkname = member.linkname[l:]
|
|
148 |
+ member.linkname = member.linkname[L:]
|
|
149 | 149 |
|
150 |
- member.path = member.path[l:]
|
|
150 |
+ member.path = member.path[L:]
|
|
151 | 151 |
yield member
|
152 | 152 |
|
153 | 153 |
# We want to iterate over all paths of a tarball, but getmembers()
|
... | ... | @@ -121,13 +121,13 @@ class ZipSource(DownloadableFileSource): |
121 | 121 |
if not base_dir.endswith(os.sep):
|
122 | 122 |
base_dir = base_dir + os.sep
|
123 | 123 |
|
124 |
- l = len(base_dir)
|
|
124 |
+ L = len(base_dir)
|
|
125 | 125 |
for member in archive.infolist():
|
126 | 126 |
if member.filename == base_dir:
|
127 | 127 |
continue
|
128 | 128 |
|
129 | 129 |
if member.filename.startswith(base_dir):
|
130 |
- member.filename = member.filename[l:]
|
|
130 |
+ member.filename = member.filename[L:]
|
|
131 | 131 |
yield member
|
132 | 132 |
|
133 | 133 |
# We want to iterate over all paths of an archive, but namelist()
|
... | ... | @@ -645,6 +645,7 @@ def _pretty_size(size, dec_places=0): |
645 | 645 |
psize /= 1024
|
646 | 646 |
return "{size:g}{unit}".format(size=round(psize, dec_places), unit=unit)
|
647 | 647 |
|
648 |
+ |
|
648 | 649 |
# A sentinel to be used as a default argument for functions that need
|
649 | 650 |
# to distinguish between a kwarg set to None and an unset kwarg.
|
650 | 651 |
_sentinel = object()
|
1 | 1 |
coverage == 4.4.0
|
2 |
-pep8
|
|
2 |
+pycodestyle
|
|
3 | 3 |
pylint == 2.1.1
|
4 | 4 |
pytest >= 3.7
|
5 | 5 |
pytest-cov >= 2.5.0
|
6 | 6 |
pytest-datafiles
|
7 | 7 |
pytest-env
|
8 |
-pytest-pep8
|
|
9 | 8 |
pytest-pylint
|
10 | 9 |
pytest-xdist
|
... | ... | @@ -96,8 +96,8 @@ def _ansi2html_get_styles(palette): |
96 | 96 |
|
97 | 97 |
for g in range(24):
|
98 | 98 |
i = g + 232
|
99 |
- l = g * 10 + 8
|
|
100 |
- indexed_style['%s' % i] = ''.join('%02X' % c if 0 <= c <= 255 else None for c in (l, l, l))
|
|
99 |
+ L = g * 10 + 8
|
|
100 |
+ indexed_style['%s' % i] = ''.join('%02X' % c if 0 <= c <= 255 else None for c in (L, L, L))
|
|
101 | 101 |
|
102 | 102 |
_ANSI2HTML_STYLES[palette] = (regular_style, bold_style, indexed_style)
|
103 | 103 |
return _ANSI2HTML_STYLES[palette]
|
... | ... | @@ -455,6 +455,7 @@ def run_bst(directory, force, source_cache, description, palette): |
455 | 455 |
|
456 | 456 |
return 0
|
457 | 457 |
|
458 |
+ |
|
458 | 459 |
if __name__ == '__main__':
|
459 | 460 |
try:
|
460 | 461 |
run_bst()
|
... | ... | @@ -19,10 +19,10 @@ |
19 | 19 |
#
|
20 | 20 |
import os
|
21 | 21 |
import sys
|
22 |
-sys.path.insert(0, os.path.abspath('..'))
|
|
23 |
- |
|
24 | 22 |
from buildstream import __version__
|
25 | 23 |
|
24 |
+sys.path.insert(0, os.path.abspath('..'))
|
|
25 |
+ |
|
26 | 26 |
# -- General configuration ------------------------------------------------
|
27 | 27 |
|
28 | 28 |
# If your documentation needs a minimal Sphinx version, state it here.
|
... | ... | @@ -112,7 +112,7 @@ add_module_names = False |
112 | 112 |
pygments_style = 'sphinx'
|
113 | 113 |
|
114 | 114 |
# A list of ignored prefixes for module index sorting.
|
115 |
-modindex_common_prefix = [ 'buildstream.' ]
|
|
115 |
+modindex_common_prefix = ['buildstream.']
|
|
116 | 116 |
|
117 | 117 |
# If true, keep warnings as "system message" paragraphs in the built documents.
|
118 | 118 |
# keep_warnings = False
|
... | ... | @@ -11,20 +11,14 @@ parentdir_prefix = BuildStream- |
11 | 11 |
test=pytest
|
12 | 12 |
|
13 | 13 |
[tool:pytest]
|
14 |
-addopts = --verbose --basetemp ./tmp --pep8 --pylint --pylint-rcfile=.pylintrc --cov=buildstream --cov-config .coveragerc --durations=20
|
|
14 |
+addopts = --verbose --basetemp ./tmp --pylint --pylint-rcfile=.pylintrc --cov=buildstream --cov-config .coveragerc --durations=20
|
|
15 | 15 |
norecursedirs = tests/integration/project integration-cache tmp __pycache__ .eggs
|
16 | 16 |
python_files = tests/*/*.py
|
17 |
-pep8maxlinelength = 119
|
|
18 |
-pep8ignore =
|
|
19 |
- * E129
|
|
20 |
- * E125
|
|
21 |
- doc/source/conf.py ALL
|
|
22 |
- tmp/* ALL
|
|
23 |
- */lib/python3* ALL
|
|
24 |
- */bin/* ALL
|
|
25 |
- buildstream/_fuse/fuse.py ALL
|
|
26 |
- .eggs/* ALL
|
|
27 |
- *_pb2.py ALL
|
|
28 |
- *_pb2_grpc.py ALL
|
|
29 | 17 |
env =
|
30 | 18 |
D:BST_TEST_SUITE=True
|
19 |
+ |
|
20 |
+[pycodestyle]
|
|
21 |
+count = False
|
|
22 |
+ignore = E129,E125,W504,W605
|
|
23 |
+exclude = doc/source/conf.py, tmp/*, */lib/python3*, */bin/*, buildstream/_fuse/fuse.py, .eggs/*, *_pb2.py, *_pb2_grpc.py
|
|
24 |
+max-line-length = 119
|
... | ... | @@ -129,6 +129,7 @@ def assert_cache_keys(project_dir, output): |
129 | 129 |
"Use tests/cachekey/update.py to automatically " +
|
130 | 130 |
"update this test case")
|
131 | 131 |
|
132 |
+ |
|
132 | 133 |
##############################################
|
133 | 134 |
# Test Entry Point #
|
134 | 135 |
##############################################
|
... | ... | @@ -65,5 +65,6 @@ def update_keys(): |
65 | 65 |
|
66 | 66 |
write_expected_key(element_name, actual_keys[element_name])
|
67 | 67 |
|
68 |
+ |
|
68 | 69 |
if __name__ == '__main__':
|
69 | 70 |
update_keys()
|
... | ... | @@ -288,6 +288,7 @@ def test_build_checkout_force_tarball(datafiles, cli): |
288 | 288 |
assert os.path.join('.', 'usr', 'bin', 'hello') in tar.getnames()
|
289 | 289 |
assert os.path.join('.', 'usr', 'include', 'pony.h') in tar.getnames()
|
290 | 290 |
|
291 |
+ |
|
291 | 292 |
fetch_build_checkout_combos = \
|
292 | 293 |
[("strict", kind) for kind in ALL_REPO_KINDS] + \
|
293 | 294 |
[("non-strict", kind) for kind in ALL_REPO_KINDS]
|