Skip to content
This repository was archived by the owner on Jan 1, 2026. It is now read-only.

Commit e014415

Browse files
authored
Drop Python 2.7, release 2.0.0 (#10)
1 parent 06c0493 commit e014415

File tree

8 files changed

+22
-42
lines changed

8 files changed

+22
-42
lines changed

.travis.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ language: python
22
dist: xenial
33
matrix:
44
include:
5-
- python: 2.7
6-
env: TOXENV=py27
75
- python: 3.5
86
env: TOXENV=py35
97
- python: 3.6
@@ -12,8 +10,6 @@ matrix:
1210
env: TOXENV=py37
1311
- python: 3.8
1412
env: TOXENV=py38
15-
- python: pypy
16-
env: TOXENV=pypy
1713
- python: pypy3
1814
env: TOXENV=pypy3
1915

README.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ output so that CI tools like Bamboo will not fail on the JUnit task.
5757
Releases
5858
--------
5959

60+
2.0.0 - 2020-03-29
61+
^^^^^^^^^^^^^^^^^^
62+
63+
- Drop Python 2.7
64+
6065
1.7.0 - 2019-12-14
6166
^^^^^^^^^^^^^^^^^^
6267

cppcheck_junit.py

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,21 @@
22

33
"""Converts Cppcheck XML version 2 output to JUnit XML format."""
44

5-
from __future__ import absolute_import, division, print_function, unicode_literals
6-
75
import argparse
86
import collections
97
from datetime import datetime
108
import os
119
from socket import gethostname
1210
import sys
13-
from typing import Dict, List # noqa: F401
11+
from typing import Dict, List
1412
from xml.etree import ElementTree
1513

1614
from exitstatus import ExitStatus
1715

1816

19-
class CppcheckError(object):
20-
def __init__(self,
21-
file, # type: str
22-
line, # type: int
23-
message, # type: str
24-
severity, # type: str
25-
error_id, # type: str
26-
verbose # type: str
27-
):
28-
# type: (...) -> CppcheckError
17+
class CppcheckError:
18+
def __init__(self, file: str, line: int, message: str, severity: str, error_id: str,
19+
verbose: str) -> None:
2920
"""Constructor.
3021
3122
Args:
@@ -44,8 +35,7 @@ def __init__(self,
4435
self.verbose = verbose
4536

4637

47-
def parse_arguments():
48-
# type: () -> argparse.Namespace
38+
def parse_arguments() -> argparse.Namespace:
4939
parser = argparse.ArgumentParser(
5040
description='Converts Cppcheck XML version 2 to JUnit XML format.\n'
5141
'Usage:\n'
@@ -57,8 +47,7 @@ def parse_arguments():
5747
return parser.parse_args()
5848

5949

60-
def parse_cppcheck(file_name):
61-
# type: (str) -> Dict[str, List[CppcheckError]]
50+
def parse_cppcheck(file_name: str) -> Dict[str, List[CppcheckError]]:
6251
"""Parses a Cppcheck XML version 2 file.
6352
6453
Args:
@@ -75,7 +64,7 @@ def parse_cppcheck(file_name):
7564
root = ElementTree.parse(file_name).getroot() # type: ElementTree.Element
7665

7766
if (root.get('version') is None or
78-
int(root.get('version')) != 2):
67+
int(root.get('version')) != 2):
7968
raise ValueError('Parser only supports Cppcheck XML version 2. Use --xml-version=2.')
8069

8170
error_root = root.find('errors')
@@ -101,8 +90,7 @@ def parse_cppcheck(file_name):
10190
return errors
10291

10392

104-
def generate_test_suite(errors):
105-
# type: (Dict[str, List[CppcheckError]]) -> ElementTree.ElementTree
93+
def generate_test_suite(errors: Dict[str, List[CppcheckError]]) -> ElementTree.ElementTree:
10694
"""Converts parsed Cppcheck errors into JUnit XML tree.
10795
10896
Args:
@@ -140,8 +128,7 @@ def generate_test_suite(errors):
140128
return ElementTree.ElementTree(test_suite)
141129

142130

143-
def generate_single_success_test_suite():
144-
# type: () -> ElementTree.ElementTree
131+
def generate_single_success_test_suite() -> ElementTree.ElementTree:
145132
"""Generates a single successful JUnit XML testcase."""
146133
test_suite = ElementTree.Element('testsuite')
147134
test_suite.attrib['name'] = 'Cppcheck errors'
@@ -159,8 +146,7 @@ def generate_single_success_test_suite():
159146
return ElementTree.ElementTree(test_suite)
160147

161148

162-
def main(): # pragma: no cover
163-
# type: () -> ExitStatus
149+
def main() -> ExitStatus: # pragma: no cover
164150
"""Main function.
165151
166152
Returns:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
tox
12
flake8>=3.0.3
23
pep8-naming
34
flake8-quotes

requirements.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
exitstatus>=1.0.0
2-
typing
1+
exitstatus>=1.0.0

setup.cfg

Lines changed: 0 additions & 5 deletions
This file was deleted.

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
setup(
55
name='cppcheck-junit',
6-
version='1.7.0',
6+
version='2.0.0',
77

88
description='Converts Cppcheck XML output to JUnit format.',
99
long_description=open('README.rst').read(),
@@ -15,9 +15,11 @@
1515

1616
py_modules=['cppcheck_junit'],
1717
install_requires=open('requirements.txt').readlines(),
18+
python_requires='>=3.5',
1819
zip_safe=False,
1920

2021
license='MIT',
22+
license_files=['LICENSE.txt'],
2123
classifiers=[
2224
'Development Status :: 5 - Production/Stable',
2325
'Environment :: Console',
@@ -26,8 +28,6 @@
2628
'Operating System :: OS Independent',
2729
'Programming Language :: C++',
2830
'Programming Language :: Python',
29-
'Programming Language :: Python :: 2',
30-
'Programming Language :: Python :: 2.7',
3131
'Programming Language :: Python :: 3',
3232
'Programming Language :: Python :: 3.5',
3333
'Programming Language :: Python :: 3.6',

tox.ini

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
[tox]
2-
# Environment changes have to be manually synced with '.travis.yml'.
32
envlist =
4-
py27
53
py35
64
py36
75
py37
86
py38
9-
pypy
107
pypy3
8+
skip_missing_interpreters = true
119

1210
[flake8]
1311
max-line-length = 99
@@ -20,7 +18,7 @@ exclude =
2018
[testenv]
2119
passenv = CI TRAVIS TRAVIS_*
2220
deps =
23-
-rrequirements-dev.txt
21+
-rdev-requirements.txt
2422
codecov
2523

2624
commands =

0 commit comments

Comments
 (0)