Skip to content

Commit 2d8e0cb

Browse files
committed
Changes for type annotations
1 parent 19824e3 commit 2d8e0cb

18 files changed

Lines changed: 101 additions & 44 deletions

config/travis/runtests.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ then
1919

2020
elif test "${TARGET}" = "pylint";
2121
then
22-
TEST_COMMAND="./config/travis/run_pylint.sh";
22+
TEST_COMMAND="./config/travis/run_checks.sh";
2323
else
2424
TEST_COMMAND="./config/travis/run_python3.sh";
2525
fi
@@ -53,7 +53,7 @@ then
5353

5454
elif test "${TARGET}" = "pylint";
5555
then
56-
TEST_COMMAND="./config/travis/run_pylint.sh";
56+
TEST_COMMAND="./config/travis/run_checks.sh";
5757
else
5858
TEST_COMMAND="./config/travis/run_python3.sh";
5959
fi

data/templates/.travis.yml/jobs_pylint3 renamed to data/templates/.travis.yml/jobs_lint_and_type_check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
- name: "Pylint on Ubuntu Bionic (20.04) (Docker) with Python 3.8"
2-
env: [TARGET="pylint", UBUNTU_VERSION="20.04"]
2+
env: [TARGET="lint_and_type_check", UBUNTU_VERSION="20.04"]
33
group: edge
44
language: python
55
python: 3.8

data/templates/.travis.yml/jobs_linux

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,6 @@
2626
python: 3.8
2727
services:
2828
- docker
29-
- name: "Ubuntu Focal (20.04) (Docker) with Python 3.5 (tox)"
30-
env: [TOXENV="py35", UBUNTU_VERSION="20.04"]
31-
group: edge
32-
language: python
33-
python: 3.5
34-
services:
35-
- docker
3629
- name: "Ubuntu Focal (20.04) (Docker) with Python 3.6 (tox)"
3730
env: [TOXENV="py36", UBUNTU_VERSION="20.04"]
3831
group: edge

data/templates/setup.py/import_module

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version_tuple = (sys.version_info[0], sys.version_info[1])
2-
if version_tuple < (3, 5):
2+
if version_tuple < (3, 6):
33
print((
4-
'Unsupported Python version: {0:s}, version 3.5 or higher '
4+
'Unsupported Python version: {0:s}, version 3.6 or higher '
55
'required.').format(sys.version))
66
sys.exit(1)
77

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ then
3737
else
3838
RPM_PACKAGES="";
3939

40-
if test $${TARGET} = "pylint";
40+
if test $${TARGET} = "lint_and_type_check";
4141
then
42-
RPM_PACKAGES="$${RPM_PACKAGES} findutils pylint";
42+
RPM_PACKAGES="$${RPM_PACKAGES} findutils pylint python3-mypy";
4343
fi
4444
RPM_PACKAGES="$${RPM_PACKAGES} python3 $${RPM_PYTHON3_DEPENDENCIES} $${RPM_PYTHON3_TEST_DEPENDENCIES}";
4545
fi
@@ -87,9 +87,9 @@ then
8787
then
8888
DPKG_PACKAGES="$${DPKG_PACKAGES} sudo";
8989

90-
elif test $${TARGET} = "pylint";
90+
elif test $${TARGET} = "lint_and_type_check";
9191
then
92-
DPKG_PACKAGES="$${DPKG_PACKAGES} python3-distutils pylint";
92+
DPKG_PACKAGES="$${DPKG_PACKAGES} mypy pylint python3-distutils";
9393
fi
9494
if test "$${TARGET}" != "jenkins3";
9595
then

data/templates/run_pylint.sh renamed to data/templates/travis/run_checks-pylint.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
#!/bin/bash
22
#
3-
# Script to run pylint on Travis-CI.
3+
# Script to run lint checks on Travis-CI.
44
#
55
# This file is generated by l2tdevtools update-dependencies.py, any dependency
66
# related changes should be made in dependencies.ini.
77

8-
# Exit on error.
9-
set -e;
8+
EXIT_SUCCESS=0;
9+
EXIT_FAILURE=1;
10+
11+
RESULT=$${EXIT_SUCCESS};
1012

1113
pylint --version
1214

@@ -19,4 +21,11 @@ do
1921
echo "Checking: $${FILE}";
2022

2123
pylint --rcfile=.pylintrc $${FILE};
24+
25+
if test $$? -ne $${EXIT_SUCCESS};
26+
then
27+
RESULT=$${EXIT_FAILURE};
28+
fi
2229
done
30+
31+
exit $${RESULT};
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash
2+
#
3+
# Script to run lint and type checks on Travis-CI.
4+
#
5+
# This file is generated by l2tdevtools update-dependencies.py, any dependency
6+
# related changes should be made in dependencies.ini.
7+
8+
EXIT_SUCCESS=0;
9+
EXIT_FAILURE=1;
10+
11+
RESULT=$${EXIT_SUCCESS};
12+
13+
pylint --version
14+
15+
# Ignore setup.py for now due to:
16+
# setup.py:15:0: E0001: Cannot import 'distutils.command.bdist_msi' due to
17+
# syntax error 'expected an indented block (<unknown>, line 347)' (syntax-error)
18+
19+
for FILE in $$(find ${paths_to_lint} -name \*.py);
20+
do
21+
echo "Checking: $${FILE}";
22+
23+
pylint --rcfile=.pylintrc $${FILE};
24+
25+
if test $$? -ne $${EXIT_SUCCESS};
26+
then
27+
RESULT=$${EXIT_FAILURE};
28+
fi
29+
done
30+
31+
mypy --version
32+
33+
mypy --strict ${project_name};
34+
35+
if test $$? -ne $${EXIT_SUCCESS};
36+
then
37+
RESULT=$${EXIT_FAILURE};
38+
fi
39+
40+
exit $${RESULT};

0 commit comments

Comments
 (0)