Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
binwalk
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fact-depend
binwalk
Commits
f57a746c
Unverified
Commit
f57a746c
authored
Oct 13, 2020
by
devttys0
Committed by
GitHub
Oct 13, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #493 from ReFirmLabs/version_py
New and improved version.py
parents
8e6e02e4
e9dc12c9
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
24 deletions
+15
-24
.gitignore
.gitignore
+0
-1
setup.py
setup.py
+1
-23
version.py
src/binwalk/core/version.py
+14
-0
No files found.
.gitignore
View file @
f57a746c
build
dist
version.py
.coverage
*.extracted
*.pyc
setup.py
View file @
f57a746c
...
...
@@ -8,10 +8,9 @@ from distutils.core import setup, Command
from
distutils.dir_util
import
remove_tree
MODULE_NAME
=
"binwalk"
MODULE_VERSION
=
"2.2.
0
"
MODULE_VERSION
=
"2.2.
1
"
SCRIPT_NAME
=
MODULE_NAME
MODULE_DIRECTORY
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
VERSION_FILE
=
os
.
path
.
join
(
MODULE_DIRECTORY
,
"src"
,
"binwalk"
,
"core"
,
"version.py"
)
# Python3 has a built-in DEVNULL; for Python2, we have to open
# os.devnull to redirect subprocess stderr output to the ether.
...
...
@@ -221,13 +220,6 @@ class CleanCommand(Command):
pass
def
run
(
self
):
sys
.
stdout
.
write
(
"removing '
%
s'
\n
"
%
(
VERSION_FILE
))
try
:
os
.
remove
(
VERSION_FILE
)
except
OSError
as
e
:
sys
.
stderr
.
write
(
"failed to remove file '
%
s':
%
s
\n
"
%
(
VERSION_FILE
,
str
(
e
)))
try
:
remove_tree
(
os
.
path
.
join
(
MODULE_DIRECTORY
,
"build"
))
except
KeyboardInterrupt
as
e
:
...
...
@@ -326,20 +318,6 @@ install_data_files = []
for
data_dir
in
[
"magic"
,
"config"
,
"plugins"
,
"modules"
,
"core"
]:
install_data_files
.
append
(
"
%
s
%
s*"
%
(
data_dir
,
os
.
path
.
sep
))
# If doing a build or installation, then create a version.py file
# which defines the current binwalk version. This file is excluded
# from git in the .gitignore file.
if
'install'
in
' '
.
join
(
sys
.
argv
)
or
'build'
in
' '
.
join
(
sys
.
argv
)
or
'sdist'
in
' '
.
join
(
sys
.
argv
):
sys
.
stdout
.
write
(
"creating
%
s
\n
"
%
(
VERSION_FILE
))
try
:
with
open
(
VERSION_FILE
,
"w"
)
as
fp
:
fp
.
write
(
"# This file has been auto-generated by setup.py
\n
"
)
fp
.
write
(
'__version__ = "
%
s"
\n
'
%
MODULE_VERSION
)
except
IOError
as
e
:
sys
.
stderr
.
write
(
"failed to create file
%
s:
%
s
\n
"
%
(
VERSION_FILE
,
str
(
e
)))
sys
.
exit
(
1
)
# Install the module, script, and support files
setup
(
name
=
MODULE_NAME
,
...
...
src/binwalk/core/version.py
0 → 100644
View file @
f57a746c
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
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment