From 9324752f07462ead50648b124b423a65e7378fe9 Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Aug 14 2018 08:02:06 +0000 Subject: packaging: Python 2/3, RHEL/Fedora fixes - if testsuite is run, don't do %if 0%{?rhel} == 6 (fix testsuite) - if docs are built, don't do %if %fedora (use appropriate sphinx) - use standardized python macros (%py{2,3}_{build,install}) - use a standard idiom %{with python*} - don't override %__python* if not necessary - use %__python when it's useful - drop empty copr-cli-doc package, enforce uninstall - don't 'python -B', that's basically never needed - don't set %_python_bytecompile_extra - drop useless 'exit 0' from copr-dist-git.spec's %post --- diff --git a/backend/copr-backend.spec b/backend/copr-backend.spec index bd9d894..7e8a2ae 100644 --- a/backend/copr-backend.spec +++ b/backend/copr-backend.spec @@ -23,9 +23,6 @@ BuildRequires: util-linux BuildRequires: systemd BuildRequires: redis -%global _python_bytecompile_extra 0 -%global __python %{__python3} - BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-requests @@ -94,21 +91,16 @@ and submit new builds and COPR will create yum repository from latests builds. This package include documentation for COPR code. Mostly useful for developers only. + %prep %setup -q + %build +make -C docs %{?_smp_mflags} html -%if 0%{?fedora} -# build documentation -pushd docs - PYTHONDONTWRITEBYTECODE=1 make %{?_smp_mflags} html - rm build/html/.buildinfo -popd -%endif # ?fedora %install - install -d %{buildroot}%{_sharedstatedir}/copr install -d %{buildroot}%{_sharedstatedir}/copr/jobs install -d %{buildroot}%{_sharedstatedir}/copr/public_html/results @@ -159,9 +151,7 @@ cp -a conf/playbooks %{buildroot}%{_pkgdocdir}/ install -d %{buildroot}%{_pkgdocdir}/examples/%{_sysconfdir}/logstash.d cp -a conf/logstash/copr_backend.conf %{buildroot}%{_pkgdocdir}/examples/%{_sysconfdir}/logstash.d/copr_backend.conf -%if 0%{?fedora} - cp -a docs/build/html %{buildroot}%{_pkgdocdir}/ -%endif +cp -a docs/build/html %{buildroot}%{_pkgdocdir}/ %py_byte_compile %{__python3} %{buildroot}%{_datadir}/copr/backend @@ -217,7 +207,6 @@ useradd -r -g copr -G lighttpd -s /bin/bash -c "COPR user" copr %files doc %license LICENSE %doc -# %{_pkgdocdir}/python-doc %{_pkgdocdir}/ %exclude %{_pkgdocdir}/lighttpd %exclude %{_pkgdocdir}/playbooks diff --git a/cli/copr-cli.spec b/cli/copr-cli.spec index 385f5aa..d3cfc4a 100644 --- a/cli/copr-cli.spec +++ b/cli/copr-cli.spec @@ -1,15 +1,9 @@ -%if 0%{?rhel} > 0 -%if 0%{?rhel} <= 7 -%global _pkgdocdir %{_docdir}/%{name}-%{version} -%endif -%if 0%{?rhel} <= 6 -%global __python2 %{__python} -%endif -%endif - -%if 0%{?fedora} >= 26 || 0%{?rhel} >= 8 -%global use_python3 1 -%global __python %{__python3} +%if 0%{?rhel} > 7 || 0%{?fedora} +%global __python %_bindir/python3 +%global with_python3 1 +%else +%global __python %_bindir/python2 +%global with_python2 1 %endif Name: {{{ git_dir_name }}} @@ -27,131 +21,90 @@ URL: https://pagure.io/copr/copr Source0: {{{ git_dir_pack }}} BuildArch: noarch + +Requires: wget + BuildRequires: asciidoc BuildRequires: libxslt BuildRequires: util-linux -%if 0%{?use_python3} -BuildRequires: python3-devel -BuildRequires: python3-setuptools + +%if %{with python3} +Requires: python3-copr >= 1.63 +Requires: python3-jinja2 +Requires: python3-simplejson + +Recommends: python3-progress + BuildRequires: python3-copr +BuildRequires: python3-devel +BuildRequires: python3-jinja2 BuildRequires: python3-pylint BuildRequires: python3-pytest +BuildRequires: python3-setuptools BuildRequires: python3-simplejson -BuildRequires: python3-jinja2 -Requires: python3-setuptools -Requires: python3-copr >= 1.63 -Requires: python3-simplejson -Requires: python3-jinja2 -Recommends: python3-progress %else -BuildRequires: python2-devel -BuildRequires: python-setuptools -BuildRequires: python-copr -Requires: python-setuptools -Requires: python-copr >= 1.63 -Requires: python-simplejson -Requires: python-jinja2 +Requires: python-copr >= 1.63 +Requires: python-jinja2 +Requires: python-progress +Requires: python-simplejson -%if 0%{?rhel} > 6 BuildRequires: pytest -BuildRequires: python-simplejson +BuildRequires: python-copr +BuildRequires: python-devel BuildRequires: python-jinja2 BuildRequires: python-mock - -Requires: python-progress +BuildRequires: python-setuptools +BuildRequires: python-simplejson %endif -%endif +# We historically shipped empty doc package, uninstall it. +Obsoletes: copr-cli-doc < 1.72 -%if 0%{?rhel} < 7 && 0%{?rhel} > 0 -BuildRequires: python-argparse -%endif +%if 0%{?rhel} == 6 +Requires: python-argparse -%if 0%{?rhel} < 7 && 0%{?rhel} > 0 -Requires: python-argparse +BuildRequires: python-argparse %endif -Requires: wget - %description COPR is lightweight build system. It allows you to create new project in WebUI, and submit new builds and COPR will create yum repository from latests builds. This package contains command line interface. -%if 0%{?fedora} -%package doc -Summary: Code documentation for COPR - -%description doc -COPR is lightweight build system. It allows you to create new project in WebUI, -and submit new builds and COPR will create yum repository from latests builds. - -This package include documentation for COPR code. Mostly useful for developers -only. -%endif - %prep %setup -q %build -%if 0%{?use_python3} -version="%{version}" %{__python3} setup.py build -%else -version="%{version}" %{__python2} setup.py build -%endif - +version="%{version}" %py_build mv copr_cli/README.rst ./ - # convert manages a2x -d manpage -f manpage man/copr-cli.1.asciidoc -%install -install -d %{buildroot}%{_pkgdocdir}/ -%if 0%{?use_python3} -version="%{version}" %{__python3} setup.py install --root %{buildroot} -%else -version="%{version}" %{__python2} setup.py install --root %{buildroot} -%endif +%install +version="%{version}" %py_install ln -sf %{_bindir}/copr-cli %{buildroot}%{_bindir}/copr - install -d %{buildroot}%{_mandir}/man1 install -p -m 644 man/copr-cli.1 %{buildroot}/%{_mandir}/man1/ install -p man/copr.1 %{buildroot}/%{_mandir}/man1/ + %check -%if 0%{?use_python3} -python3-pylint ./copr_cli/*.py || : -%{__python3} -m pytest tests -%else -%if 0%{?rhel} > 6 -# elif because we need: from _pytest.capture import capsys -%{__python2} -m pytest tests -%endif -%endif +%{__python} -m pytest tests + %files %{!?_licensedir:%global license %doc} %license LICENSE %doc README.rst +%{_bindir}/copr %{_bindir}/copr-cli -%if 0%{?use_python3} -%{python3_sitelib}/* -%else -%{python2_sitelib}/* -%endif %{_mandir}/man1/copr-cli.1* %{_mandir}/man1/copr.1* -%{_bindir}/copr - +%{python_sitelib}/* -%if 0%{?fedora} -%files doc -%{!?_licensedir:%global license %doc} -%license LICENSE -%endif %changelog {{{ git_dir_changelog since_tag=copr-cli-1.68-1 }}} diff --git a/cli/tests/test_cli.py b/cli/tests/test_cli.py index e482004..60a5ed5 100644 --- a/cli/tests/test_cli.py +++ b/cli/tests/test_cli.py @@ -3,7 +3,6 @@ import argparse from collections import defaultdict import json from pprint import pprint -from _pytest.capture import capsys import pytest import six @@ -19,6 +18,13 @@ import copr_cli from copr_cli.main import no_config_warning +def exit_wrap(value): + if type(value) == int: + return value + else: + return value.code + + if six.PY3: from unittest import mock from unittest.mock import MagicMock @@ -55,7 +61,7 @@ def test_error_keyboard_interrupt(mock_cc, capsys): with pytest.raises(SystemExit) as err: main.main(argv=["status", "123"]) - assert err.value.code == 1 + assert exit_wrap(err.value) == 1 stdout, stderr = capsys.readouterr() assert "Interrupted by user" in stderr @@ -71,7 +77,7 @@ def test_error_copr_request(mock_cc, capsys): with pytest.raises(SystemExit) as err: main.main(argv=["status", "123"]) - assert err.value.code == 1 + assert exit_wrap(err.value) == 1 stdout, stderr = capsys.readouterr() assert "Something went wrong" in stderr assert error_msg in stderr @@ -91,7 +97,7 @@ def test_error_argument_error(mock_cc, mock_setup_parser, capsys): with pytest.raises(SystemExit) as err: main.main(argv=["status", "123"]) - assert err.value.code == 2 + assert exit_wrap(err.value) == 2 stdout, stderr = capsys.readouterr() assert error_msg in stderr @@ -105,7 +111,7 @@ def test_error_no_args(mock_cc, capsys): with pytest.raises(SystemExit) as err: main.main(argv=[func_name]) - assert err.value.code == 2 + assert exit_wrap(err.value) == 2 stdout, stderr = capsys.readouterr() assert "usage: copr" in stderr @@ -123,7 +129,7 @@ def test_error_copr_common_exception(mock_cc, capsys): with pytest.raises(SystemExit) as err: main.main(argv=["status", "123"]) - assert err.value.code == 3 + assert exit_wrap(err.value) == 3 stdout, stderr = capsys.readouterr() assert error_msg in stderr @@ -140,7 +146,7 @@ def test_error_copr_build_exception(mock_cc, capsys): with pytest.raises(SystemExit) as err: main.main(argv=["build", "prj1", "src1"]) - assert err.value.code == 4 + assert exit_wrap(err.value) == 4 stdout, stderr = capsys.readouterr() assert error_msg in stderr @@ -157,7 +163,7 @@ def test_error_copr_unknown_response(mock_cc, capsys): with pytest.raises(SystemExit) as err: main.main(argv=["status", "123"]) - assert err.value.code == 5 + assert exit_wrap(err.value) == 5 stdout, stderr = capsys.readouterr() assert error_msg in stderr @@ -169,7 +175,7 @@ def test_cancel_build_no_config(mock_cc, capsys): with pytest.raises(SystemExit) as err: main.main(argv=["cancel", "123400"]) - assert err.value.code == 6 + assert exit_wrap(err.value) == 6 out, err = capsys.readouterr() assert "Error: Operation requires api authentication" in err @@ -228,7 +234,7 @@ def test_list_project_no_username(mock_cc, capsys): with pytest.raises(SystemExit) as err: main.main(argv=["list"]) - assert err.value.code == 6 + assert exit_wrap(err.value) == 6 out, err = capsys.readouterr() assert "Pass username to command or create `~/.config/copr`" in err @@ -240,7 +246,7 @@ def test_list_project_no_username2(mock_cc, capsys): with pytest.raises(SystemExit) as err: main.main(argv=["list"]) - assert err.value.code == 6 + assert exit_wrap(err.value) == 6 out, err = capsys.readouterr() assert "Pass username to command or add it to `~/.config/copr`" in err @@ -314,7 +320,7 @@ def test_status_response_no_args(mock_cc, capsys): with pytest.raises(SystemExit) as err: main.main(argv=["status"]) - assert err.value.code == 2 + assert exit_wrap(err.value) == 2 stdout, stderr = capsys.readouterr() assert "usage: copr" in stderr @@ -525,7 +531,7 @@ def test_create_build_wait_error_status(mock_cc, capsys): "build", "copr_name", "http://example.com/pkgs.srpm" ]) - assert err.value.code == 1 + assert exit_wrap(err.value) == 1 stdout, stderr = capsys.readouterr() assert response_message in stdout @@ -554,7 +560,7 @@ def test_create_build_wait_unknown_build_status(mock_cc, capsys): "build", "copr_name", "http://example.com/pkgs.srpm" ]) - assert err.value.code == 1 + assert exit_wrap(err.value) == 1 stdout, stderr = capsys.readouterr() assert response_message in stdout diff --git a/common/python-copr-common.spec b/common/python-copr-common.spec index 9101adf..f4830ad 100644 --- a/common/python-copr-common.spec +++ b/common/python-copr-common.spec @@ -1,20 +1,16 @@ {{{ export srcname=copr-common }}} %global srcname {{{ printf "$srcname" }}} -%if 0%{?rhel} < 7 && 0%{?rhel} > 0 +%if 0%{?rhel} && 0%{?rhel} <= 6 +%{!?_licensedir:%global license %%doc} %global _pkgdocdir %{_docdir}/%{name}-%{version} -%global __python2 %{__python} %endif -%if 0%{?fedora} || 0%{?rhel} >= 8 +%if 0%{?fedora} || 0%{?rhel} > 7 %global with_python3 1 -%else -%global with_python3 0 %endif -%if 0%{?fedora} >= 28 || 0%{?rhel} >= 8 -%global with_python2 0 -%else +%if 0%{?fedora} < 28 || 0%{?rhel} && 0%{?rhel} <= 7 %global with_python2 1 %endif @@ -34,13 +30,15 @@ Source0: {{{ git_dir_pack }}} BuildArch: noarch -%if 0%{?with_python2} +%if %{with python2} BuildRequires: python2-devel -%endif # with_python2 +BuildRequires: python-setuptools +%endif -%if 0%{?with_python3} +%if %{with python3} BuildRequires: python3-devel -%endif # with_python3 +BuildRequires: python3-setuptools +%endif %global _description\ COPR is lightweight build system. It allows you to create new project in WebUI,\ @@ -52,53 +50,60 @@ useful for developers only.\ %description %_description -%if 0%{?with_python2} + +%if %{with python2} %package -n python2-%{srcname} Summary: %{summary} %{?python_provide:%python_provide python2-%{srcname}} %description -n python2-%{srcname} %_description -%endif # with_python2 +%endif + -%if 0%{?with_python3} +%if %{with python3} %package -n python3-%{srcname} Summary: %{summary} %{?python_provide:%python_provide python3-%{srcname}} %description -n python3-%{srcname} %_description -%endif # with_python3 +%endif -%prep -rm -rf *.pyc *.pyo +%prep %setup -q + + %build -%if 0%{?with_python3} -version="%{version}" %py3_build -%endif # with_python3 +%if %{with python3} +version="%version" %py3_build +%endif + +%if %{with python2} +version="%version" %py2_build +%endif -%if 0%{?with_python2} -version="%{version}" %py2_build -%endif # with_python2 %install -%if 0%{?with_python2} -version="%{version}" %py2_install -%endif # with_python2 +%if %{with python3} +version=%version %py3_install +%endif + +%if %{with python2} +version=%version %py2_install +%endif -%if 0%{?with_python3} -version="%{version}" %py3_install -%endif # with_python3 -%if 0%{?with_python3} +%if %{with python3} %files -n python3-%{srcname} %license LICENSE %{python3_sitelib}/* -%endif # with_python3 +%endif + -%if 0%{?with_python2} +%if %{with python2} %files -n python2-%{srcname} %license LICENSE %{python2_sitelib}/* -%endif # with_python2 +%endif + %changelog {{{ git_changelog since_tag="python-$srcname-0.3-1" }}} diff --git a/dist-git/copr-dist-git.spec b/dist-git/copr-dist-git.spec index 0ba88dd..d99debf 100644 --- a/dist-git/copr-dist-git.spec +++ b/dist-git/copr-dist-git.spec @@ -14,9 +14,6 @@ Source0: {{{ git_dir_pack }}} BuildArch: noarch -# switch off byte-compilation in %%{_datadir} -%global _python_bytecompile_extra 0 - BuildRequires: systemd BuildRequires: python3-devel BuildRequires: python3-munch @@ -56,8 +53,6 @@ getent passwd copr-dist-git >/dev/null || \ useradd -r -m -g copr-dist-git -G packager,apache -c "copr-dist-git user" copr-dist-git /usr/bin/passwd -l copr-dist-git >/dev/null -exit 0 - %install install -d %{buildroot}%{_datadir}/copr/dist_git @@ -82,9 +77,10 @@ touch %{buildroot}%{_var}/log/copr-dist-git/main.log %py_byte_compile %{__python3} %{buildroot}%{_datadir}/copr/dist_git -%check -PYTHONPATH=.:$PYTHONPATH python3 -B -m pytest \ +%check +PYTHONPATH=".${PYTHONPATH+:$PYTHONPATH}" \ +python3 -m pytest \ -v --cov-report term-missing --cov ./dist_git ./tests/ %post diff --git a/frontend/copr-frontend.spec b/frontend/copr-frontend.spec index 6068827..6952339 100644 --- a/frontend/copr-frontend.spec +++ b/frontend/copr-frontend.spec @@ -25,7 +25,7 @@ %staticdir/css/style-overwrite.css \ %templatedir/project_info.html \ %templatedir/user_meta.html \ -%templatedir/welcome.html \ +%templatedir/welcome.html \ %templatedir/contact_us.html %global devel_files \ @@ -63,9 +63,6 @@ BuildRequires: epydoc BuildRequires: graphviz %endif -%global _python_bytecompile_extra 0 -%global __python %{__python3} - BuildRequires: python3-devel %if %{with check} @@ -196,11 +193,9 @@ custom %{name}-flavor package. %build -# build documentation %if %{with doc} -pushd documentation -PYTHONDONTWRITEBYTECODE=1 COPR_CONFIG=../../documentation/copr-documentation.conf make %{?_smp_mflags} python -popd +COPR_CONFIG=../../documentation/copr-documentation.conf \ + make -C documentation %{?_smp_mflags} python %endif diff --git a/keygen/copr-keygen.spec b/keygen/copr-keygen.spec index 385dfe5..084c657 100644 --- a/keygen/copr-keygen.spec +++ b/keygen/copr-keygen.spec @@ -1,7 +1,4 @@ %global with_test 1 -%if 0%{?rhel} < 7 && 0%{?rhel} > 0 -%global _pkgdocdir %{_docdir}/%{name}-%{version} -%endif Name: {{{ git_dir_name }}} Version: {{{ git_dir_version lead=1 }}} @@ -21,7 +18,6 @@ BuildArch: noarch BuildRequires: util-linux BuildRequires: systemd -%global _python_bytecompile_extra 0 BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-six @@ -87,23 +83,12 @@ This package contains document for copr-keygen service. %build - -CFLAGS="%{optflags}" %{__python3} setup.py build - -%if 0%{?fedora} -# build documentation -pushd docs -make %{?_smp_mflags} html -rm _build/html/.buildinfo -popd -%endif # ?fedora - +%py3_build +make -C docs %{?_smp_mflags} html %install - -%{__python3} setup.py install --skip-build --root %{buildroot} -find %{buildroot}%{python3_sitelib} -name '*.exe' | xargs rm -f - +%py3_install +find %{buildroot} -name '*.exe' -delete install -d %{buildroot}%{_sysconfdir}/copr-keygen install -d %{buildroot}%{_sysconfdir}/sudoers.d @@ -127,10 +112,7 @@ install -d %{buildroot}%{_sysconfdir}/logrotate.d/ cp -a configs/sudoers/copr_signer %{buildroot}%{_sysconfdir}/sudoers.d/copr_signer -# docs -%if 0%{?fedora} cp -a docs/_build/html %{buildroot}%{_pkgdocdir}/ -%endif %check diff --git a/python/python-copr.spec b/python/python-copr.spec index cda43e8..2b7b318 100644 --- a/python/python-copr.spec +++ b/python/python-copr.spec @@ -1,17 +1,14 @@ -%if 0%{?rhel} < 7 && 0%{?rhel} > 0 +%if 0%{?rhel} && 0%{?rhel} <= 6 +%{!?_licensedir:%global license %%doc} %global _pkgdocdir %{_docdir}/%{name}-%{version} -%global __python2 %{__python} +%global sphinxbuild SPHINXBUILD=%_bindir/sphinx-1.0-build %endif -%if 0%{?fedora} || 0%{?rhel} >= 8 +%if 0%{?fedora} || 0%{?rhel} > 7 %global with_python3 1 -%else -%global with_python3 0 %endif -%if 0%{?fedora} >= 28 || 0%{?rhel} >= 8 -%global with_python2 0 -%else +%if 0%{?fedora} < 28 || 0%{?rhel} && 0%{?rhel} <= 7 %global with_python2 1 %endif @@ -34,8 +31,8 @@ BuildArch: noarch BuildRequires: libxslt BuildRequires: util-linux -%if 0%{?with_python2} -%if 0%{?rhel} < 8 && 0%{?rhel} > 0 +%if %{with python2} +%if 0%{?rhel} && 0%{?rhel} <= 7 BuildRequires: python-setuptools BuildRequires: python-requests BuildRequires: python-requests-toolbelt @@ -47,7 +44,11 @@ BuildRequires: python-configparser BuildRequires: pytest BuildRequires: python2-devel # for doc package +%if 0%{?rhel} && 0%{?rhel} == 6 +BuildRequires: python-sphinx10 +%else BuildRequires: python-sphinx +%endif BuildRequires: python-docutils %else BuildRequires: python2-setuptools @@ -76,7 +77,7 @@ for developers only.\ %description %_description -%if 0%{?with_python2} +%if %{with python2} %package -n python2-copr Summary: %summary @@ -101,9 +102,9 @@ Requires: python2-configparser %{?python_provide:%python_provide python2-copr} %description -n python2-copr %_description -%endif # with_python2 +%endif # with python2 -%if 0%{?with_python3} +%if %{with python3} %package -n python3-copr Summary: Python interface for Copr @@ -137,10 +138,9 @@ and submit new builds and COPR will create yum repository from latest builds. This package contains python interface to access Copr service. Mostly useful for developers only. -%endif # with_python3 +%endif # with python3 -%if 0%{?fedora} %package -n python-copr-doc Summary: Code documentation for python-copr package @@ -151,90 +151,71 @@ and submit new builds and COPR will create yum repository from latest builds. This package includes documentation for python-copr. Mostly useful for developers only. -%endif # ?fedora %prep %setup -q -%if 0%{?with_python3} +%if %{with python3} rm -rf %{py3dir} cp -a . %{py3dir} -%endif # with_python3 +%endif # with python3 %build -%if 0%{?with_python3} -pushd %{py3dir} -CFLAGS="%{optflags}" version="%{version}" %{__python3} setup.py build -popd -%endif # with_python3 +%if %{with python3} +version=%version %py3_build +%endif -%if 0%{?with_python2} -CFLAGS="%{optflags}" version="%{version}" %{__python2} setup.py build -%endif # with_python2 +%if %{with python2} +version=%version %py2_build +%endif mv copr/README.rst ./ -%if 0%{?fedora} # build documentation -pushd docs -make %{?_smp_mflags} html -popd -%endif # ?fedora +make -C docs %{?_smp_mflags} html %{?sphinxbuild} -%install -%if 0%{?with_python3} -pushd %{py3dir} -version="%{version}" %{__python3} setup.py install --skip-build --root %{buildroot} -find %{buildroot}%{python3_sitelib} -name '*.exe' | xargs rm -f -popd -%endif # with_python3 +%install +%if %{with python3} +version=%version %py3_install +%endif -%if 0%{?with_python2} -version="%{version}" %{__python2} setup.py install --skip-build --root %{buildroot} -find %{buildroot}%{python2_sitelib} -name '*.exe' | xargs rm -f -%endif # with_python2 +%if %{with python2} +version=%version %py2_install +%endif -#doc -install -d %{buildroot}%{_pkgdocdir}/ +find %{buildroot} -name '*.exe' -delete -%if 0%{?fedora} +install -d %{buildroot}%{_pkgdocdir} cp -a docs/_build/html %{buildroot}%{_pkgdocdir}/ -%endif %check -%if 0%{?with_python3} -python3-pylint copr/*py copr/client/ copr/client_v2/ || : -pushd %{py3dir} +%if %{with python3} %{__python3} -m pytest copr/test -%endif # with_python3 +%endif -%if 0%{?with_python2} +%if %{with python2} %{__python2} -m pytest copr/test -%endif # with_python2 +%endif -# compatibility for RHEL <= 6 -%{!?_licensedir:%global license %%doc} -%if 0%{?with_python3} +%if %{with python3} %files -n python3-copr %license LICENSE %doc README.rst %{python3_sitelib}/* -%endif # with_python3 +%endif # with python3 -%if 0%{?with_python2} +%if %{with python2} %files -n python2-copr %license LICENSE %doc README.rst %{python2_sitelib}/* -%endif # with_python2 +%endif # with python2 -%if 0%{?fedora} %files -n python-copr-doc %license LICENSE %doc %{_pkgdocdir} -%endif %changelog {{{ git_changelog since_tag=python-copr-1.88-1 }}} diff --git a/rpmbuild/copr-rpmbuild.spec b/rpmbuild/copr-rpmbuild.spec index c8cbdf8..5967872 100644 --- a/rpmbuild/copr-rpmbuild.spec +++ b/rpmbuild/copr-rpmbuild.spec @@ -1,14 +1,12 @@ %if 0%{?fedora} || 0%{?rhel} > 7 +%global __python %__python3 %global python python3 %global python_pfx python3 -%global python_build %py3_build -%global python_install %py3_install %global rpm_python python3-rpm %else +%global __python %__python2 %global python python2 %global python_pfx python -%global python_build %py2_build -%global python_install %py2_install %global rpm_python rpm-python %endif @@ -68,7 +66,7 @@ build build-id 12345 for chroot epel-7-x86_64. PYTHON=%{python} ./run_tests.sh %build -name="%{name}" version="%{version}" summary="%{summary}" %python_build +name="%{name}" version="%{version}" summary="%{summary}" %py_build a2x -d manpage -f manpage man/copr-rpmbuild.1.asciidoc %install @@ -88,7 +86,7 @@ install -d %{buildroot}%{_mandir}/man1 install -p -m 644 man/copr-rpmbuild.1 %{buildroot}/%{_mandir}/man1/ install -p -m 755 bin/copr-sources-custom %buildroot%_bindir -name="%{name}" version="%{version}" summary="%{summary}" %python_install +name="%{name}" version="%{version}" summary="%{summary}" %py_install %files %license LICENSE diff --git a/selinux/copr-selinux.spec b/selinux/copr-selinux.spec index 5428572..21193d9 100644 --- a/selinux/copr-selinux.spec +++ b/selinux/copr-selinux.spec @@ -1,6 +1,5 @@ %if 0%{?rhel} < 7 && 0%{?rhel} > 0 %global _pkgdocdir %{_docdir}/%{name}-%{version} -%global __python2 %{__python} %endif %global moduletype apps