File python-pyformat.spec of Package python-pyformat
#
# spec file for package python-pyformat
#
# 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 http://bugs.opensuse.org/
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%bcond_without test
Name: python-pyformat
Version: 0.7
Release: 0
License: MIT
Summary: Formats Python code to follow a consistent style
Url: https://github.com/myint/pyformat
Group: Development/Languages/Python
Source: https://files.pythonhosted.org/packages/source/p/pyformat/pyformat-%{version}.tar.gz
BuildRequires: %{python_module devel}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
%if %{with test}
BuildRequires: %{python_module autoflake >= 0.6.6}
BuildRequires: %{python_module autopep8 >= 1.2.2}
BuildRequires: %{python_module docformatter >= 0.7}
BuildRequires: %{python_module unify >= 0.2}
%endif
Requires: python-autoflake >= 0.6.6
Requires: python-autopep8 >= 1.2.2
Requires: python-docformatter >= 0.7
Requires: python-unify >= 0.2
BuildArch: noarch
Requires(post): update-alternatives
Requires(postun): update-alternatives
%python_subpackages
%description
Pyformat formats Python code to follow a consistent style.
Features include:
- Formats code to follow the PEP 8 style guide (using autopep8).
- Removes unused imports (using autoflake).
- Formats docstrings to follow PEP 257 (using docformatter).
- Makes strings all use the same type of quote where possible (using unify).
%prep
%setup -q -n pyformat-%{version}
sed -i -e '/^#!\//, 1d' pyformat.py
%build
%python_build
%install
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%python_clone -a %{buildroot}%{_bindir}/pyformat
%post
%python_install_alternative pyformat
%postun
%python_uninstall_alternative pyformat
%if %{with test}
%check
%python_exec setup.py test
%endif
%files %{python_files}
%defattr(-,root,root,-)
%doc AUTHORS.rst README.rst
%python_alternative %{_bindir}/pyformat
%{python_sitelib}/*
%changelog