aboutsummaryrefslogtreecommitdiffstats
path: root/macros.in
diff options
context:
space:
mode:
Diffstat (limited to 'macros.in')
-rw-r--r--macros.in78
1 files changed, 59 insertions, 19 deletions
diff --git a/macros.in b/macros.in
index 2e0684d..3ae1aff 100644
--- a/macros.in
+++ b/macros.in
@@ -498,25 +498,25 @@ Provides: %{1} = %{version}-%{release}
#--------------------------------------------------------------------------------
# --without section
-%prep %{?_without_prep:%define __spec_prep_cmd /bin/true\
-%%prep\
-%{warn:Skipping %%prep stage\
-}}%{?!_without_prep:%%prep}
-
-%build %{?_without_build:%define __spec_build_cmd /bin/true\
-%%build\
-%{warn:Skipping %%build stage\
-}}%{?!_without_build:%%build}
-
-%install %{?_without_install:%define __spec_install_cmd /bin/true\
-%%install\
-%{warn:Skipping %%install stage\
-}}%{?!_without_install:%%install}
-
-%check %{?_without_check:%define __spec_check_cmd /bin/true\
-%%check\
-%{warn:Skipping %%check stage\
-}}%{?!_without_check:%%check}
+#%prep %{?_without_prep:%define __spec_prep_cmd /bin/true\
+#%%prep\
+#%{warn:Skipping %%prep stage\
+#}}%{?!_without_prep:%%prep}
+#
+#%build %{?_without_build:%define __spec_build_cmd /bin/true\
+#%%build\
+#%{warn:Skipping %%build stage\
+#}}%{?!_without_build:%%build}
+#
+#%install %{?_without_install:%define __spec_install_cmd /bin/true\
+#%%install\
+#%{warn:Skipping %%install stage\
+#}}%{?!_without_install:%%install}
+#
+#%check %{?_without_check:%define __spec_check_cmd /bin/true\
+#%%check\
+#%{warn:Skipping %%check stage\
+#}}%{?!_without_check:%%check}
# Shorthand for %{defined with_...}
# macros provided by rpm 4.4, but buggy :(
@@ -534,3 +534,43 @@ Internationalization and locale data for %{?1:%{1}}%{?!1:%{name}}\
\
%%files -n %{?1:%{1}}%{?!1:%{name}}-i18n %{?-f:%{-f}}%{?!-f:-f %{?1:%{1}}%{?!1:%{name}}.lang}\
%{nil}
+
+#------------------------------------------------------------------------------
+# Python specific macro definitions (originally from PLD).
+#
+%py_ver %(python -c "import sys; v=sys.version_info[:2]; print '%%d.%%d'%%v" 2>/dev/null || echo PYTHON-NOT-FOUND)
+%py_prefix %(python -c "import sys; print sys.prefix" 2>/dev/null || echo PYTHON-NOT-FOUND)
+%py_libdir %{py_prefix}/lib/python%{py_ver}
+%py_incdir %{py_prefix}/include/python%{py_ver}
+%py_sitedir %{py_libdir}/site-packages
+%py_compile(O) \
+find %1 -name '*.pyc' -exec rm -f {} \\; \
+python -c "import sys, os, compileall; br='%{buildroot}'; compileall.compile_dir(sys.argv[1], ddir=br and (sys.argv[1][len(os.path.abspath(br)):]+'/') or None)" %1 \
+%{-O: \
+find %1 -name '*.pyo' -exec rm -f {} \\; \
+python -O -c "import sys, os, compileall; br='%{buildroot}'; compileall.compile_dir(sys.argv[1], ddir=br and (sys.argv[1][len(os.path.abspath(br)):]+'/') or None)" %1 \
+}
+%py_requires(d) \
+%define minver %py_ver \
+%define maxver %(python -c "import sys; a,b=sys.version_info[:2]; print '%%d.%%d'%%(a,b+1)" 2>/dev/null || echo PYTHON-NOT-FOUND) \
+BuildRequires: python %{-d:python-devel} \
+PreReq: python >= %minver, python < %maxver
+
+#------------------------------------------------------------------------------
+# Redefine RPM sections to allow jumping over them
+#
+
+%prep %%prep \
+[ %{_with prep} -eq 1 ] || exit 0 \
+[ %{_with build} -eq 1 ] || exit 0 \
+[ %{_with install} -eq 1 ] || exit 0 \
+%{nil}
+
+%build %%build \
+[ %{_with install} -eq 1 ] || exit 0 \
+[ %{_with build} -eq 1 ] || exit 0 \
+%{nil}
+
+%install %%install \
+[ %{_with install} -eq 1 ] || exit 0 \
+%{nil}