On 2.3.2017 18:16, Luigi Baldoni wrote:
%ifpython2 and friends don't work in %prep/%build/%install/%check, because these sections are common to all the subpackages. IOW, the code in %prep and friends is only run once per build, and must handle all pythons at once.
In other words I need to put the logic into an external script or setup.py itself to differentiate between py2 and py3, right?
well, the "external script" will also only run once. you can use "%python_exec script.py" to run it once for every flavor or something like: %{python_expand sh script.sh --python=$python} You can't, for example, conditionally apply patches, because the source tree is shared. (which i suppose is what you want to do) So the logic of the patch would have to be included in setup.py. Or you could apply and unapply the patch before/after build, see below. if you're taking special steps for build, you could do: %{python_expand ./do-the-special-step %$python_build} similar for %python_install or even: %{python_expand if "$python" == "python2"; then ./do-special-python2-step %python2_build else %$python_build fi} (everything inside the {braces} for python_expand is part of the loop. But if it has multiple lines, the first one must not be empty. RPM limitation, i suppose.)
What are you trying to do? Can't you simply do it without the conditional?
In the case in question, argparse doesn't exist for python3, so setup.py fails setup_requires. I need a patch, I suppose.
Yes, you need a patch, and make it so that the requirement is completely removed :) argparse module is part of Python from 2.7 and 3.2, so unless you're building for SLE11, you don't need it.
Also, what about libraries that exist only for py2 or py3? Does it make sense to use singlespec for those? (I failed when I tried)
For python2, leave it as is. Only if it is a new package, call it "python2-something". If it is an existing package, add "Provides: python2-something". For python3, it's unclear. We will be supporting pypy3 as well, maybe the library will work there? It would be better to write it as singlespec and "%undefine have_python2" at start. This might fail because of bugs. The scenario should work but it is completely untested as of now.
Will we have to submit plain python3-foo to d:l:p once d:l:p3 is eliminated?
yes.
Regards
P.S: Should I keep submitting stuff to d:l:p:singlespec? If the conversion script is around the corner I'll just wait.
We will now be dropping packages from d:l:py:singlespec as they go to d:l:py, so at this point you can submit to d:l:py directly. I will run a mass conversion sometime next week, but we will probably need to review every autoconverted package. So if you are doing it manually already, you can continue. Or you can wait and save yourself a bit of work :) regards m.
-- View this message in context: http://opensuse.14.x6.nabble.com/python-singlespec-how-to-convert-your-packa... Sent from the opensuse-packaging mailing list archive at Nabble.com.
-- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org