Skip to content

Commit daa7b6b

Browse files
committed
Drop support for pep8 package
It is outdated for many years now and has been replaced by pycodestyle. Stop using it.
1 parent c4f66c0 commit daa7b6b

File tree

5 files changed

+21
-48
lines changed

5 files changed

+21
-48
lines changed

easybuild/framework/easyconfig/style.py

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
* Ward Poelmans (Ghent University)
3232
"""
3333
import re
34-
import sys
3534
from importlib import reload
3635

3736
from easybuild.base import fancylogger
@@ -43,12 +42,7 @@
4342
import pycodestyle
4443
from pycodestyle import StyleGuide, register_check, trailing_whitespace
4544
except ImportError:
46-
try:
47-
# fallback to importing from 'pep8', which was renamed to pycodestyle in 2016
48-
import pep8
49-
from pep8 import StyleGuide, register_check, trailing_whitespace
50-
except ImportError:
51-
pass
45+
pass
5246

5347
_log = fancylogger.getLogger('easyconfig.style', fname=False)
5448

@@ -106,20 +100,15 @@ def _eb_check_trailing_whitespace(physical_line, lines, line_number, checker_sta
106100
return result
107101

108102

109-
@only_if_module_is_available(('pycodestyle', 'pep8'))
103+
@only_if_module_is_available('pycodestyle')
110104
def check_easyconfigs_style(easyconfigs, verbose=False):
111105
"""
112106
Check the given list of easyconfigs for style
113107
:param easyconfigs: list of file paths to easyconfigs
114108
:param verbose: print our statistics and be verbose about the errors and warning
115109
:return: the number of warnings and errors
116110
"""
117-
# importing autopep8 changes some pep8 functions.
118-
# We reload it to be sure to get the real pep8 functions.
119-
if 'pycodestyle' in sys.modules:
120-
reload(pycodestyle)
121-
else:
122-
reload(pep8)
111+
reload(pycodestyle)
123112

124113
# register the extra checks before using pep8:
125114
# any function in this module starting with `_eb_check_` will be used.

easybuild/tools/systemtools.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@
202202
'graphviz-python': ('gv', "rendering dependency graph with Graphviz: --dep-graph"),
203203
'keyring': (None, "storing GitHub token"),
204204
'pbs-python': ('pbs', "using Torque as --job backend"),
205-
'pep8': (None, "fallback for code style checking: --check-style, --check-contrib"),
206205
'pycodestyle': (None, "code style checking: --check-style, --check-contrib"),
207206
'pysvn': (None, "using SVN repository as easyconfigs archive"),
208207
'python-graph-core': ('pygraph.classes.digraph', "creating dependency graph: --dep-graph"),

test/framework/easyconfig.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,7 @@
8585
try:
8686
import pycodestyle # noqa
8787
except ImportError:
88-
try:
89-
import pep8 # noqa
90-
except ImportError:
91-
pass
92-
88+
pass
9389

9490
EXPECTED_DOTTXT_TOY_DEPS = """digraph graphname {
9591
toy;
@@ -2660,8 +2656,8 @@ def test_dump_autopep8(self):
26602656
def test_dump_extra(self):
26612657
"""Test EasyConfig's dump() method for files containing extra values"""
26622658

2663-
if not ('pycodestyle' in sys.modules or 'pep8' in sys.modules):
2664-
print("Skipping test_dump_extra (no pycodestyle or pep8 available)")
2659+
if 'pycodestyle' not in sys.modules:
2660+
print("Skipping test_dump_extra pycodestyle is not available")
26652661
return
26662662

26672663
rawtxt = '\n'.join([
@@ -2703,8 +2699,8 @@ def test_dump_extra(self):
27032699
def test_dump_template(self):
27042700
""" Test EasyConfig's dump() method for files containing templates"""
27052701

2706-
if not ('pycodestyle' in sys.modules or 'pep8' in sys.modules):
2707-
print("Skipping test_dump_template (no pycodestyle or pep8 available)")
2702+
if 'pycodestyle' not in sys.modules:
2703+
print("Skipping test_dump_template pycodestyle is not available")
27082704
return
27092705

27102706
rawtxt = '\n'.join([
@@ -2792,8 +2788,8 @@ def test_dump_template(self):
27922788
def test_dump_comments(self):
27932789
""" Test dump() method for files containing comments """
27942790

2795-
if not ('pycodestyle' in sys.modules or 'pep8' in sys.modules):
2796-
print("Skipping test_dump_comments (no pycodestyle or pep8 available)")
2791+
if 'pycodestyle' not in sys.modules:
2792+
print("Skipping test_dump_comments pycodestyle is not available")
27972793
return
27982794

27992795
rawtxt = '\n'.join([

test/framework/options.py

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,7 @@
7272
try:
7373
import pycodestyle # noqa
7474
except ImportError:
75-
try:
76-
import pep8 # noqa
77-
except ImportError:
78-
pass
75+
pass
7976

8077

8178
EXTERNAL_MODULES_METADATA = """[foobar/1.2.3]
@@ -5893,14 +5890,9 @@ def test_parse_optarch(self):
58935890

58945891
def test_check_contrib_style(self):
58955892
"""Test style checks performed by --check-contrib + dedicated --check-style option."""
5896-
try:
5897-
import pycodestyle # noqa
5898-
except ImportError:
5899-
try:
5900-
import pep8 # noqa
5901-
except ImportError:
5902-
print("Skipping test_check_contrib_style, since pycodestyle or pep8 is not available")
5903-
return
5893+
if 'pycodestyle' not in sys.modules:
5894+
print("Skipping test_check_contrib_style pycodestyle is not available")
5895+
return
59045896

59055897
regex = re.compile(r"Running style check on 2 easyconfig\(s\)(.|\n)*>> All style checks PASSed!", re.M)
59065898
args = [
@@ -5953,8 +5945,8 @@ def test_check_contrib_style(self):
59535945
def test_check_contrib_non_style(self):
59545946
"""Test non-style checks performed by --check-contrib."""
59555947

5956-
if not ('pycodestyle' in sys.modules or 'pep8' in sys.modules):
5957-
print("Skipping test_check_contrib_non_style (no pycodestyle or pep8 available)")
5948+
if 'pycodestyle' not in sys.modules:
5949+
print("Skipping test_check_contrib_non_style pycodestyle is not available")
59585950
return
59595951

59605952
args = [

test/framework/style.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,16 @@
4040
try:
4141
import pycodestyle # noqa
4242
except ImportError:
43-
try:
44-
import pep8 # noqa
45-
except ImportError:
46-
pass
43+
pass
4744

4845

4946
class StyleTest(EnhancedTestCase):
5047
log = fancylogger.getLogger("StyleTest", fname=False)
5148

5249
def test_style_conformance(self):
5350
"""Check the easyconfigs for style"""
54-
if not ('pycodestyle' in sys.modules or 'pep8' in sys.modules):
55-
print("Skipping style checks (no pycodestyle or pep8 available)")
51+
if 'pycodestyle' not in sys.modules:
52+
print("Skipping test_style_conformance pycodestyle is not available")
5653
return
5754

5855
# all available easyconfig files
@@ -66,8 +63,8 @@ def test_style_conformance(self):
6663

6764
def test_check_trailing_whitespace(self):
6865
"""Test for trailing whitespace check."""
69-
if not ('pycodestyle' in sys.modules or 'pep8' in sys.modules):
70-
print("Skipping trailing whitespace checks (no pycodestyle or pep8 available)")
66+
if 'pycodestyle' not in sys.modules:
67+
print("Skipping test_check_trailing_whitespace is not available")
7168
return
7269

7370
lines = [

0 commit comments

Comments
 (0)