Skip to content

Commit 8470097

Browse files
authored
Merge pull request #3725 from JensTimmerman/patch-1
enable code linting check for all supported Python versions
2 parents 032a77d + a2ec58b commit 8470097

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

.github/workflows/linting.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@ on: [push, pull_request]
33
jobs:
44
python-linting:
55
runs-on: ubuntu-18.04
6+
strategy:
7+
matrix:
8+
python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9, '3.10']
9+
610
steps:
711
- uses: actions/checkout@v2
812

913
- name: set up Python
1014
uses: actions/setup-python@v2
1115
with:
12-
python-version: 3.8
16+
python-version: ${{ matrix.python-version }}
1317

1418
- name: install Python packages
1519
run: |
@@ -18,4 +22,10 @@ jobs:
1822
1923
- name: Run flake8 to verify PEP8-compliance of Python code
2024
run: |
21-
flake8
25+
# don't check py2vs3/py3.py when testing with Python 2, and vice versa
26+
if [[ "${{ matrix.python-version }}" =~ "2." ]]; then
27+
py_excl=py3
28+
else
29+
py_excl=py2
30+
fi
31+
flake8 --exclude ./easybuild/tools/py2vs3/${py_excl}.py

easybuild/framework/easyblock.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1485,12 +1485,11 @@ def make_module_req(self):
14851485
if key in keys_requiring_files:
14861486
# only retain paths that contain at least one file
14871487
recursive = keys_requiring_files[key]
1488-
retained_paths = [
1489-
path
1490-
for path, fullpath in ((path, os.path.join(self.installdir, path)) for path in paths)
1491-
if os.path.isdir(fullpath)
1492-
and dir_contains_files(fullpath, recursive=recursive)
1493-
]
1488+
retained_paths = []
1489+
for pth in paths:
1490+
fullpath = os.path.join(self.installdir, pth)
1491+
if os.path.isdir(fullpath) and dir_contains_files(fullpath, recursive=recursive):
1492+
retained_paths.append(pth)
14941493
if retained_paths != paths:
14951494
self.log.info("Only retaining paths for %s that contain at least one file: %s -> %s",
14961495
key, paths, retained_paths)

easybuild/tools/configobj.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2023,7 +2023,7 @@ def write(self, outfile=None, section=None):
20232023
# might need to encode
20242024
# NOTE: This will *screw* UTF16, each line will start with the BOM
20252025
if self.encoding:
2026-
out = [line.encode(self.encoding) for line in out]
2026+
out = [lne.encode(self.encoding) for lne in out]
20272027
if (self.BOM and ((self.encoding is None) or
20282028
(BOM_LIST.get(self.encoding.lower()) == 'utf_8'))):
20292029
# Add the UTF8 BOM

0 commit comments

Comments
 (0)