Commit 9258050b by devttys0

Updated setup

parent ef96a6fd
......@@ -59,28 +59,25 @@ def warning(lines, terminate=True, prompt=True):
if terminate:
sys.exit(1)
class UninstallCommand(Command):
description = "Uninstalls the Python module"
user_options = []
def find_binwalk_module_paths():
paths = []
def initialize_options(self):
try:
import binwalk
paths = binwalk.__path__
except KeyboardInterrupt as e:
raise e
except Exception:
pass
def finalize_options(self):
pass
return paths
def run(self):
try:
import binwalk
for path in binwalk.__path__:
def remove_binwalk_module():
for path in find_binwalk_module_paths():
try:
remove_tree(path)
except OSError as e:
pass
except KeyboardInterrupt as e:
raise e
except Exception as e:
pass
script_path = which(MODULE_NAME)
if script_path:
......@@ -92,6 +89,19 @@ class UninstallCommand(Command):
except Exception as e:
pass
class UninstallCommand(Command):
description = "Uninstalls the Python module"
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
remove_binwalk_module()
class CleanCommand(Command):
description = "Clean Python build directories"
user_options = []
......@@ -130,6 +140,11 @@ if "install" in sys.argv:
warning(msg, prompt=True)
# If an older version of binwalk is currently installed, completely remove it to prevent conflicts
existing_binwalk_modules = find_binwalk_module_paths()
if existing_binwalk_modules and not os.path.exists(os.path.join(existing_binwalk_modules[0], "core")):
remove_binwalk_module()
# Re-build the magic file during a build/install
if "install" in sys.argv or "build" in sys.argv:
# Generate a new magic file from the files in the magic directory
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment