Provide Python2 and Python3 scons

This commit is contained in:
sagitter 2017-12-29 23:08:11 +01:00
parent 6fd91618b6
commit b1dc737b52

View File

@ -1,8 +1,22 @@
#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}
%global with_python3 1
%global with_python2 1
%endif
%if 0%{?rhel}
%global with_python3 0
%global with_python2 1
%endif
Name: scons
Version: 3.0.1
Release: 1%{?posttag}%{?dist}
Release: 5%{?posttag}%{?dist}
Summary: An Open Source software construction tool
License: MIT
@ -10,15 +24,6 @@ URL: http://www.scons.org
Source: http://prdownloads.sourceforge.net/scons/scons-%{version}.tar.gz
BuildArch: noarch
# 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%{?el7}
BuildRequires: python2-devel
%else
BuildRequires: python3-devel
%endif
%description
SCons is an Open Source software construction tool--that is, a build
tool; an improved substitute for the classic Make utility; a better way
@ -34,47 +39,185 @@ 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.
%prep
%setup -q -n %{name}-%{version}%{?posttag}
%if 0%{?with_python2}
%package -n python2-%{name}
Summary: An Open Source software construction tool
%if 0%{?el7}
sed -i 's|/usr/bin/env python|%{__python2}|' script/*
%else
sed -i 's|/usr/bin/env python|%{__python3}|' script/*
BuildRequires: python2-devel
Provides: scons = %{version}-%{release}
Obsoletes: scons < %{version}-4
%{?python_provide:%python_provide python2-%{name}}
%description -n python2-%{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}
%package -n python3-%{name}
Summary: An Open Source software construction tool
BuildRequires: python3-devel
Provides: scons-python3 = %{version}-%{release}
%{?python_provide:%python_provide python3-%{name}}
%description -n python3-%{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
%prep
%setup -qc
# Convert to UTF-8
for file in *.txt; do
for file in %{name}-%{version}%{?posttag}/*.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
%endif
%if 0%{?with_python2}
sed -i 's|/usr/bin/env python|%{__python2}|' %{name}-%{version}%{?posttag}/script/*
%endif
%if 0%{?with_python3}
sed -i 's|/usr/bin/env python|%{__python3}|' %{name}-%{version}%{?posttag}-py3/script/*
%endif
%build
%if 0%{?el7}
%if 0%{?with_python2}
pushd %{name}-%{version}%{?posttag}
%py2_build
%else
popd
%endif
%if 0%{?with_python3}
pushd %{name}-%{version}%{?posttag}-py3
%py3_build
popd
%endif
%install
%if 0%{?el7}
%py2_install \
%else
%if 0%{?with_python3}
cd %{name}-%{version}%{?posttag}-py3
%py3_install \
%endif
--no-version-script \
--standalone-lib \
--install-scripts=%{_bindir} \
--install-data=%{_datadir}
--standard-lib \
--no-install-bat \
--no-version-script \
--install-scripts=%{_bindir} \
--install-data=%{_datadir}
cd ..
%files
%doc CHANGES.txt README.txt RELEASE.txt
%license LICENSE.txt
%{_bindir}/*
%{_prefix}/lib/scons
#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_version} %{name}-%{python3_version}; do
ln -fs %{_bindir}/%{name}-3 %{buildroot}%{_bindir}/$i
done
for i in %{name}ign-v%{version}-%{python3_version} %{name}ign-%{python3_version}; do
ln -fs %{_bindir}/%{name}ign-3 %{buildroot}%{_bindir}/$i
done
for i in %{name}-time-v%{version}-%{python3_version} %{name}-time-%{python3_version}; do
ln -fs %{_bindir}/%{name}-time-3 %{buildroot}%{_bindir}/$i
done
for i in %{name}-configure-cache-v%{version}-%{python3_version} %{name}-configure-cache-%{python3_version}; do
ln -fs %{_bindir}/%{name}-configure-cache-3 %{buildroot}%{_bindir}/$i
done
popd
%endif
%if 0%{?with_python2}
cd %{name}-%{version}%{?posttag}
%py2_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
pushd %{buildroot}%{_bindir}
for i in %{name}-2 %{name}-%{python2_version} %{name}-v%{version}-%{python2_version}; do
ln -fs %{_bindir}/%{name} %{buildroot}%{_bindir}/$i
done
for i in %{name}ign-2 %{name}ign-%{python2_version} %{name}ign-v%{version}-%{python2_version}; do
ln -fs %{_bindir}/%{name}ign %{buildroot}%{_bindir}/$i
done
for i in %{name}-time-2 %{name}-time-%{python2_version} %{name}-time-v%{version}-%{python2_version}; do
ln -fs %{_bindir}/%{name}-time %{buildroot}%{_bindir}/$i
done
for i in %{name}-configure-cache-2 %{name}-configure-cache-%{python2_version} %{name}-configure-cache-v%{version}-%{python2_version}; do
ln -fs %{_bindir}/%{name}-configure-cache %{buildroot}%{_bindir}/$i
done
popd
%endif
%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
%{_bindir}/%{name}
%{_bindir}/%{name}ign
%{_bindir}/%{name}-time
%{_bindir}/%{name}-configure-cache
%{_bindir}/%{name}*-2
%{_bindir}/%{name}*-%{python2_version}
%{python2_sitelib}/SCons/
%{python2_sitelib}/scons-%{version}*.egg-info
%{_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
%{_bindir}/%{name}*-3
%{_bindir}/%{name}*-%{python3_version}
%{python3_sitelib}/SCons/
%{python3_sitelib}/scons-%{version}*.egg-info
%{_mandir}/man?/*
%endif
%changelog
* Mon Dec 25 2017 Antonio Trande <sagitter at fedoraproject.org> - 3.0.1-5
- Remove 'Obsoletes scons' for scons-python3
* Mon Dec 25 2017 Antonio Trande <sagitter at fedoraproject.org> - 3.0.1-4
- Fix Provides tag
* Mon Dec 25 2017 Antonio Trande <sagitter at fedoraproject.org> - 3.0.1-3
- Set Obsoletes tag
* Mon Dec 25 2017 Antonio Trande <sagitter at fedoraproject.org> - 3.0.1-2
- Provide Python2 and Python3 scons
- Avoiding collisions between the python 2 and python 3 stacks
* Tue Nov 28 2017 Antonio Trande <sagitter at fedoraproject.org> - 3.0.1-1
- Update to 3.0.1
- Build with Python2 on epel7