%global module_name pycodestyle %if 0%{?fedora} >= 32 || 0%{?rhel} >= 9 %bcond_with python2 %else %bcond_without python2 %endif Name: python-%{module_name} # WARNING: When updating pycodestyle, check not to break flake8! Version: 2.10.0 Release: %autorelease Summary: Python style guide checker License: MIT URL: https://pypi.python.org/pypi/%{module_name} Source0: %{pypi_source %{module_name}} # Various fixes for Python 3.12 # https://github.com/PyCQA/pycodestyle/pull/1148 # https://github.com/PyCQA/pycodestyle/commit/84937582b81d570b95354e33a746947f84462c55 Patch0: 0001-add-fix-for-muting-FSTRING_MIDDLE-in-3.12.patch # https://github.com/PyCQA/pycodestyle/pull/1129 # https://github.com/PyCQA/pycodestyle/commit/7023956c8975d34317aa146b8e3d73ebd43d204c # Necessary precursor to make Patch2 apply cleanly # Rediffed - dropped the changes to unpackaged files Patch1: 0001-drop-python3.6.patch # https://github.com/PyCQA/pycodestyle/pull/1152 # https://github.com/PyCQA/pycodestyle/commit/e8d84098da10d013ee686027e174814dbe4dd908 # Rediffed - dropped the changes to unpackaged github file Patch2: 0001-get-testsuite-passing-on-3.12.patch # https://github.com/PyCQA/pycodestyle/pull/1153 # https://github.com/PyCQA/pycodestyle/commit/0d786b43a09243d7655831d0b6c4a94a8d7c7581 Patch3: 0001-add-test-file-for-new-3.12-syntax.patch # https://github.com/PyCQA/pycodestyle/pull/1154 # https://github.com/PyCQA/pycodestyle/commit/6fddf7399d70627c46d1cc82bb3c02da2d708ec4 Patch4: 0001-3.12-format-specs-are-not-an-error.patch BuildArch: noarch %description pycodestyle is a tool to check your Python code against some of the style conventions in PEP 8. It has a plugin architecture, making new checks easy, and its output is parseable, making it easy to jump to an error location in your editor. %if %{with python2} %package -n python2-%{module_name} Summary: Python style guide checker %{?python_provide:%python_provide python2-%{module_name}} BuildRequires: python2-devel BuildRequires: python2-setuptools Requires: python2-setuptools %description -n python2-%{module_name} pycodestyle is a tool to check your Python code against some of the style conventions in PEP 8. It has a plugin architecture, making new checks easy, and its output is parseable, making it easy to jump to an error location in your editor. %endif %package -n python%{python3_pkgversion}-pycodestyle Summary: Python style guide checker %{?python_provide:%python_provide python%{python3_pkgversion}-%{module_name}} Conflicts: python-pycodestyle < %{version}-%{release} BuildRequires: python%{python3_pkgversion}-devel BuildRequires: python%{python3_pkgversion}-setuptools BuildRequires: python%{python3_pkgversion}-sphinx BuildRequires: python%{python3_pkgversion}-sphinx_rtd_theme BuildRequires: make %description -n python%{python3_pkgversion}-pycodestyle pycodestyle is a tool to check your Python code against some of the style conventions in PEP 8. It has a plugin architecture, making new checks easy, and its output is parseable, making it easy to jump to an error location in your editor. This is a version for Python %{python3_pkgversion}. %prep %autosetup -n %{module_name}-%{version} -p1 # Remove #! from pycodestyle.py sed --in-place "s:#!\s*/usr.*::" pycodestyle.py %build %if %{with python2} %py2_build %endif %py3_build make -C docs man SPHINXBUILD=sphinx-build-%{python3_version} %install %if %{with python2} %py2_install mv %{buildroot}%{_bindir}/pycodestyle %{buildroot}%{_bindir}/pycodestyle-%{python2_version} ln -s ./pycodestyle-%{python2_version} %{buildroot}%{_bindir}/pycodestyle-2 %endif %py3_install mv %{buildroot}%{_bindir}/pycodestyle %{buildroot}%{_bindir}/pycodestyle-%{python3_version} ln -s ./pycodestyle-%{python3_version} %{buildroot}%{_bindir}/pycodestyle-3 ln -s ./pycodestyle-3 %{buildroot}%{_bindir}/pycodestyle install -D docs/_build/man/%{module_name}.1 %{buildroot}%{_mandir}/man1/%{module_name}.1 %check %if %{with python2} %{__python2} pycodestyle.py --max-doc-length=72 --testsuite testsuite %{__python2} pycodestyle.py --max-doc-length=72 --doctest %endif %{__python3} pycodestyle.py --max-doc-length=72 --testsuite testsuite %{__python3} pycodestyle.py --max-doc-length=72 --doctest %if %{with python2} %files -n python2-%{module_name} %doc CHANGES.txt README.rst %license LICENSE %{_bindir}/pycodestyle-2 %{_bindir}/pycodestyle-2.7 %{python2_sitelib}/%{module_name}.py* %{python2_sitelib}/%{module_name}-%{version}-*.egg-info %endif %files -n python%{python3_pkgversion}-pycodestyle %doc README.rst CHANGES.txt %license LICENSE %{_mandir}/man1/%{module_name}.1.gz %{_bindir}/pycodestyle %{_bindir}/pycodestyle-3 %{_bindir}/pycodestyle-%{python3_version} %pycached %{python3_sitelib}/%{module_name}.py %{python3_sitelib}/%{module_name}-%{version}-*.egg-info/ %changelog %autochangelog