Extract pyelftools version as a tuple of integers for easy comparison.
()
| 222 | |
| 223 | # ---------------------------------------------------------------------------- |
| 224 | def elftools_version(): |
| 225 | """ |
| 226 | Extract pyelftools version as a tuple of integers for easy comparison. |
| 227 | """ |
| 228 | version = getattr(elftools, "__version__", "") |
| 229 | match = re.match(r"^(\d+)\.(\d+).*$", str(version)) |
| 230 | if not match: |
| 231 | # cannot determine version, hope for the best |
| 232 | return (0, 24) |
| 233 | return (int(match[1]), int(match[2])) |
| 234 | |
| 235 | |
| 236 | ELFTOOLS_VERSION = elftools_version() |