Default to python3 build

Related: rhbz#1725155
This commit is contained in:
serge-sans-paille 2019-07-01 08:04:59 +00:00
parent b6e6b8ee57
commit 94d07ae339

View File

@ -1,7 +1,9 @@
%global srcname lit %global srcname lit
%if 0%{?fedora} || 0%{?rhel} > 7 %if 0%{?fedora} || 0%{?rhel} > 7
%global with_python3 1 %global with_python2 0
%else
%global with_python2 1
%endif %endif
# FIXME: Work around for rhel not having py2_build/py2_install macro. # FIXME: Work around for rhel not having py2_build/py2_install macro.
@ -10,7 +12,7 @@
Name: python-%{srcname} Name: python-%{srcname}
Version: 0.8.0 Version: 0.8.0
Release: 1%{?dist} Release: 2%{?dist}
BuildArch: noarch BuildArch: noarch
License: NCSA License: NCSA
@ -18,33 +20,33 @@ Summary: Tool for executing llvm test suites
URL: https://pypi.python.org/pypi/lit URL: https://pypi.python.org/pypi/lit
Source0: https://files.pythonhosted.org/packages/ba/da/c4b2b6ab24c840169e090d6e8f4c1bfa1e8a6b9d0ef3f8ed57ee9f72a317/lit-0.8.0.tar.gz Source0: https://files.pythonhosted.org/packages/ba/da/c4b2b6ab24c840169e090d6e8f4c1bfa1e8a6b9d0ef3f8ed57ee9f72a317/lit-0.8.0.tar.gz
BuildRequires: python2-devel
BuildRequires: python2-setuptools
%if 0%{?with_python3}
BuildRequires: python3-devel BuildRequires: python3-devel
BuildRequires: python3-setuptools BuildRequires: python3-setuptools
%if 0%{?with_python2}
BuildRequires: python2-devel
BuildRequires: python2-setuptools
%endif %endif
%description %description
lit is a tool used by the LLVM project for executing its test suites. lit is a tool used by the LLVM project for executing its test suites.
%package -n python2-lit
Summary: LLVM lit test runner for Python 2
Requires: python2-setuptools
%if 0%{?with_python3}
%package -n python3-lit %package -n python3-lit
Summary: LLVM lit test runner for Python 3 Summary: LLVM lit test runner for Python 3
Requires: python3-setuptools Requires: python3-setuptools
%if 0%{?with_python2}
%package -n python2-lit
Summary: LLVM lit test runner for Python 2
Requires: python2-setuptools
%endif %endif
%description -n python2-lit %description -n python3-lit
lit is a tool used by the LLVM project for executing its test suites. lit is a tool used by the LLVM project for executing its test suites.
%if 0%{?with_python3} %if 0%{?with_python2}
%description -n python3-lit %description -n python2-lit
lit is a tool used by the LLVM project for executing its test suites. lit is a tool used by the LLVM project for executing its test suites.
%endif %endif
@ -52,45 +54,47 @@ lit is a tool used by the LLVM project for executing its test suites.
%autosetup -n %{srcname}-%{version}%{?rc_ver:rc%{rc_ver}} %autosetup -n %{srcname}-%{version}%{?rc_ver:rc%{rc_ver}}
%build %build
%py2_build
%if 0%{?with_python3}
%py3_build %py3_build
%if 0%{?with_python2}
%py2_build
%endif %endif
%install %install
%py2_install
%if 0%{?with_python3}
%py3_install %py3_install
%if 0%{?with_python2}
%py2_install
%endif %endif
# Strip out #!/usr/bin/env python # Strip out #!/usr/bin/env python
sed -i -e '1{\@^#!/usr/bin/env python@d}' %{buildroot}%{python2_sitelib}/%{srcname}/*.py
%if 0%{?with_python3}
sed -i -e '1{\@^#!/usr/bin/env python@d}' %{buildroot}%{python3_sitelib}/%{srcname}/*.py sed -i -e '1{\@^#!/usr/bin/env python@d}' %{buildroot}%{python3_sitelib}/%{srcname}/*.py
%if 0%{?with_python2}
sed -i -e '1{\@^#!/usr/bin/env python@d}' %{buildroot}%{python2_sitelib}/%{srcname}/*.py
%endif %endif
%check %check
%{__python2} setup.py test %{__python3} setup.py test
%if 0%{?with_python3} %if 0%{?with_python2}
# FIXME: Tests fail with python3 {__python2} setup.py test
#{__python3} setup.py test
%endif %endif
%files -n python2-%{srcname}
%doc README.txt
%{python2_sitelib}/*
%if %{undefined with_python3}
%{_bindir}/lit
%endif
%if 0%{?with_python3}
%files -n python3-%{srcname} %files -n python3-%{srcname}
%doc README.txt %doc README.txt
%{python3_sitelib}/* %{python3_sitelib}/*
%{_bindir}/lit %{_bindir}/lit
%if 0%{?with_python2}
%files -n python2-%{srcname}
%doc README.txt
%{python2_sitelib}/*
%if %{undefined with_python2}
%{_bindir}/lit
%endif
%endif %endif
%changelog %changelog
* Fri Jun 28 2019 sguelton@redhat.com - 8.0.0-2
- Fix rhbz#1725155
* Thu Mar 21 2019 sguelton@redhat.com - 8.0.0-1 * Thu Mar 21 2019 sguelton@redhat.com - 8.0.0-1
- 0.8.0 Release - 0.8.0 Release