[pyelftools/el6] Building pyelftools with python26 - also thanks for help from Orion Poplawski
Moez Roy
moezroy at fedoraproject.org
Tue Oct 14 04:27:42 UTC 2014
commit 02c347639ea8402df2825e19f2b8b4cb7703bce1
Author: Moez Roy <moez.roy at gmail.com>
Date: Mon Oct 13 21:23:56 2014 -0700
Building pyelftools with python26 - also thanks for help from Orion Poplawski
pyelftools.spec | 71 ++++++++----------------------------------------------
1 files changed, 11 insertions(+), 60 deletions(-)
---
diff --git a/pyelftools.spec b/pyelftools.spec
index 966a9ab..2d2caea 100644
--- a/pyelftools.spec
+++ b/pyelftools.spec
@@ -1,10 +1,11 @@
-%if 0%{?fedora} || 0%{?rhel} >= 8
-%global __python_sitelib %{python2_sitelib}
-%else
-%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
+%{!?__python2: %global __python2 /usr/bin/python2}
+%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
+%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%global __python_sitelib %{python_sitelib}
-%{?__python2:%global __python2 %{__python}}
-%endif
+%global __python_sitelib %{python_sitearch}
+
+
+
%global debug_package %{nil}
%global commitdate 20130619
@@ -29,12 +30,9 @@ Patch0: pyelftools-0.22-construct.patch
BuildRequires: python2-devel
BuildRequires: python-setuptools
BuildRequires: python-construct
+BuildRequires: python-unittest2
+
-%if 0%{?fedora} || 0%{?rhel} >= 8
-BuildRequires: python3-devel
-BuildRequires: python3-setuptools
-BuildRequires: python3-construct
-%endif
%description
Pure-Python library for parsing and analyzing ELF files
@@ -52,20 +50,6 @@ Provides: %{name} = %{version}-%{release}
Pure-Python library for parsing and analyzing ELF files
and DWARF debugging information.
-
-%if 0%{?fedora} || 0%{?rhel} >= 8
-%package -n python3-%{name}
-Summary: Pure-Python library for parsing and analyzing ELF files
-
-BuildArch: noarch
-Requires: python3-construct
-
-%description -n python3-%{name}
-Pure-Python library for parsing and analyzing ELF files
-and DWARF debugging information.
-%endif
-
-
%prep
%setup -qn %{name}-%{commit}
%patch0 -p1
@@ -73,37 +57,17 @@ and DWARF debugging information.
# remove bundled construct lib
rm -rf elftools/construct
-# python3-package
-%if 0%{?fedora} || 0%{?rhel} >= 8
-rm -rf %{py3dir}
-cp -a . %{py3dir}
-
-# fix hashbang
-sed -i -e 's|#!/usr/bin/env python|#!/usr/bin/python3|' %{py3dir}/scripts/readelf.py
-%endif
-
sed -i -e 's|#!/usr/bin/env python|#!/usr/bin/python2|' scripts/readelf.py
%build
%{__python2} setup.py build
-%if 0%{?fedora} || 0%{?rhel} >= 8
-pushd %{py3dir}
-%{__python3} setup.py build
-%endif
-
%install
%{__python2} setup.py install -O1 --skip-build --root %{buildroot}
mv %{buildroot}/usr/bin/readelf.py %{buildroot}/usr/bin/pyreadelf
-%if 0%{?fedora} || 0%{?rhel} >= 8
-pushd %{py3dir}
-%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
-mv %{buildroot}/usr/bin/readelf.py %{buildroot}/usr/bin/py3readelf
-%endif
-
%check
%{__python2} test/run_all_unittests.py
@@ -113,27 +77,14 @@ mv %{buildroot}/usr/bin/readelf.py %{buildroot}/usr/bin/py3readelf
# https://github.com/eliben/pyelftools/wiki/Hacking-guide#tests
%{__python2} test/run_readelf_tests.py || :
-%if 0%{?fedora} || 0%{?rhel} >= 8
-%{__python3} test/run_all_unittests.py
-%{__python3} test/run_examples_test.py
-# tests may fail because of differences in output-formatting
-# from binutils' readelf. See:
-# https://github.com/eliben/pyelftools/wiki/Hacking-guide#tests
-%{__python3} test/run_readelf_tests.py || :
-%endif
+
%files -n python-%{name}
%doc CHANGES LICENSE README* TODO
-%{__python_sitelib}/*elftools*
%{_bindir}/pyreadelf
-%if 0%{?fedora} || 0%{?rhel} >= 8
-%files -n python3-%{name}
-%doc CHANGES LICENSE README* TODO
-%{python3_sitelib}/*elftools*
-%{_bindir}/py3readelf
-%endif
+
%changelog
More information about the scm-commits
mailing list