Sent: Tuesday, January 02, 2018 at 2:44 PM From: "jan matejek"
%files %ifpython2 %{_docdir}/python2-gobject %endif %ifpython3 %{_docdir}/python3-gobject %endif
Two things. One, %python2_only and %python3_only are your friends. What you wrote is equivalent to: --8<-- %files %python2_only %{_docdir}/python2-gobject %python3_only %{_docdir}/python3-gobject -->8--
Two, even this shorter version is not great. You're listing every flavor by hand. Singlespec is all about not doing that ;) This also fails when we add a new flavor, say, pypy3.
The right way to do this is actually very simple: --8<-- %files %{_docdir}/%{python_flavor}-gobject -->8--
also you probably want to mark it as doc: %doc %{_docdir}/...
The cake's cherry. I knew I was missing something, the way I went didn't seem the right one.
Speaking of which, I haven't tried, but something like this might work: --8<-- %install (...) %{python_expand # convert examples mkdir doc-%{$python_flavor} find examples -type f -exec | while read pathname; do sed 's/.../.../' $pathname > doc-%{$python_flavor}/$pathname done }
%files %doc doc-%{python_flavor}/examples -->8-- This relies on the %doc macro to do the installation in the properly named directory. You would prepare a doc-$flavor directory for each flavor. Then using the %doc with a relative path, RPM will take the argument and install it into %{_docdir}/$packagename, without the need to figure out the $packagename.
I'm actually very satisfied right now with all this feedback and even without this last experimental chunk, but it worth a try for future references. Thank you Jan Matejek. Wishing a good year for everybody, Luciano. -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org