diff --git a/python-osrf-pycommon-0.1.2-flake8.patch b/python-osrf-pycommon-0.1.2-flake8.patch new file mode 100644 index 0000000..4ed7deb --- /dev/null +++ b/python-osrf-pycommon-0.1.2-flake8.patch @@ -0,0 +1,49 @@ +From a317efbb9e28f72881b81a9bf782be30f2cc7fbb Mon Sep 17 00:00:00 2001 +From: William Woodall +Date: Thu, 28 Jul 2016 15:17:00 -0700 +Subject: [PATCH] call flake8's command line for more portability between + flake8 versions (#26) + +--- + tests/test_code_format.py | 25 ++++++++++++------------- + 1 file changed, 12 insertions(+), 13 deletions(-) + +diff --git a/tests/test_code_format.py b/tests/test_code_format.py +index 06d7c82..31b0a89 100644 +--- a/tests/test_code_format.py ++++ b/tests/test_code_format.py +@@ -1,19 +1,21 @@ +-import flake8.engine + import os ++import sys ++import subprocess + + + def test_flake8(): + """Test source code for pyFlakes and PEP8 conformance""" +- flake8style = flake8.engine.StyleGuide() +- report = flake8style.options.report +- report.start() + this_dir = os.path.dirname(os.path.abspath(__file__)) +- try: +- input_dir = flake8style.input_dir +- except AttributeError: +- input_dir = flake8style._styleguide.input_dir +- input_dir(os.path.join(this_dir, '..', 'osrf_pycommon')) +- report.stop() +- assert report.total_errors == 0, \ +- ("Found '{0}' code style errors (and warnings)." +- .format(report.total_errors)) ++ source_dir = os.path.join(this_dir, '..', 'osrf_pycommon') ++ if sys.version_info >= (3,0): ++ cmd = ['python3-flake8', source_dir, '--count'] ++ else: ++ cmd = ['flake8', source_dir, '--count'] ++ if sys.version_info < (3,4): ++ # Unless Python3, skip files with new syntax, like `yield from` ++ cmd.append('--exclude=../*async_execute_process_asyncio/impl.py') ++ p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) ++ stdout, stderr = p.communicate() ++ print(stdout) ++ assert p.returncode == 0, \ ++ "Command '{0}' returned non-zero exit code '{1}'".format(' '.join(cmd), p.returncode) diff --git a/python-osrf-pycommon.spec b/python-osrf-pycommon.spec index be2b0d3..342ff69 100644 --- a/python-osrf-pycommon.spec +++ b/python-osrf-pycommon.spec @@ -15,6 +15,10 @@ Source0: https://github.com/osrf/%{srcname}/archive/%{version}.tar.gz#/%{ BuildArch: noarch +# https://github.com/osrf/osrf_pycommon/commit/a317efbb9e28f72881b81a9bf782be30f2cc7fbb +# Modified to fix the exclude path, and run python3-flake8 if python 3 is being used +Patch0: %{name}-0.1.2-flake8.patch + %description osrf_pycommon is a python package which contains commonly used Python boilerplate code and patterns. Things like ANSI terminal coloring, capturing @@ -79,7 +83,7 @@ part of the standard Python library. Where possible Windows and Linux/OS X should be supported, and where it cannot it should be gracefully degrading. %prep -%autosetup -n %{srcname}-%{version} +%autosetup -n %{srcname}-%{version} -p 1 %build %py2_build @@ -118,6 +122,10 @@ PYTHONASYNCIODEBUG=1 nosetests-%{python3_version} -w tests %{python3_sitelib}/%{srcname}-%{version}-py?.?.egg-info/ %changelog +* Wed Dec 21 2016 Rich Mattes - 0.1.2-3 +- Fix FTBFS by adding upstream patch to use flake8 command line (rhbz#1377139) +- Use 'python3-flake8' for python 3 tests + * Mon Dec 19 2016 Miro HronĨok - 0.1.2-3 - Rebuild for Python 3.6