[opensuse-packaging] spec-cleaner and Python 'TODO' tasks
Hi all, I did a small patch (under review) for spec-cleaner the other day (for my own convenience, as between Unity, MATE and Cinnamon it's over 100 packages); I've taken a small look into the TODO file on Gitorious[1] and I was thinking in throwing some more effort regarding the Python tasks for spec-cleaner. I will transcribe them here: * replace %py_ver with %python_version * replace %py_sitedir with %python_sitearch (user might want to change this to %python_sitelib if the package is noarch) print a warning if %py_libdir is found * kill (or just print a warning?) if %py_requires is found: if it's a python module, nothing is needed. If it's not, plain python Requires is what we want. Anyone (Coolo?) confortable with Python Packaging can confirm/comment or suggest that those are the right approaches so I can implement them for Vincent to review? NM -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
On Wed, Sep 26, 2012 at 1:07 PM, Nelson Marques
Hi all,
I did a small patch (under review) for spec-cleaner the other day (for my own convenience, as between Unity, MATE and Cinnamon it's over 100 packages); I've taken a small look into the TODO file on Gitorious[1] and I was thinking in throwing some more effort regarding the Python tasks for spec-cleaner. I will transcribe them here:
* replace %py_ver with %python_version
I don't see a %python_version in my macros.python file. Where is that defined?
* replace %py_sitedir with %python_sitearch (user might want to change this to %python_sitelib if the package is noarch)
Is there any way it can check for BuildArch: noarch and set python_sitelib if it is found?
print a warning if %py_libdir is found
I would first check if %{py_libdir}/site-packages is found and change that to %python_sitearch or %python_sitelib
* kill (or just print a warning?) if %py_requires is found: if it's a python module, nothing is needed. If it's not, plain python Requires is what we want.
I think %py_requires should be changed to Requires: python(abi) == %{py_ver} and %py_requires -d should be Requires: python(abi) == %{py_ver} Requires: python-devel Also, Requires: python (==/>= %{py_ver}) and its variants should probably also be changed to Requires: python(abi) == %{py_ver} A few other potential things: If you remove %{py_requires}, also make sure you remove the %if 0%{?suse_version} that often wraps it. You should check to make sure something like this is in there: %if 0%{?suse_version} && 0%{?suse_version} <= 1110 %{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} %endif For the time being it needs to be in pretty much all python packages. If you can detect noarch packages, then only one needs to be defined, otherwise both need to be. If these macros are included in the next SLE service pack as I requested then spec-cleaner should be updated to remove them. Also, you need to make sure this only applies to python 2 packages and not python 3, except for the python(abi) thing (which should be python(abi) == %{py3_ver}), none of these apply to python 3 packages. For python 3 packages, once openSUSE 11.4 is EOL I recommend looking for something like this: %if 0%{?suse_version} && 0%{?suse_version} <= 1140 %{!?python3_sitelib: %global python3_sitelib %(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} %{!?python3_sitearch: %global python3_sitearch %(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} %{!?py3_ver: %global py3_ver %(python3 -c "import sys; version=str(sys.version_info[0]) + '.' + str(sys.version_info[1]); print(version)" 2>/dev/null || echo PYTHON-NOT-FOUND)} %endif And stripping any parts of that are found. Thanks -Todd -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
On Wed, Sep 26, 2012 at 8:07 AM, Nelson Marques
* replace %py_ver with %python_version * replace %py_sitedir with %python_sitearch (user might want to change this to %python_sitelib if the package is noarch) print a warning if %py_libdir is found * kill (or just print a warning?) if %py_requires is found: if it's a python module, nothing is needed. If it's not, plain python Requires is what we want.
Isn't all that really in danger of breaking compatibility with older versions? Also, AFAIK, %python_version is usually hand-defined in every .spec file I've seen and not part of the preinstalled rpm macros. -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
participants (3)
-
Claudio Freire
-
Nelson Marques
-
todd rme