From 4bf34b55496bb637d1ac0255bbe9f37854e20d8f Mon Sep 17 00:00:00 2001 From: Artur Frysiak Date: Wed, 25 Feb 2009 22:37:11 +0000 Subject: [PATCH] Added python3 macros Changed files: rpm.macros -> 1.507 --- rpm.macros | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/rpm.macros b/rpm.macros index b6abb75..01e238a 100644 --- a/rpm.macros +++ b/rpm.macros @@ -809,6 +809,25 @@ fi \ # Software written in Python language require Python with main version %pyrequires_eq() Requires: %1 +# Python 3.x +# python main version +%__python3 python3.0 +%py3_ver %{expand:%%global py3_ver %(%{__python3} -c "import sys; print(sys.version[:3])" 2>/dev/null || echo ERROR)}%py3_ver + +# directories +%py3_prefix %{expand:%%global py3_prefix %(%{__python3} -c "import sys; print(sys.prefix)" 2>/dev/null || echo ERROR)}%py3_prefix +%py3_libdir %{py3_prefix}/%{_lib}/python%{py3_ver} +%py3_scriptdir %{py3_prefix}/share/python%{py3_ver} +%py3_incdir /usr/include/python%{py3_ver} +%py3_sitedir %{py3_libdir}/site-packages +%py3_sitescriptdir %{py3_scriptdir}/site-packages +%py3_dyndir %{py3_libdir}/lib-dynload + +# pure python modules compilation +%py3_comp %{__python3} -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])" + +%py3_ocomp %{__python3} -O -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])" + # Hardlink binary identical .pyc and .pyo files %__spec_install_post_py_hardlink {\ %{!?no_install_post_py_hardlink: __spec_install_post_py_hardlink() { \ @@ -835,6 +854,12 @@ for d in %{py_sitescriptdir} %{py_sitedir} %*; do \ done \ %{nil} +%py3_postclean() \ +for d in %{py3_sitescriptdir} %{py3_sitedir} %*; do \ + [ ! -d "$RPM_BUILD_ROOT$d" ] || find "$RPM_BUILD_ROOT$d" -name '*.py' -print0 | xargs -0r -l512 rm;\ +done \ +%{nil} + # depmod macro %depmod() { \ umask 022; \ -- 2.44.0