[python] add rpm macros file (rhbz#731800)

dmalcolm dmalcolm at fedoraproject.org
Thu Aug 18 19:26:04 UTC 2011


commit 85867c0a81ff2e52d71e69dc846a3c0efd3fed46
Author: David Malcolm <dmalcolm at redhat.com>
Date:   Thu Aug 18 15:25:42 2011 -0400

    add rpm macros file (rhbz#731800)

 macros.python2 |    4 ++++
 python.spec    |   15 ++++++++++++++-
 2 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/macros.python2 b/macros.python2
new file mode 100644
index 0000000..982b51f
--- /dev/null
+++ b/macros.python2
@@ -0,0 +1,4 @@
+%__python2 /usr/bin/python2
+%python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
+%python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")
+%python2_version %(%{__python2} -c "import sys; sys.stdout.write(sys.version[:3])")
diff --git a/python.spec b/python.spec
index 78ec2e8..22f7f1b 100644
--- a/python.spec
+++ b/python.spec
@@ -102,7 +102,7 @@ Summary: An interpreted, interactive, object-oriented programming language
 Name: %{python}
 # Remember to also rebase python-docs when changing this:
 Version: 2.7.2
-Release: 4%{?dist}
+Release: 5%{?dist}
 License: Python
 Group: Development/Languages
 Requires: %{python}-libs%{?_isa} = %{version}-%{release}
@@ -180,6 +180,11 @@ Source4: systemtap-example.stp
 # Written by dmalcolm; not yet sent upstream
 Source5: pyfuntop.stp
 
+# Supply various useful macros for building python 2 modules:
+#  __python2, python2_sitelib, python2_sitearch, python2_version
+Source6: macros.python2
+
+
 # Modules/Setup.dist is ultimately used by the "makesetup" script to construct
 # the Makefile and config.c
 #
@@ -1073,6 +1078,10 @@ sed -i -e "s/'pyconfig.h'/'%{_pyconfig_h}'/" \
   %{buildroot}%{pylibdir}/distutils/sysconfig.py \
   %{buildroot}%{pylibdir}/sysconfig.py
 
+# Install macros for rpm:
+mkdir -p %{buildroot}/%{_sysconfdir}/rpm
+install -m 644 %{SOURCE6} %{buildroot}/%{_sysconfdir}/rpm
+
 # Ensure that the curses module was linked against libncursesw.so, rather than
 # libncurses.so (bug 539917)
 ldd %{buildroot}/%{dynload_dir}/_curses*.so \
@@ -1587,6 +1596,7 @@ rm -fr %{buildroot}
 %endif
 %{_bindir}/python%{pybasever}-config
 %{_libdir}/libpython%{pybasever}.so
+%config(noreplace) %{_sysconfdir}/rpm/macros.python2
 
 %files tools
 %defattr(-,root,root,755)
@@ -1765,6 +1775,9 @@ rm -fr %{buildroot}
 # ======================================================
 
 %changelog
+* Thu Aug 18 2011 David Malcolm <dmalcolm at redhat.com> - 2.7.2-5
+- add rpm macros file (rhbz#731800)
+
 * Fri Jul  8 2011 David Malcolm <dmalcolm at redhat.com> - 2.7.2-4
 - cleanup of BuildRequires; add comment headings to specfile sections
 


More information about the scm-commits mailing list