File python-flake8.spec of Package python-flake8

# spec file for package python-flake8
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

%bcond_without python2
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name:           python-flake8
Version:        3.5.0
Release:        0
Summary:        Modular source code checker: pep8, pyflakes and co
License:        MIT
Group:          Development/Languages/Python
#PATCH-FIX-UPSTREAM fix_pycodestyle_240.patch
Patch0:         fix_pycodestyle_240.patch
BuildRequires:  %{python_module devel}
BuildRequires:  %{python_module setuptools}
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
# SECTION test requirements
BuildRequires:  %{python_module mccabe >= 0.2.1}
BuildRequires:  %{python_module mock >= 2.0.0}
BuildRequires:  %{python_module pycodestyle >= 2.0.0}
BuildRequires:  %{python_module pyflakes >= 1.5.0}
BuildRequires:  %{python_module pytest-runner}
BuildRequires:  %{python_module pytest}
%if %{with python2}
BuildRequires:  python2-configparser
BuildRequires:  python2-enum34
Requires:       python-mccabe >= 0.6.0
Requires:       python-pycodestyle >= 2.0.0
Requires:       python-pyflakes >= 1.5.0
Requires:       python-configparser
Requires:       python-enum34
Requires(post): update-alternatives
Requires(postun): update-alternatives
BuildArch:      noarch

Flake8 is a wrapper around these tools:

- PyFlakes
- pep8
- Ned Batchelder's McCabe script

Flake8 runs all the tools by launching the single ``flake8`` script.

%setup -q -n flake8-%{version}
%patch0 -p1


%python_clone -a %{buildroot}%{_bindir}/flake8
%fdupes %{buildroot}%{_prefix}

%python_install_alternative flake8

%python_uninstall_alternative flake8

%python_exec test

%files %{python_files}
%doc README.rst
%license LICENSE
%python_alternative %{_bindir}/flake8