[waf] - Make waf compatible with python3, if available.
Thomas Moschny
thm at fedoraproject.org
Fri Jan 21 22:46:05 UTC 2011
commit 12a9b77d2638e64d9185a517f0c1417e181dd2ee
Author: Thomas Moschny <thm at fedoraproject.org>
Date: Fri Jan 21 02:34:41 2011 +0100
- Make waf compatible with python3, if available.
waf.spec | 39 +++++++++++++++++++++++++++++++++++----
1 files changed, 35 insertions(+), 4 deletions(-)
---
diff --git a/waf.spec b/waf.spec
index 6e483bb..a2166be 100644
--- a/waf.spec
+++ b/waf.spec
@@ -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
# available)
%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
Version: 1.6.2
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: A Python-based build system
Group: Development/Tools
# 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)
BuildArch: noarch
BuildRequires: python-devel
+%if 0%{?with_python3}
+BuildRequires: python3-devel
+%endif # with_python3
%if 0%{?with_docs}
BuildRequires: python-sphinx
BuildRequires: graphviz
@@ -71,15 +81,23 @@ rm -rf %{buildroot}
# use waf so it unpacks itself
mkdir _temp ; pushd _temp
cp -av ../waf .
-./waf >/dev/null 2>&1
+%{__python} ./waf >/dev/null 2>&1
pushd .waf-%{version}-*
find . -name '*.py' -printf '%%P\0' |
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
# 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' {} \;
# 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
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
rm -rf %{buildroot}
@@ -101,9 +125,16 @@ rm -rf %{buildroot}
%endif # with_docs
%{_bindir}/waf
%{_datadir}/waf
+%if 0%{?with_python3}
+%{_datadir}/waf3
+%endif # with_python3
+
%changelog
+* Fri Jan 21 2011 Thomas Moschny <thomas.moschny at gmx.de> - 1.6.2-3
+- Make waf compatible with python3, if available.
+
* Tue Jan 18 2011 Thomas Moschny <thomas.moschny at gmx.de> - 1.6.2-2
- Enable building without html docs.
More information about the scm-commits
mailing list