diff --git a/clufter.spec b/clufter.spec index ff2eecd..be1e8f7 100644 --- a/clufter.spec +++ b/clufter.spec @@ -3,9 +3,12 @@ # clufter-lib -> python.+-clufter (any if multiple) # python-clufter -> python2-clufter (subject of change) +# conditionals: +%bcond_with python2 + Name: clufter Version: 0.77.1 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Tool/library for transforming/analyzing cluster configuration formats License: GPLv2+ URL: https://pagure.io/%{name} @@ -13,10 +16,12 @@ URL: https://pagure.io/%{name} # required for autosetup macro BuildRequires: git +%if %{with python2} # Python 2 related BuildRequires: python2-devel BuildRequires: python2-setuptools BuildRequires: python2-lxml +%endif # Python 3 related BuildRequires: python3-devel @@ -71,6 +76,7 @@ framework (capable of XSLT) offers also other uses through its plugin library. This package contains %{name} command-line interface for the underlying library (packaged as python3-%{name}). +%if %{with python2} %package -n python2-%{name} Summary: Library for transforming/analyzing cluster configuration formats License: GPLv2+ and GFDL @@ -87,6 +93,7 @@ stacks configuration conversion (as per RHEL trend), the command-filter-format framework (capable of XSLT) offers also other uses through its plugin library. This package contains %{name} library including built-in plugins. +%endif %package -n python3-%{name} Summary: Library for transforming/analyzing cluster configuration formats @@ -94,6 +101,10 @@ License: GPLv2+ and GFDL Provides: %{name}-lib = %{version}-%{release} %{?python_provide:%python_provide python3-%{name}} +%if %{without python2} +Obsoletes: python-%{name} < %{version}-%{release} +Obsoletes: python2-%{name} < %{version}-%{release} +%endif Requires: python3-lxml Requires: %{name}-bin = %{version}-%{release} BuildArch: noarch @@ -181,7 +192,9 @@ formats and filters. --report-bugs='https://bugzilla.redhat.com/enter_bug.cgi?product=Fedora&component=%{name}' %build +%if %{with python2} %py2_build +%endif # see https://fedoraproject.org/wiki/Changes/python3_c.utf-8_locale; # specifically: # File "setup.py", line 466, in _pkg_prepare_file @@ -192,11 +205,12 @@ formats and filters. export LC_ALL=C.UTF-8 LANG=C.UTF-8 %py3_build -%{__python3} ./run-dev --skip-ext --completion-bash 2>/dev/null \ +%{__python3} -Es ./run-dev --skip-ext --completion-bash 2>/dev/null \ | sed 's|run[-_]dev|%{name}|g' > .bashcomp # generate man pages (proper commands and aliases from a sorted sequence) %{__mkdir_p} -- .manpages/man1 -{ echo; ./run-dev -l | sed -n 's|^ \(\S\+\).*|\1|p' | sort; } > .subcmds +{ echo; %{__python3} -Es ./run-dev -l | sed -n 's|^ \(\S\+\).*|\1|p' \ + | sort; } > .subcmds sed -e 's:\(.\+\):\\\&\\fIrun_dev-\1\\fR\\\|(1), :' \ -e '1s|\(.*\)|\[SEE ALSO\]\n|' \ -e '$s|\(.*\)|\1\nand perhaps more|' \ @@ -239,7 +253,9 @@ done < .subcmds OUTPUTDIR=.schemas POSTPROCESS="%{SOURCE2}" sh "%{SOURCE3}" --clobber %install +%if %{with python2} %py2_install +%endif # see build section export LC_ALL=C.UTF-8 LANG=C.UTF-8 %py3_install @@ -257,10 +273,12 @@ test -f '%{buildroot}%{_bindir}/%{name}' \ for format in cib corosync; do %{__cp} -a -t '%{buildroot}%{_datarootdir}/%{name}/formats' \ -- "%{buildroot}%{python3_sitelib}/%{name}/formats/${format}" +%if %{with python2} %{__rm} -f -- "%{buildroot}%{python2_sitelib}/%{name}/formats/${format}"/* ln -s -t "%{buildroot}%{python2_sitelib}/%{name}/formats/${format}" \ -- $(pushd "%{buildroot}%{_datarootdir}/%{name}/formats/${format}" >/dev/null; \ ls -1A | sed "s:.*:%{_datarootdir}/%{name}/formats/${format}/\\0:") +%endif %{__rm} -f -- "%{buildroot}%{python3_sitelib}/%{name}/formats/${format}"/* ln -s -t "%{buildroot}%{python3_sitelib}/%{name}/formats/${format}" \ -- $(pushd "%{buildroot}%{_datarootdir}/%{name}/formats/${format}" >/dev/null; \ @@ -270,8 +288,10 @@ done # move ext-plugins from python-specific locations to a single common one # incl. the different sorts of precompiled bytecodes %{__mkdir_p} -- '%{buildroot}%{_datarootdir}/%{name}/ext-plugins' +%if %{with python2} mv -t '%{buildroot}%{_datarootdir}/%{name}/ext-plugins' \ -- '%{buildroot}%{python2_sitelib}/%{name}'/ext-plugins/*/ +%endif %{__cp} -af -t '%{buildroot}%{_datarootdir}/%{name}/ext-plugins' \ -- '%{buildroot}%{python3_sitelib}/%{name}'/ext-plugins/* %{__rm} -rf -- '%{buildroot}%{python3_sitelib}/%{name}'/ext-plugins/*/ @@ -314,7 +334,9 @@ declare ret=0 \ ccs_flatten_dir="$(dirname '%{buildroot}%{_libexecdir}/%{name}-%{version}/ccs_flatten')" ln -s '%{buildroot}%{_datadir}/cluster'/*.'metadata' \ "${ccs_flatten_dir}" +%if %{with python2} PATH="${PATH:+${PATH}:}${ccs_flatten_dir}" PYTHONEXEC="%{__python2} -Es" ./run-tests +%endif # see build section export LC_ALL=C.UTF-8 LANG=C.UTF-8 PATH="${PATH:+${PATH}:}${ccs_flatten_dir}" PYTHONEXEC="%{__python3} -Es" ./run-tests @@ -350,9 +372,11 @@ test -x '%{_bindir}/%{name}' && test -f "${bashcomp}" \ %{_mandir}/man1/*.1* %{_bindir}/%{name} +%if %{with python2} %files -n python2-%{name} %{python2_sitelib}/%{name} %{python2_sitelib}/%{name}-*.egg-info +%endif %files -n python3-%{name} %{python3_sitelib}/%{name} @@ -378,6 +402,10 @@ test -x '%{_bindir}/%{name}' && test -f "${bashcomp}" \ %{_datarootdir}/%{name}/ext-plugins/lib-pcs %changelog +* Mon Mar 19 2018 Jan Pokorný - 0.77.1-2 +- stop creating Python 2 packages by default (nothing in Fedora uses it) +- fix a previously omitted unqualified python invocation + * Thu Mar 15 2018 Jan Pokorný - 0.77.1-1 - drop no longer favoured Group tag - replace unqualified python invocations with explicit python3