From ce5d1878bb1aa469882ad60a1a50601fd9326890 Mon Sep 17 00:00:00 2001 From: Eli Bendersky Date: Thu, 22 Dec 2011 20:03:06 +0200 Subject: [PATCH] MANIFEST tweaks + arranging examples to find elftools even if it's not installed --- .hgignore | 4 ++++ MANIFEST.in | 2 +- examples/dwarf_die_tree.py | 8 ++++++++ examples/elf_low_high_api.py | 8 ++++++++ examples/elf_relocations.py | 8 ++++++++ examples/elfclass_address_size.py | 8 ++++++++ examples/examine_dwarf_info.py | 8 ++++++++ scripts/readelf.py | 2 -- 8 files changed, 45 insertions(+), 3 deletions(-) diff --git a/.hgignore b/.hgignore index ba42721..5ada10a 100644 --- a/.hgignore +++ b/.hgignore @@ -4,4 +4,8 @@ syntax: glob .coverage htmlcov tags +build +dist +MANIFEST + diff --git a/MANIFEST.in b/MANIFEST.in index 9474776..e09a955 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,7 +1,7 @@ recursive-include elftools *.py recursive-include scripts *.py recursive-include examples *.py *.elf -prune test +recursive-include test *.py *.elf include README include LICENSE include CHANGES diff --git a/examples/dwarf_die_tree.py b/examples/dwarf_die_tree.py index 5633d59..769adcf 100644 --- a/examples/dwarf_die_tree.py +++ b/examples/dwarf_die_tree.py @@ -9,6 +9,14 @@ #------------------------------------------------------------------------------- from __future__ import print_function import sys + +# If elftools is not installed, maybe we're running from the root or examples +# dir of the source distribution +try: + import elftools +except ImportError: + sys.path.extend(['.', '..']) + from elftools.elf.elffile import ELFFile diff --git a/examples/elf_low_high_api.py b/examples/elf_low_high_api.py index 43f9880..97e4dc4 100644 --- a/examples/elf_low_high_api.py +++ b/examples/elf_low_high_api.py @@ -9,6 +9,14 @@ #------------------------------------------------------------------------------- from __future__ import print_function import sys + +# If elftools is not installed, maybe we're running from the root or examples +# dir of the source distribution +try: + import elftools +except ImportError: + sys.path.extend(['.', '..']) + from elftools.elf.elffile import ELFFile from elftools.elf.sections import SymbolTableSection diff --git a/examples/elf_relocations.py b/examples/elf_relocations.py index a09f014..e142e18 100644 --- a/examples/elf_relocations.py +++ b/examples/elf_relocations.py @@ -9,6 +9,14 @@ #------------------------------------------------------------------------------- from __future__ import print_function import sys + +# If elftools is not installed, maybe we're running from the root or examples +# dir of the source distribution +try: + import elftools +except ImportError: + sys.path.extend(['.', '..']) + from elftools.elf.elffile import ELFFile from elftools.elf.relocation import RelocationSection diff --git a/examples/elfclass_address_size.py b/examples/elfclass_address_size.py index 21c839c..39c1fbc 100644 --- a/examples/elfclass_address_size.py +++ b/examples/elfclass_address_size.py @@ -9,6 +9,14 @@ #------------------------------------------------------------------------------- from __future__ import print_function import sys + +# If elftools is not installed, maybe we're running from the root or examples +# dir of the source distribution +try: + import elftools +except ImportError: + sys.path.extend(['.', '..']) + from elftools.elf.elffile import ELFFile diff --git a/examples/examine_dwarf_info.py b/examples/examine_dwarf_info.py index 7a2c034..6064412 100644 --- a/examples/examine_dwarf_info.py +++ b/examples/examine_dwarf_info.py @@ -8,6 +8,14 @@ #------------------------------------------------------------------------------- from __future__ import print_function import sys + +# If elftools is not installed, maybe we're running from the root or examples +# dir of the source distribution +try: + import elftools +except ImportError: + sys.path.extend(['.', '..']) + from elftools.elf.elffile import ELFFile diff --git a/scripts/readelf.py b/scripts/readelf.py index c133d53..6ecac7b 100755 --- a/scripts/readelf.py +++ b/scripts/readelf.py @@ -12,10 +12,8 @@ from optparse import OptionParser from itertools import ifilter import string - # If elftools is not installed, maybe we're running from the root or scripts # dir of the source distribution -# try: import elftools except ImportError: -- 2.30.2