From 8d56f83f01d98c81c187bca6ac407bf3a9a406d6 Mon Sep 17 00:00:00 2001 From: sagitter Date: Wed, 22 Aug 2018 14:33:15 +0200 Subject: [PATCH] Deprecate Python2 on fedora 30+ and epel 8+; use python3_other macros (https://fedoraproject.org/wiki/User:Bkabrda/EPEL7_Python3) --- scons.spec | 147 ++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 116 insertions(+), 31 deletions(-) diff --git a/scons.spec b/scons.spec index ffe30dc..c652e33 100644 --- a/scons.spec +++ b/scons.spec @@ -1,24 +1,30 @@ -#global posttag .final.0 - # SCons 3.0.1 does not run under (3.0.0) < Python3 < (3,5,0) or # Python < (2,7,0). # Epel7 provides Python3.4 -%if 0%{?fedora} || 0%{?rhel} > 7 +%if 0%{?rhel} >= 8 %global with_python3 1 -%if 0%{?rhel} > 7 %global with_python2 0 -%else +%endif + +%if 0%{?rhel} < 8 +%global with_python3 1 %global with_python2 1 %endif -%else -%global with_python3 0 + +%if 0%{?fedora} < 30 +%global with_python3 1 %global with_python2 1 %endif +%if 0%{?fedora} >= 30 +%global with_python3 1 +%global with_python2 0 +%endif + Name: scons Version: 3.0.1 -Release: 10%{?posttag}%{?dist} +Release: 11%{?dist} Summary: An Open Source software construction tool License: MIT @@ -43,11 +49,11 @@ defined Builder and/or Scanner objects. %if 0%{?with_python2} %package -n python2-%{name} -Summary: An Open Source software construction tool +Summary: An Open Source software construction tool -BuildRequires: python2-devel -Provides: scons = %{version}-%{release} -Obsoletes: scons < %{version}-4 +BuildRequires: python2-devel +Provides: scons = %{version}-%{release} +Obsoletes: scons < %{version}-4 %{?python_provide:%python_provide python2-%{name}} %description -n python2-%{name} @@ -67,14 +73,38 @@ defined Builder and/or Scanner objects. %endif %if 0%{?with_python3} -%package -n python3-%{name} -Summary: An Open Source software construction tool +%package -n python%{python3_pkgversion}-%{name} +Summary: An Open Source software construction tool -BuildRequires: python3-devel -Provides: scons-python3 = %{version}-%{release} -%{?python_provide:%python_provide python3-%{name}} +BuildRequires: python%{python3_pkgversion}-devel +Provides: scons-python%{python3_pkgversion} = %{version}-%{release} +%{?python_provide:%python_provide python%{python3_pkgversion}-%{name}} -%description -n python3-%{name} +%description -n python%{python3_pkgversion}-%{name} +SCons is an Open Source software construction tool--that is, a build +tool; an improved substitute for the classic Make utility; a better way +to build software. SCons is based on the design which won the Software +Carpentry build tool design competition in August 2000. + +SCons "configuration files" are Python scripts, eliminating the need +to learn a new build tool syntax. SCons maintains a global view of +all dependencies in a tree, and can scan source (or other) files for +implicit dependencies, such as files specified on #include lines. SCons +uses MD5 signatures to rebuild only when the contents of a file have +really changed, not just when the timestamp has been touched. SCons +supports side-by-side variant builds, and is easily extended with user- +defined Builder and/or Scanner objects. +%endif + +%if 0%{?with_python3_other} +%package -n python%{python3_other_pkgversion}-%{name} +Summary: An Open Source software construction tool + +BuildRequires: python%{python3_other_pkgversion}-devel +Provides: scons-python%{python3_other_pkgversion} = %{version}-%{release} +%{?python_provide:%python_provide python%{python3_other_pkgversion}-%{name}} + +%description -n python%{python3_other_pkgversion}-%{name} SCons is an Open Source software construction tool--that is, a build tool; an improved substitute for the classic Make utility; a better way to build software. SCons is based on the design which won the Software @@ -94,36 +124,44 @@ defined Builder and/or Scanner objects. %setup -qc # Convert to UTF-8 -for file in %{name}-%{version}%{?posttag}/*.txt; do +for file in %{name}-%{version}/*.txt; do iconv -f ISO-8859-1 -t UTF-8 -o $file.new $file && \ touch -r $file $file.new && \ mv $file.new $file done %if 0%{?with_python3} -cp -a %{name}-%{version}%{?posttag} %{name}-%{version}%{?posttag}-py3 +cp -a %{name}-%{version} %{name}-%{version}-py3 +%endif +%if 0%{?with_python3_other} +cp -a %{name}-%{version} %{name}-%{version}-py%{python3_other_pkgversion} %endif %if 0%{?with_python2} -sed -i 's|/usr/bin/env python|%{__python2}|' %{name}-%{version}%{?posttag}/script/* +sed -i 's|/usr/bin/env python|%{__python2}|' %{name}-%{version}/script/* %endif %if 0%{?with_python3} -sed -i 's|/usr/bin/env python|%{__python3}|' %{name}-%{version}%{?posttag}-py3/script/* +sed -i 's|/usr/bin/env python|%{__python3}|' %{name}-%{version}-py3/script/* %endif %build %if 0%{?with_python2} -pushd %{name}-%{version}%{?posttag} +pushd %{name}-%{version} %py2_build popd %endif %if 0%{?with_python3} -pushd %{name}-%{version}%{?posttag}-py3 +pushd %{name}-%{version}-py3 %py3_build popd %endif +%if 0%{?with_python3_other} +pushd %{name}-%{version}-py%{python3_other_pkgversion} +%py3_other_build +popd +%endif %install %if 0%{?with_python3} -cd %{name}-%{version}%{?posttag}-py3 +cd %{name}-%{version}-py3 %py3_install \ --standard-lib \ --no-install-bat \ @@ -154,8 +192,40 @@ done popd %endif +%if 0%{?with_python3_other} +cd %{name}-%{version}-py%{python3_other_pkgversion} +%py3_other_install \ + --standard-lib \ + --no-install-bat \ + --no-version-script \ + --install-scripts=%{_bindir} \ + --install-data=%{_datadir} +cd .. + +#Avoiding collisions between the python 2 and python 3 stacks +mv %{buildroot}%{_bindir}/%{name} %{buildroot}%{_bindir}/%{name}-3 +mv %{buildroot}%{_bindir}/%{name}-configure-cache %{buildroot}%{_bindir}/%{name}-configure-cache-3 +mv %{buildroot}%{_bindir}/%{name}ign %{buildroot}%{_bindir}/%{name}ign-3 +mv %{buildroot}%{_bindir}/%{name}-time %{buildroot}%{_bindir}/%{name}-time-3 + +pushd %{buildroot}%{_bindir} +for i in %{name}-v%{version}-%{python3_other_pkgversion} %{name}-%{python3_other_pkgversion}; do + ln -fs %{_bindir}/%{name}-3 %{buildroot}%{_bindir}/$i +done +for i in %{name}ign-v%{version}-%{python3_version} %{name}ign-%{python3_other_pkgversion}; do + ln -fs %{_bindir}/%{name}ign-3 %{buildroot}%{_bindir}/$i +done +for i in %{name}-time-v%{version}-%{python3_other_pkgversion} %{name}-time-%{python3_other_pkgversion}; do + ln -fs %{_bindir}/%{name}-time-3 %{buildroot}%{_bindir}/$i +done +for i in %{name}-configure-cache-v%{version}-%{python3_other_pkgversion} %{name}-configure-cache-%{python3_other_pkgversion}; do + ln -fs %{_bindir}/%{name}-configure-cache-3 %{buildroot}%{_bindir}/$i +done +popd +%endif + %if 0%{?with_python2} -cd %{name}-%{version}%{?posttag} +cd %{name}-%{version} %py2_install \ --standard-lib \ --no-install-bat \ @@ -183,8 +253,8 @@ popd %if 0%{?with_python2} %files -n python2-%{name} -%doc %{name}-%{version}%{?posttag}/CHANGES.txt %{name}-%{version}%{?posttag}/README.txt %{name}-%{version}%{?posttag}/RELEASE.txt -%license %{name}-%{version}%{?posttag}/LICENSE.txt +%doc %{name}-%{version}/CHANGES.txt %{name}-%{version}/README.txt %{name}-%{version}/RELEASE.txt +%license %{name}-%{version}/LICENSE.txt %{_bindir}/%{name} %{_bindir}/%{name}ign %{_bindir}/%{name}-time @@ -196,9 +266,9 @@ popd %{_mandir}/man?/* %endif %if 0%{?with_python3} -%files -n python3-%{name} -%doc %{name}-%{version}%{?posttag}-py3/CHANGES.txt %{name}-%{version}%{?posttag}-py3/README.txt %{name}-%{version}%{?posttag}-py3/RELEASE.txt -%license %{name}-%{version}%{?posttag}-py3/LICENSE.txt +%files -n python%{python3_pkgversion}-%{name} +%doc %{name}-%{version}-py3/CHANGES.txt %{name}-%{version}-py3/README.txt %{name}-%{version}-py3/RELEASE.txt +%license %{name}-%{version}-py3/LICENSE.txt %{_bindir}/%{name}*-3 %{_bindir}/%{name}*-%{python3_version} %{python3_sitelib}/SCons/ @@ -206,7 +276,22 @@ popd %{_mandir}/man?/* %endif +%if 0%{?with_python3_other} +%files -n python%{python3_other_pkgversion}-%{name} +%doc %{name}-%{version}-py%{python3_other_pkgversion}/CHANGES.txt %{name}-%{version}-py%{python3_other_pkgversion}/README.txt %{name}-%{version}-py%{python3_other_pkgversion}/RELEASE.txt +%license %{name}-%{version}-py%{python3_other_pkgversion}/LICENSE.txt +%{_bindir}/%{name}*-3 +%{_bindir}/%{name}*-%{python3_other_pkgversion} +%{python3_other_sitelib}/SCons/ +%{python3_other_sitelib}/scons-%{version}*.egg-info +%{_mandir}/man?/* +%endif + %changelog +* Wed Aug 22 2018 Antonio Trande - 3.0.1-11 +- Deprecate Python2 on fedora 30+ and epel 8+ +- Use python3_other macros (https://fedoraproject.org/wiki/User:Bkabrda/EPEL7_Python3) + * Fri Jul 20 2018 Honza Horak - 3.0.1-10 - Do not build python2-scons on rhel>7