- Make waf compatible with python3, if available.

epel8
Thomas Moschny 14 years ago
parent 78c7038f81
commit 12a9b77d26

@ -1,10 +1,17 @@
%if (! 0%{?rhel}) || 0%{?rhel} > 6
%global with_python3 1
%endif
# Enable building without html docs (e.g. in case no recent sphinx is # Enable building without html docs (e.g. in case no recent sphinx is
# available) # available)
%global with_docs 1 %global with_docs 1
# Turn off the brp-python-bytecompile script
%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')
Name: waf Name: waf
Version: 1.6.2 Version: 1.6.2
Release: 2%{?dist} Release: 3%{?dist}
Summary: A Python-based build system Summary: A Python-based build system
Group: Development/Tools Group: Development/Tools
# The entire source code is BSD apart from pproc.py (taken from Python 2.5) # The entire source code is BSD apart from pproc.py (taken from Python 2.5)
@ -20,6 +27,9 @@ Patch0: waf-1.6.2-libdir.patch
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildArch: noarch BuildArch: noarch
BuildRequires: python-devel BuildRequires: python-devel
%if 0%{?with_python3}
BuildRequires: python3-devel
%endif # with_python3
%if 0%{?with_docs} %if 0%{?with_docs}
BuildRequires: python-sphinx BuildRequires: python-sphinx
BuildRequires: graphviz BuildRequires: graphviz
@ -71,15 +81,23 @@ rm -rf %{buildroot}
# use waf so it unpacks itself # use waf so it unpacks itself
mkdir _temp ; pushd _temp mkdir _temp ; pushd _temp
cp -av ../waf . cp -av ../waf .
./waf >/dev/null 2>&1 %{__python} ./waf >/dev/null 2>&1
pushd .waf-%{version}-* pushd .waf-%{version}-*
find . -name '*.py' -printf '%%P\0' | find . -name '*.py' -printf '%%P\0' |
xargs -0 -I{} install -m 0644 -p -D {} %{buildroot}%{_datadir}/waf/{} xargs -0 -I{} install -m 0644 -p -D {} %{buildroot}%{_datadir}/waf/{}
popd ; popd popd
%if 0%{?with_python3}
%{__python3} ./waf >/dev/null 2>&1
pushd .waf3-%{version}-*
find . -name '*.py' -printf '%%P\0' |
xargs -0 -I{} install -m 0644 -p -D {} %{buildroot}%{_datadir}/waf3/{}
popd
%endif # with_python3
popd
install -m 0755 -p -D waf-light %{buildroot}%{_bindir}/waf install -m 0755 -p -D waf-light %{buildroot}%{_bindir}/waf
# remove shebangs from and fix EOL for all scripts in wafadmin # remove shebangs from and fix EOL for all scripts in wafadmin
find %{buildroot}%{_datadir}/waf/ -name '*.py' \ find %{buildroot}%{_datadir}/ -name '*.py' \
-exec sed -i -e '1{/^#!/d}' -e 's|\r$||g' {} \; -exec sed -i -e '1{/^#!/d}' -e 's|\r$||g' {} \;
# fix waf script shebang line # fix waf script shebang line
@ -88,6 +106,12 @@ sed -i "1c#! /usr/bin/python" %{buildroot}%{_bindir}/waf
# remove x-bits from everything going to doc # remove x-bits from everything going to doc
find demos utils -type f -exec %{__chmod} 0644 {} \; find demos utils -type f -exec %{__chmod} 0644 {} \;
# do byte compilation
%py_byte_compile %{__python} %{buildroot}%{_datadir}/waf
%if 0%{?with_python3}
%py_byte_compile %{__python3} %{buildroot}%{_datadir}/waf3
%endif # with_python3
%clean %clean
rm -rf %{buildroot} rm -rf %{buildroot}
@ -101,9 +125,16 @@ rm -rf %{buildroot}
%endif # with_docs %endif # with_docs
%{_bindir}/waf %{_bindir}/waf
%{_datadir}/waf %{_datadir}/waf
%if 0%{?with_python3}
%{_datadir}/waf3
%endif # with_python3
%changelog %changelog
* Fri Jan 21 2011 Thomas Moschny <thomas.moschny@gmx.de> - 1.6.2-3
- Make waf compatible with python3, if available.
* Tue Jan 18 2011 Thomas Moschny <thomas.moschny@gmx.de> - 1.6.2-2 * Tue Jan 18 2011 Thomas Moschny <thomas.moschny@gmx.de> - 1.6.2-2
- Enable building without html docs. - Enable building without html docs.

Loading…
Cancel
Save