Skip to content

Commit

Permalink
Added improved version.py
Browse files Browse the repository at this point in the history
  • Loading branch information
devttys0 committed Oct 13, 2020
1 parent e9a9d05 commit 5c736ea
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
build
dist
version.py
.coverage
*.extracted
*.pyc
14 changes: 14 additions & 0 deletions src/binwalk/core/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
try:
from importlib import metadata
get_version = lambda : metadata.version("binwalk")
except ImportError:
try:
# Running on pre-3.8 Python; use importlib-metadata package
import importlib_metadata as metadata
get_version = lambda: metadata.version("binwalk")
except ImportError:
# 3rd fallback via pkg_resources
import pkg_resources
get_version = lambda : pkg_resources.get_distribution("binwalk").version

__version__ = get_version()

0 comments on commit 5c736ea

Please sign in to comment.