diff --git a/waf-1.8.11-libdir.patch b/waf-1.8.11-libdir.patch deleted file mode 100644 index faa88f2..0000000 --- a/waf-1.8.11-libdir.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff -up waf-1.8.11/waf-light.orig waf-1.8.11/waf-light ---- waf-1.8.11/waf-light.orig 2015-06-20 22:24:00.000000000 +0200 -+++ waf-1.8.11/waf-light 2015-06-22 20:23:07.171667528 +0200 -@@ -149,6 +149,9 @@ def find_lib(): - w = test(i + '/lib/' + dirname) - if w: return w - -+ w = test('/usr/share/%s' % WAF) -+ if w: return w -+ - #waf-local - dir = join(base, (sys.platform != 'win32' and '.' or '') + dirname) - w = test(dir) diff --git a/waf-2.0.18-libdir.patch b/waf-2.0.18-libdir.patch new file mode 100644 index 0000000..2fc53b9 --- /dev/null +++ b/waf-2.0.18-libdir.patch @@ -0,0 +1,13 @@ +diff -up waf-2.0.18/waf-light.orig waf-2.0.18/waf-light +--- waf-2.0.18/waf-light.orig 2019-07-14 10:41:10.000000000 +0200 ++++ waf-2.0.18/waf-light 2019-10-05 17:55:42.254788427 +0200 +@@ -152,6 +152,9 @@ def find_lib(): + w = test(i + '/lib/' + dirname) + if w: return w + ++ w = test('/usr/share/%s' % WAF) ++ if w: return w ++ + #waf-local + dir = join(base, (sys.platform != 'win32' and '.' or '') + dirname) + w = test(dir) diff --git a/waf-1.6.9-logo.patch b/waf-2.0.18-logo.patch similarity index 55% rename from waf-1.6.9-logo.patch rename to waf-2.0.18-logo.patch index 4dc73ed..d804e51 100644 --- a/waf-1.6.9-logo.patch +++ b/waf-2.0.18-logo.patch @@ -1,7 +1,7 @@ -diff -up waf-1.6.9/docs/sphinx/conf.py.orig waf-1.6.9/docs/sphinx/conf.py ---- waf-1.6.9/docs/sphinx/conf.py.orig 2011-11-20 15:51:43.000000000 +0100 -+++ waf-1.6.9/docs/sphinx/conf.py 2011-11-26 14:27:33.996165116 +0100 -@@ -415,7 +415,7 @@ html_theme = 'default' +diff -up waf-2.0.18/docs/sphinx/conf.py.orig waf-2.0.18/docs/sphinx/conf.py +--- waf-2.0.18/docs/sphinx/conf.py.orig 2019-04-20 19:06:49.000000000 +0200 ++++ waf-2.0.18/docs/sphinx/conf.py 2019-10-05 17:58:58.380982949 +0200 +@@ -428,7 +428,7 @@ else: # The name of an image file (relative to this directory) to place at the top # of the sidebar. diff --git a/waf-1.8.11-sphinx-no-W.patch b/waf-2.0.18-sphinx-no-W.patch similarity index 62% rename from waf-1.8.11-sphinx-no-W.patch rename to waf-2.0.18-sphinx-no-W.patch index a8f3cef..bc08584 100644 --- a/waf-1.8.11-sphinx-no-W.patch +++ b/waf-2.0.18-sphinx-no-W.patch @@ -1,6 +1,6 @@ -diff -up waf-1.8.11/docs/sphinx/wscript.orig waf-1.8.11/docs/sphinx/wscript ---- waf-1.8.11/docs/sphinx/wscript.orig 2015-06-11 18:11:04.000000000 +0200 -+++ waf-1.8.11/docs/sphinx/wscript 2015-06-22 18:36:02.078701412 +0200 +diff -up waf-2.0.18/docs/sphinx/wscript.orig waf-2.0.18/docs/sphinx/wscript +--- waf-2.0.18/docs/sphinx/wscript.orig 2019-04-20 19:06:49.000000000 +0200 ++++ waf-2.0.18/docs/sphinx/wscript 2019-10-05 18:00:54.822911036 +0200 @@ -19,7 +19,6 @@ def configure(cfg): cfg.find_program('convert', var='CONVERT') cfg.load('daemon', tooldir=['../../playground/daemon/']) diff --git a/waf.spec b/waf.spec index c9619c1..2759003 100644 --- a/waf.spec +++ b/waf.spec @@ -1,121 +1,73 @@ -%if 0%{?fedora} -%global with_python3 1 -%endif - -%if 0%{?with_python3} -# 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') -%endif # with_python3 - -# Enable building without html docs (e.g. in case no recent sphinx is -# available) -%global with_docs 1 - -# Priorities for the alternatives system -%global waf_py3_priority 30 -%global waf_py2_priority 20 - Name: waf Version: 2.0.18 -Release: 1%{?dist} +Release: 2%{?dist} Summary: A Python-based build system # The entire source code is BSD apart from pproc.py (taken from Python 2.5) License: BSD and Python URL: https://waf.io/ # Original tarfile can be found at # https://waf.io/waf-%%{version}.tar.bz2 or -# We remove: -# - docs/book, licensed CC BY-NC-ND -# - Waf logos, licensed CC BY-NC +# We remove waf logos, licensed CC BY-NC Source: waf-%{version}.stripped.tar.bz2 Source1: unpack_wafdir.py -Patch0: waf-1.8.11-libdir.patch -Patch1: waf-1.6.9-logo.patch -Patch2: waf-1.8.11-sphinx-no-W.patch +# also search for waflib in /usr/share/waf +Patch0: waf-2.0.18-libdir.patch +# do not try to use the (removed) waf logos +Patch1: waf-2.0.18-logo.patch +# do not add -W when running sphinx-build +Patch2: waf-2.0.18-sphinx-no-W.patch -BuildArch: noarch +# Enable building without html docs (e.g. in case no recent sphinx is +# available) +%bcond_without docs -BuildRequires: python2-devel -%if 0%{?with_python3} +BuildArch: noarch BuildRequires: python3-devel -%endif # with_python3 -%if 0%{?with_docs} -%if 0%{?fedora} || 0%{?rhel} >= 7 +%if %{with docs} BuildRequires: python3-sphinx -%else -BuildRequires: python-sphinx10 -%endif BuildRequires: graphviz BuildRequires: ImageMagick -%endif # with_docs -%if "%{?python2_version}" != "" -# Seems like automatic ABI dependency is not detected since the files are -# going to a non-standard location -Requires: python(abi) = %{python2_version} -%endif - -# alternatives -Requires(posttrans): %{_sbindir}/alternatives -Requires(preun): %{_sbindir}/alternatives - -# the demo suite contains a perl module, which draws in unwanted -# provides and requires -%global __requires_exclude_from %{_docdir} -%global __provides_exclude_from %{_docdir} -# for EPEL, we need the old filters -%global __perl_provides %{nil} -%global __perl_requires %{nil} - - -%description -Waf is a Python-based framework for configuring, compiling and -installing applications. It is a replacement for other tools such as -Autotools, Scons, CMake or Ant. +%endif # with docs +# waf-2.0.18-2 in F32 the first python3-only version (i.e. not having +# a -python3 subpackage). Do not hardcode that as Obsoletes: though, +# to be able to roll out e.g. a 2.0.19 for older Fedora branches, but +# maintain upgradability +Provides: %{name}-python3 = %{version}-%{release} +Obsoletes: %{name}-python3 < %{version}-%{release} -%if 0%{?with_python3} -%package -n %{name}-python3 -Summary: Python3 support for %{name} %if "%{?python3_version}" != "" +# Seems like automatic ABI dependency is not detected since the files +# are going to a non-standard location Requires: python(abi) = %{python3_version} %endif -%description -n %{name}-python3 +# the demo suite contains a perl module, which draws in unwanted +# provides and requires +%global __requires_exclude_from ^%{_docdir}/.*$ +%global __provides_exclude_from ^%{_docdir}/.*$ + +%global _description %{expand: Waf is a Python-based framework for configuring, compiling and installing applications. It is a replacement for other tools such as -Autotools, Scons, CMake or Ant. +Autotools, Scons, CMake or Ant.} -This package contains the Python 3 version of %{name}. -%endif # with_python3 +%description %_description -%if 0%{?with_docs} +%if %{with docs} %package -n %{name}-doc Summary: Documentation for %{name} Requires: %{name} = %{version}-%{release} -# obsolete the previous docs subpackage - guideline specifies -doc -# since: Fedora 18, RHEL 7 (mark the provides/obsoletes RHEL only after -# we no longer need to provide upgrade paths from affected Fedora releases) -Provides: %{name}-docs = %{version}-%{release} -Obsoletes: %{name}-docs < 1.6.11-2 -%description -n %{name}-doc -Waf is a Python-based framework for configuring, compiling and -installing applications. It is a replacement for other tools such as -Autotools, Scons, CMake or Ant. +%description -n %{name}-doc %_description This package contains the HTML documentation for %{name}. -%endif # with_docs +%endif # with docs %prep -%setup -q -# also search for waflib in /usr/share/waf -%patch0 -p1 -# do not try to use the (removed) waf logos -%patch1 -p1 -# do not add -W when running sphinx-build -%patch2 -p1 +%autosetup -p1 %build @@ -126,123 +78,69 @@ for f in waflib/extras/*.py ; do extras="${extras:+$extras,}$f" ; fi done -%{__python2} ./waf-light --make-waf --strip --tools="$extras" +%{__python3} ./waf-light --make-waf --strip --tools="$extras" -%if 0%{?with_docs} +%if %{with docs} # build html docs export WAFDIR=$(pwd) pushd docs/sphinx -%if ! ( 0%{?fedora} || 0%{?rhel} >= 7 ) -export SPHINX_BUILD=sphinx-1.0-build -%endif -%{__python2} ../../waf -v configure build +%{__python3} ../../waf -v configure build popd -%endif # with_docs +%endif # with docs %install -%{__python2} %{S:1} _temp +%{__python3} %{S:1} _temp pushd _temp -find . -name '*.py' -printf '%%P\0' | - xargs -0 -I{} install -m 0644 -p -D {} %{buildroot}%{_datadir}/waf/{} -popd -%if 0%{?with_python3} -%{__python3} %{S:1} _temp3 -pushd _temp3 find . -name '*.py' -printf '%%P\0' | xargs -0 -I{} install -m 0644 -p -D {} %{buildroot}%{_datadir}/waf3/{} popd -%endif # with_python3 # install the frontend -install -m 0755 -p -D waf-light %{buildroot}%{_bindir}/waf-%{python2_version} -ln -s waf-%{python2_version} %{buildroot}%{_bindir}/waf-2 -%if 0%{?with_python3} -install -m 0755 -p -D waf-light %{buildroot}%{_bindir}/waf-%{python3_version} -ln -s waf-%{python3_version} %{buildroot}%{_bindir}/waf-3 -%endif # with_python3 - -# alternatives-controlled -touch %{buildroot}%{_bindir}/waf +install -m 0755 -p -D waf-light %{buildroot}%{_bindir}/waf +ln -s waf %{buildroot}%{_bindir}/waf-3 +ln -s waf %{buildroot}%{_bindir}/waf-%{python3_version} # remove shebangs from and fix EOL for all scripts in wafadmin find %{buildroot}%{_datadir}/ -name '*.py' \ -exec sed -i -e '1{/^#!/d}' -e 's|\r$||g' {} \; # fix waf script shebang line -sed -i "1c#! %{__python2}" %{buildroot}%{_bindir}/waf-%{python2_version} -%if 0%{?with_python3} -sed -i "1c#! %{__python3}" %{buildroot}%{_bindir}/waf-%{python3_version} -%endif # with_python3 +sed -i "1c#! %{__python3}" %{buildroot}%{_bindir}/waf # remove x-bits from everything going to doc find demos utils -type f -exec chmod 0644 {} \; # fix shebang lines in the demos -mkdir demos_py2 ; cp -a demos demos_py2 -find demos_py2 \( -name '*.py' -o -name 'wscript' -o -name 'wscript_build' \) \ - -exec sed -e '1{/^#!/d}' -e '1i#!%{__python2}' -i {} \; -%if 0%{?with_python3} -mkdir demos_py3 ; cp -a demos demos_py3 -find demos_py3 \( -name '*.py' -o -name 'wscript' -o -name 'wscript_build' \) \ +find demos \( -name '*.py' -o -name '*.py.in' -o -name 'wscript' -o -name 'wscript_build' \) \ -exec sed -e '1{/^#!/d}' -e '1i#!%{__python3}' -i {} \; -%endif # with_python3 # remove hidden file rm -f docs/sphinx/build/html/.buildinfo -%if 0%{?with_python3} # do byte compilation -%py_byte_compile %{__python2} %{buildroot}%{_datadir}/waf %py_byte_compile %{__python3} %{buildroot}%{_datadir}/waf3 -%endif # with_python3 - - -%posttrans -%{_sbindir}/alternatives --install %{_bindir}/waf \ - waf %{_bindir}/waf-2 %{waf_py2_priority} || : - - -%preun -%{_sbindir}/alternatives --remove \ - waf %{_bindir}/waf-2 || : %files -%doc README.md ChangeLog demos_py2/demos -%ghost %attr(0755,-,-) %{_bindir}/waf -%{_bindir}/waf-%{python2_version} -%{_bindir}/waf-2 -%{_datadir}/waf - - -%if 0%{?with_python3} -%posttrans -n %{name}-python3 -%{_sbindir}/alternatives --install %{_bindir}/waf \ - waf %{_bindir}/waf-3 %{waf_py3_priority} || : - - -%preun -n %{name}-python3 -%{_sbindir}/alternatives --remove \ - waf %{_bindir}/waf-3 || : - - -%files -n %{name}-python3 -%doc README.md ChangeLog demos_py3/demos -%ghost %attr(0755,-,-) %{_bindir}/waf +%doc README.md ChangeLog demos %{_bindir}/waf-%{python3_version} %{_bindir}/waf-3 +%{_bindir}/waf %{_datadir}/waf3 -%endif # with_python3 -%if 0%{?with_docs} +%if %{with docs} %files -n %{name}-doc %doc docs/sphinx/build/html -%endif # with_docs +%endif # with docs %changelog +* Tue Oct 8 2019 Thomas Moschny - 2.0.18-2 +- Make waf Python3-only (#1753963). +- Spec file modernization and cleanups. + * Sat Oct 5 2019 Thomas Moschny - 2.0.18-1 - Update to 2.0.18. @@ -691,4 +589,3 @@ rm -f docs/sphinx/build/html/.buildinfo * Sun Jan 20 2008 Michel Salim - 1.3.1-1 - Initial Fedora package -