diff --git a/0001-Small-stylistic-fixes.patch b/0001-Small-stylistic-fixes.patch new file mode 100644 index 0000000000000000000000000000000000000000..7479f97121d40016ed47701c03e92f727385276d --- /dev/null +++ b/0001-Small-stylistic-fixes.patch @@ -0,0 +1,131 @@ +From 55af257faeaca39b59a1a6cd9432c2aa2987e39e Mon Sep 17 00:00:00 2001 +From: Eli Bendersky +Date: Thu, 31 Jan 2019 06:24:25 -0800 +Subject: [PATCH] Small stylistic fixes + +--- + elftools/dwarf/namelut.py | 28 ++++++++++++++-------------- + 1 file changed, 14 insertions(+), 14 deletions(-) + +diff --git a/elftools/dwarf/namelut.py b/elftools/dwarf/namelut.py +index d24a5de..2cc32d4 100755 +--- a/elftools/dwarf/namelut.py ++++ b/elftools/dwarf/namelut.py +@@ -17,7 +17,7 @@ from ..construct import CString, Struct, If + NameLUTEntry = collections.namedtuple('NameLUTEntry', 'cu_ofs die_ofs') + + class NameLUT(collections.Mapping): +- """ ++ """ + A "Name LUT" holds any of the tables specified by .debug_pubtypes or + .debug_pubnames sections. This is basically a dictionary where the key is + the symbol name (either a public variable, function or a type), and the +@@ -48,10 +48,10 @@ class NameLUT(collections.Mapping): + + # iterate over items on a per-CU basis. + import itertools +- for cu_ofs, item_list in itertools.groupby(pubnames.items(), ++ for cu_ofs, item_list in itertools.groupby(pubnames.items(), + key = lambda x: x[1].cu_ofs): + # items are now grouped by cu_ofs. +- # item_list is an iterator yeilding NameLUTEntry'ies belonging ++ # item_list is an iterator yeilding NameLUTEntry'ies belonging + # to cu_ofs. + # We can parse the CU at cu_offset and use the parsed CU results + # to parse the pubname DIEs in the CU listed by item_list. +@@ -80,7 +80,7 @@ class NameLUT(collections.Mapping): + entries. The returned entries can be pickled to a file and restored by + calling set_entries on subsequent loads. + """ +- if self._entries is None: ++ if self._entries is None: + self._entries, self._cu_headers = self._get_entries() + return self._entries + +@@ -89,7 +89,7 @@ class NameLUT(collections.Mapping): + Set the NameLUT entries from an external source. The input is a + dictionary with the symbol name as the key and NameLUTEntry(cu_ofs, + die_ofs) as the value. +- ++ + This option is useful when dealing with very large ELF files with + millions of entries. The entries can be parsed once and pickled to a + file and can be restored via this function on subsequent loads. +@@ -101,7 +101,7 @@ class NameLUT(collections.Mapping): + """ + Returns the number of entries in the NameLUT. + """ +- if self._entries is None: ++ if self._entries is None: + self._entries, self._cu_headers = self._get_entries() + return len(self._entries) + +@@ -110,7 +110,7 @@ class NameLUT(collections.Mapping): + Returns a namedtuple - NameLUTEntry(cu_ofs, die_ofs) - that corresponds + to the given symbol name. + """ +- if self._entries is None: ++ if self._entries is None: + self._entries, self._cu_headers = self._get_entries() + return self._entries.get(name) + +@@ -118,7 +118,7 @@ class NameLUT(collections.Mapping): + """ + Returns an iterator to the NameLUT dictionary. + """ +- if self._entries is None: ++ if self._entries is None: + self._entries, self._cu_headers = self._get_entries() + return iter(self._entries) + +@@ -126,7 +126,7 @@ class NameLUT(collections.Mapping): + """ + Returns the NameLUT dictionary items. + """ +- if self._entries is None: ++ if self._entries is None: + self._entries, self._cu_headers = self._get_entries() + return self._entries.items() + +@@ -135,7 +135,7 @@ class NameLUT(collections.Mapping): + Returns NameLUTEntry(cu_ofs, die_ofs) for the provided symbol name or + None if the symbol does not exist in the corresponding section. + """ +- if self._entries is None: ++ if self._entries is None: + self._entries, self._cu_headers = self._get_entries() + return self._entries.get(name, default) + +@@ -143,9 +143,9 @@ class NameLUT(collections.Mapping): + """ + Returns all CU headers. Mainly required for readelf. + """ +- if self._cu_headers is None: ++ if self._cu_headers is None: + self._entries, self._cu_headers = self._get_entries() +- ++ + return self._cu_headers + + def _get_entries(self): +@@ -164,7 +164,7 @@ class NameLUT(collections.Mapping): + # So, field "name" is conditional. + entry_struct = Struct("Dwarf_offset_name_pair", + self._structs.Dwarf_offset('die_ofs'), +- If(lambda ctx: ctx['die_ofs'],CString('name'))) ++ If(lambda ctx: ctx['die_ofs'], CString('name'))) + + # each run of this loop will fetch one CU worth of entries. + while offset < self._size: +@@ -185,7 +185,7 @@ class NameLUT(collections.Mapping): + while True: + entry = struct_parse(entry_struct, self._stream) + +- # if it is zero, then we done. ++ # if it is zero, this is the terminating record. + if entry.die_ofs == 0: + break + # add this entry to the look-up dictionary. +-- +2.42.0.windows.2 + diff --git a/pyelftools.spec b/pyelftools.spec index a760ca89dee4c3edd4d7edb5ccf78f8ee4585324..02075c43b7348e668514e3aa87284556bf7e8349 100644 --- a/pyelftools.spec +++ b/pyelftools.spec @@ -1,6 +1,6 @@ Name: pyelftools Version: 0.25 -Release: 3 +Release: 4 License: Public Domain Summary: Pure-Python library for parsing and analyzing ELF files URL: https://github.com/eliben/pyelftools @@ -9,6 +9,8 @@ Source0: https://files.pythonhosted.org/packages/source/p/pyelftools/pyel BuildRequires: python3-devel python3-setuptools BuildArch: noarch +Patch0001: 0001-Small-stylistic-fixes.patch + %description This package provides a python library for parsing and analyzing ELF files and DWARF debugging information. @@ -44,6 +46,9 @@ mv %{buildroot}/usr/bin/readelf.py %{buildroot}/usr/bin/pyreadelf %changelog +* Tue Dec 26 2023 liubo - 0.25-4 +- Small stylistic fixes + * Mon Nov 16 2020 baizhonggui - 0.25-3 - Drop Python 2 subpackage