File python-pycodestyle.spec of Package python-pycodestyle.38238

#
# spec file for package python-pycodestyle
#
# Copyright (c) 2019 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 https://bugs.opensuse.org/
#


%{?sle15allpythons}
%define oldpython python
Name:           python-pycodestyle
Version:        2.5.0
Release:        0
Summary:        Python style guide checker
License:        MIT
Group:          Development/Languages/Python
Url:            https://pycodestyle.readthedocs.io/
Source:         https://files.pythonhosted.org/packages/source/p/pycodestyle/pycodestyle-%{version}.tar.gz
# PATCH-FIX-UPSTREAM fix-test_check_nullbytes.patch gh#PyCQA/pycodestyle#1151 mcepl@suse.com
# test_check_nullbytes is rather volatile, make it passing even for us
Patch0:         fix-test_check_nullbytes.patch
BuildRequires:  %{python_module setuptools}
BuildRequires:  %{python_module pip}
BuildRequires:  %{python_module wheel}
BuildRequires:  python-rpm-macros
BuildArch:      noarch
%ifpython2
Provides:       %{oldpython}-pep8 = %{version}
Obsoletes:      %{oldpython}-pep8 < %{version}
%endif
Provides:       python-pep8 = %{version}
Obsoletes:      python-pep8 < %{version}
Requires(post): update-alternatives
Requires(postun): update-alternatives
%python_subpackages

%description
pycodestyle is a tool to check your Python code against some of the style
conventions in `PEP 8`.

This package used to be called ``pep8`` but was renamed to ``pycodestyle``
to reduce confusion.

%prep
%autosetup -p1 -n pycodestyle-%{version}
sed -ri '1s/^#!.*//' pycodestyle.py

%build
%pyproject_wheel

%install
%pyproject_install
%python_clone %{buildroot}%{_bindir}/pycodestyle
%python_clone -a %{buildroot}%{_bindir}/pycodestyle

%post
%python_install_alternative pycodestyle

%postun
%python_uninstall_alternative pycodestyle

%check
%pyunittest discover -v testsuite

%files %{python_files}
%license LICENSE
%doc README.rst
%python_alternative %{_bindir}/pycodestyle
%{python_sitelib}/pycodestyle.py*
%pycache_only %{python_sitelib}/__pycache__/pycodestyle.*.py*
%{python_sitelib}/pycodestyle-%{version}*-info

%changelog
openSUSE Build Service is sponsored by