summaryrefslogtreecommitdiff
path: root/dev-python/parse_cmake/files
diff options
context:
space:
mode:
authorAndreas Sturmlechner <asturm@gentoo.org>2019-09-14 17:37:40 +0200
committerAndreas Sturmlechner <asturm@gentoo.org>2019-09-14 17:37:40 +0200
commit2a108e673d95c095fd5be61183050fd1d245f349 (patch)
treedae40125ffa53f80c55ec2bf0a7a7a7288553228 /dev-python/parse_cmake/files
parent44267b6fc151a3a6afd296ba1da5a8a1bd783b3c (diff)
downloadkde-2a108e673d95c095fd5be61183050fd1d245f349.tar.gz
kde-2a108e673d95c095fd5be61183050fd1d245f349.tar.bz2
kde-2a108e673d95c095fd5be61183050fd1d245f349.zip
dev-python/parse_cmake: Add upstream python3 fix
Package-Manager: Portage-2.3.76, Repoman-2.3.17 Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
Diffstat (limited to 'dev-python/parse_cmake/files')
-rw-r--r--dev-python/parse_cmake/files/parse_cmake-0.4.1-python3-fix.patch110
1 files changed, 110 insertions, 0 deletions
diff --git a/dev-python/parse_cmake/files/parse_cmake-0.4.1-python3-fix.patch b/dev-python/parse_cmake/files/parse_cmake-0.4.1-python3-fix.patch
new file mode 100644
index 00000000000..c9e6d8859c0
--- /dev/null
+++ b/dev-python/parse_cmake/files/parse_cmake-0.4.1-python3-fix.patch
@@ -0,0 +1,110 @@
+From 51daaefdfd68ee805bc5380f68ae88a32ef72a72 Mon Sep 17 00:00:00 2001
+From: Jeff Quast <contact@jeffquast.com>
+Date: Thu, 22 Mar 2018 17:46:26 -0700
+Subject: [PATCH] Bugfix python3 entry point for cmake_pprint (#2)
+
+* Update cmake_pprint.py
+
+* pprint doesn't make a difference
+
+* update flake8 test from rosdep repository
+
+* py2.7 fix
+
+* ignore some rules
+---
+ parse_cmake/cmake_pprint.py | 4 +--
+ tests/test_code_format.py | 57 ++++++++++++++++++++++++++++++-------
+ 2 files changed, 48 insertions(+), 13 deletions(-)
+
+diff --git a/parse_cmake/cmake_pprint.py b/parse_cmake/cmake_pprint.py
+index 18e4e9e..d6865ef 100644
+--- a/parse_cmake/cmake_pprint.py
++++ b/parse_cmake/cmake_pprint.py
+@@ -18,7 +18,7 @@
+ import argparse
+ import sys
+
+-import parsing as cmp
++from .parsing import parse
+
+
+ def main():
+@@ -40,7 +40,7 @@ def main():
+ for (name, file) in files:
+ with file:
+ input = file.read()
+- tree = cmp.parse(input, path=name)
++ tree = parse(input, path=name)
+ if args.tree:
+ # Print out AST
+ print(repr(tree))
+diff --git a/tests/test_code_format.py b/tests/test_code_format.py
+index 287e6e1..9ab09e2 100644
+--- a/tests/test_code_format.py
++++ b/tests/test_code_format.py
+@@ -12,18 +12,53 @@
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+
+-import flake8.engine
++from __future__ import print_function
++
+ import os
++import sys
++
++# flake8 doesn't support Python < 2.7 anymore
++if sys.version_info[0] > 2 or sys.version_info[1] >= 7:
++ from flake8.api.legacy import get_style_guide
++else:
++ get_style_guide = None
+
+
+ def test_flake8():
+- """Test source code for pyFlakes and PEP8 conformance"""
+- flake8style = flake8.engine.StyleGuide(max_line_length=100)
+- report = flake8style.options.report
+- report.start()
+- this_dir = os.path.dirname(os.path.abspath(__file__))
+- flake8style.input_dir(os.path.join(this_dir, '..', 'parse_cmake'))
+- report.stop()
+- assert report.total_errors == 0, \
+- ("Found '{0}' code style errors (and warnings)."
+- .format(report.total_errors))
++ if get_style_guide is None:
++ # skip test on Python 2.6 and older
++ return
++
++ style_guide = get_style_guide(
++ exclude=[],
++ ignore=[
++ 'E731', # ignore assign lambda warning
++ 'E226', # ignore whitespace around arithmetic operators
++ 'E305', # ignore whitespace before/after functions rule
++ 'D', # ignore documentation related warnings
++ 'I', # ignore import order related warnings
++ 'N802', # ignore presence of upper case in function names
++ ],
++ max_line_length=100,
++ max_complexity=10,
++ show_source=True,
++ )
++
++ stdout = sys.stdout
++ sys.stdout = sys.stderr
++ # implicitly calls report_errors()
++ report = style_guide.check_files([
++ os.path.dirname(os.path.dirname(__file__)),
++ ])
++ sys.stdout = stdout
++
++ if report.total_errors:
++ # output summary with per-category counts
++ print()
++ report._application.formatter.show_statistics(report._stats)
++ print(
++ 'flake8 reported {report.total_errors} errors'
++ .format_map(locals()), file=sys.stderr)
++
++ assert not report.total_errors, \
++ 'flake8 reported {report.total_errors} errors'.format(**locals())