public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Andreas Sturmlechner" <asturm@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/kde:master commit in: dev-python/parse_cmake/files/, dev-python/parse_cmake/
Date: Sat, 14 Sep 2019 15:50:34 +0000 (UTC)	[thread overview]
Message-ID: <1568475460.2a108e673d95c095fd5be61183050fd1d245f349.asturm@gentoo> (raw)

commit:     2a108e673d95c095fd5be61183050fd1d245f349
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 14 15:37:40 2019 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Sat Sep 14 15:37:40 2019 +0000
URL:        https://gitweb.gentoo.org/proj/kde.git/commit/?id=2a108e67

dev-python/parse_cmake: Add upstream python3 fix

Package-Manager: Portage-2.3.76, Repoman-2.3.17
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 .../files/parse_cmake-0.4.1-python3-fix.patch      | 110 +++++++++++++++++++++
 dev-python/parse_cmake/parse_cmake-0.4.1-r1.ebuild |  26 +++++
 2 files changed, 136 insertions(+)

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 0000000000..c9e6d8859c
--- /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())

diff --git a/dev-python/parse_cmake/parse_cmake-0.4.1-r1.ebuild b/dev-python/parse_cmake/parse_cmake-0.4.1-r1.ebuild
new file mode 100644
index 0000000000..cc2187f798
--- /dev/null
+++ b/dev-python/parse_cmake/parse_cmake-0.4.1-r1.ebuild
@@ -0,0 +1,26 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python2_7 python3_{6,7} )
+inherit distutils-r1
+
+DESCRIPTION="Parser for CMakeLists.txt files"
+HOMEPAGE="https://pypi.python.org/pypi/parse_cmake/"
+SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE=""
+
+BDEPEND="dev-python/setuptools[${PYTHON_USEDEP}]"
+
+PATCHES=( "${FILESDIR}/${P}-python3-fix.patch" )
+
+src_prepare() {
+	distutils-r1_src_prepare
+	sed -i setup.py -e "s/'pyPEG2'//" || die
+	mv tests tests-hidden || die
+}


             reply	other threads:[~2019-09-14 15:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-14 15:50 Andreas Sturmlechner [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-12-18 11:07 [gentoo-commits] proj/kde:master commit in: dev-python/parse_cmake/files/, dev-python/parse_cmake/ Andreas Sturmlechner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1568475460.2a108e673d95c095fd5be61183050fd1d245f349.asturm@gentoo \
    --to=asturm@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox