diff --git a/pyelftools-0.24-construct.patch b/pyelftools-0.24-construct.patch deleted file mode 100644 index aec2798..0000000 --- a/pyelftools-0.24-construct.patch +++ /dev/null @@ -1,127 +0,0 @@ -diff --git a/elftools/common/construct_utils.py b/elftools/common/construct_utils.py -index 8ace30e..321ab51 100644 ---- a/elftools/common/construct_utils.py -+++ b/elftools/common/construct_utils.py -@@ -6,7 +6,7 @@ - # Eli Bendersky (eliben@gmail.com) - # This code is in the public domain - #------------------------------------------------------------------------------- --from ..construct import Subconstruct, ConstructError, ArrayError -+from construct import Subconstruct, ConstructError, ArrayError - - - class RepeatUntilExcluding(Subconstruct): -diff --git a/elftools/common/utils.py b/elftools/common/utils.py -index d8acefa..f6d017c 100644 ---- a/elftools/common/utils.py -+++ b/elftools/common/utils.py -@@ -9,7 +9,7 @@ - from contextlib import contextmanager - from .exceptions import ELFParseError, ELFError, DWARFError - from .py3compat import int2byte --from ..construct import ConstructError -+from construct import ConstructError - - - def bytelist2string(bytelist): -diff --git a/elftools/dwarf/enums.py b/elftools/dwarf/enums.py -index 9140f91..17f5c74 100644 ---- a/elftools/dwarf/enums.py -+++ b/elftools/dwarf/enums.py -@@ -6,7 +6,7 @@ - # Eli Bendersky (eliben@gmail.com) - # This code is in the public domain - #------------------------------------------------------------------------------- --from ..construct import Pass -+from construct import Pass - from ..common.py3compat import iteritems - - -diff --git a/elftools/dwarf/structs.py b/elftools/dwarf/structs.py -index e25dc84..cfc4a85 100644 ---- a/elftools/dwarf/structs.py -+++ b/elftools/dwarf/structs.py -@@ -7,7 +7,7 @@ - # Eli Bendersky (eliben@gmail.com) - # This code is in the public domain - #------------------------------------------------------------------------------- --from ..construct import ( -+from construct import ( - UBInt8, UBInt16, UBInt32, UBInt64, ULInt8, ULInt16, ULInt32, ULInt64, - SBInt8, SBInt16, SBInt32, SBInt64, SLInt8, SLInt16, SLInt32, SLInt64, - Adapter, Struct, ConstructError, If, RepeatUntil, Field, Rename, Enum, -diff --git a/elftools/elf/enums.py b/elftools/elf/enums.py -index dbeb20e..5767d41 100644 ---- a/elftools/elf/enums.py -+++ b/elftools/elf/enums.py -@@ -6,7 +6,7 @@ - # Eli Bendersky (eliben@gmail.com) - # This code is in the public domain - #------------------------------------------------------------------------------- --from ..construct import Pass -+from construct import Pass - - - # e_ident[EI_CLASS] in the ELF header -diff --git a/elftools/elf/gnuversions.py b/elftools/elf/gnuversions.py -index 4a4473f..d4f4b75 100644 ---- a/elftools/elf/gnuversions.py -+++ b/elftools/elf/gnuversions.py -@@ -6,7 +6,7 @@ - # Yann Rouillard (yann@pleiades.fr.eu.org) - # This code is in the public domain - #------------------------------------------------------------------------------ --from ..construct import CString -+from construct import CString - from ..common.utils import struct_parse, elf_assert - from .sections import Section, Symbol - -diff --git a/elftools/elf/notes.py b/elftools/elf/notes.py -index b3a41d6..526135c 100644 ---- a/elftools/elf/notes.py -+++ b/elftools/elf/notes.py -@@ -8,7 +8,7 @@ - #------------------------------------------------------------------------------- - from ..common.py3compat import bytes2str - from ..common.utils import struct_parse, roundup --from ..construct import CString -+from construct import CString - - - def iter_notes(elffile, offset, size): -diff --git a/elftools/elf/segments.py b/elftools/elf/segments.py -index c1c0279..8464248 100644 ---- a/elftools/elf/segments.py -+++ b/elftools/elf/segments.py -@@ -6,7 +6,7 @@ - # Eli Bendersky (eliben@gmail.com) - # This code is in the public domain - #------------------------------------------------------------------------------- --from ..construct import CString -+from construct import CString - from ..common.utils import struct_parse - from .constants import SH_FLAGS - from .notes import iter_notes -diff --git a/elftools/elf/structs.py b/elftools/elf/structs.py -index d2404ab..2570b4f 100644 ---- a/elftools/elf/structs.py -+++ b/elftools/elf/structs.py -@@ -7,7 +7,7 @@ - # Eli Bendersky (eliben@gmail.com) - # This code is in the public domain - #------------------------------------------------------------------------------- --from ..construct import ( -+from construct import ( - UBInt8, UBInt16, UBInt32, UBInt64, - ULInt8, ULInt16, ULInt32, ULInt64, - SBInt32, SLInt32, SBInt64, SLInt64, ---- a/setup.py~ 2016-08-05 05:18:18.000000000 +0200 -+++ b/setup.py 2018-06-17 13:51:23.961881845 +0200 -@@ -41,7 +41,6 @@ - 'elftools.elf', - 'elftools.common', - 'elftools.dwarf', -- 'elftools.construct', 'elftools.construct.lib', - ], - - scripts=['scripts/readelf.py'] diff --git a/pyelftools.spec b/pyelftools.spec index 4143dfe..e5532b8 100644 --- a/pyelftools.spec +++ b/pyelftools.spec @@ -6,21 +6,32 @@ %global py3readelf py3readelf %endif +%if 0%{?fedora} && 0%{?fedora} < 31 +%global with_python2 1 +%endif + +%if 0%{?rhel} && 0%{?rhel} < 8 +%global with_python2 1 +%endif + +%if 0%{?fedora} || 0%{?rhel} >= 8 +%global with_python3 1 +%endif + Summary: Pure-Python library for parsing and analyzing ELF files Name: pyelftools -Version: 0.24 -Release: 4%{?dist} +Version: 0.25 +Release: 1%{?dist} License: Public Domain URL: https://github.com/eliben/pyelftools Source0: https://files.pythonhosted.org/packages/source/p/pyelftools/pyelftools-%{version}.tar.gz -Patch0: pyelftools-0.24-construct.patch +%if 0%{?with_python2} BuildRequires: python2-devel BuildRequires: python2-setuptools -BuildRequires: python2-construct -%if 0%{?fedora} || 0%{?rhel} >= 8 +%endif +%if 0%{?with_python3} BuildRequires: python3-devel BuildRequires: python3-setuptools -BuildRequires: python3-construct %endif BuildArch: noarch %global _description \ @@ -28,6 +39,7 @@ Pure-Python library for parsing and analyzing ELF files\ and DWARF debugging information. %description %_description +%if 0%{?with_python2} %package -n python2-%{name} Summary: %{summary} Requires: python2-construct @@ -37,8 +49,9 @@ Requires: python2-construct Provides: %{name} = %{version}-%{release} %endif %description -n python2-%{name} %_description +%endif # with_python2 -%if 0%{?fedora} || 0%{?rhel} >= 8 +%if 0%{?with_python3} %package -n python3-%{name} Summary: %{summary} Requires: python3-construct @@ -48,46 +61,51 @@ Requires: python3-construct %prep %setup -q -%patch0 -p1 -rm -rf elftools/construct %build +%if 0%{?with_python2} %{py2_build} -%if 0%{?fedora} || 0%{?rhel} >= 8 +%endif +%if 0%{?with_python3} %{py3_build} %endif %install +%if 0%{?with_python2} %{py2_install} mv %{buildroot}/usr/bin/readelf.py %{buildroot}/usr/bin/%{py2readelf} -%if 0%{?fedora} || 0%{?rhel} >= 8 +%endif +%if 0%{?with_python3} %{py3_install} mv %{buildroot}/usr/bin/readelf.py %{buildroot}/usr/bin/%{py3readelf} %endif %check +%if 0%{?with_python2} %{__python2} test/run_all_unittests.py %{__python2} 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 %{__python2} test/run_readelf_tests.py || : - -%if 0%{?fedora} || 0%{?rhel} >= 8 +%endif +%if 0%{?with_python3} %{__python3} test/run_all_unittests.py %{__python3} test/run_examples_test.py # ditto %{__python3} test/run_readelf_tests.py || : %endif +%if 0%{?with_python2} %files -n python2-%{name} %license LICENSE %doc CHANGES %{_bindir}/%{py2readelf} %{python2_sitelib}/elftools %{python2_sitelib}/pyelftools-*.egg-info +%endif -%if 0%{?fedora} || 0%{?rhel} >= 8 +%if 0%{?with_python3} %files -n python3-%{name} %license LICENSE %doc CHANGES @@ -97,6 +115,11 @@ mv %{buildroot}/usr/bin/readelf.py %{buildroot}/usr/bin/%{py3readelf} %endif %changelog +* Sun May 05 2019 Terje Rosten - 0.25-1 +- 0.25 +- Use bundled construct as construct 2.9 is incompatible +- Drop Python 2 stuff on el8 and Python 31 or newer + * Sat Feb 02 2019 Fedora Release Engineering - 0.24-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild diff --git a/sources b/sources index d751386..e8f0ec2 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (pyelftools-0.24.tar.gz) = 5169617f9a8446ffc21dfc44ee185a388c8945a0296bdc6752483b0756888dccb10e3ee88e529d101cf31a4595de924b5c95f5459d5ee4448f57c0c4f2c56887 +SHA512 (pyelftools-0.25.tar.gz) = 06ead53ada32676161193d7e5cdb3b9e4c1910dcb34f77a544f53445651f8118b582716bf8c5cc54efb21b1ddbbcdb4b41c533350af3c41553d103c7fc74702f