Commit c04728f6 by devttys0

Fixed python3 & install bugs.

parent b62f15f9
......@@ -7,16 +7,16 @@ export exec_prefix=@exec_prefix@
export LIBDIR=@libdir@
export INSTALL_OPTIONS=@INSTALL_OPTIONS@
PYTHON=python
PYTHON=python3
SRC_C_DIR="./src/C"
.PHONY: all install build deps clean uninstall
all: build
install: build
install:
make -C $(SRC_C_DIR) install
$(PYTHON) ./setup.py install
$(PYTHON) ./setup.py install --yes
ldconfig || true
build:
......
......@@ -51,7 +51,7 @@ def warning(lines, terminate=True, prompt=True):
print("*" * WIDTH, "\n")
if prompt:
if raw_input('Continue installation anyway (Y/n)? ').lower().startswith('n'):
if raw_input('Continue anyway (Y/n)? ').lower().startswith('n'):
terminate = True
else:
terminate = False
......
......@@ -15,13 +15,18 @@ if has_key(__builtins__, 'BLOCK_FILE_PARENT_CLASS'):
else:
BLOCK_FILE_PARENT_CLASS = io.FileIO
# The __debug__ value is a bit backwards; by default it is set to True, but
# then set to False if the Python interpreter is run with the -O option.
if not __debug__:
DEBUG = True
else:
DEBUG = False
def debug(msg):
'''
Displays debug messages to stderr only if the Python interpreter was invoked with the -O flag.
'''
# The __debug__ value is a bit backwards; by default it is set to True, but
# then set to False if the Python interpreter is run with the -O option.
if not __debug__:
if DEBUG:
sys.stderr.write("DEBUG: " + msg + "\n")
sys.stderr.flush()
......
......@@ -70,7 +70,7 @@ class Settings:
Returns the path, if it exists; returns None otherwise.
'''
if self.paths.has_key(usersys) and has_key(self.paths[usersys], fname) and self.paths[usersys][fname]:
if has_key(self.paths, usersys) and has_key(self.paths[usersys], fname) and self.paths[usersys][fname]:
return self.paths[usersys][fname]
return None
......
......@@ -274,7 +274,7 @@ class Extractor(Module):
except KeyboardInterrupt as e:
raise e
except Exception as e:
if self.config.verbose:
if binwalk.core.common.DEBUG:
raise Exception("Extractor.load_defaults failed to load file '%s': %s" % (extract_file, str(e)))
def build_output_directory(self, path):
......@@ -547,8 +547,8 @@ class Extractor(Module):
except Exception as e:
binwalk.core.common.warning("Extractor.execute failed to run internal extractor '%s': %s" % (str(cmd), str(e)))
else:
# If not in verbose mode, create a temporary file to redirect stdout and stderr to
if not self.config.verbose:
# If not in debug mode, create a temporary file to redirect stdout and stderr to
if not binwalk.core.common.DEBUG:
tmp = tempfile.TemporaryFile()
# Replace all instances of FILE_NAME_PLACEHOLDER in the command with fname
......@@ -568,7 +568,7 @@ class Extractor(Module):
# Silently ignore no such file or directory errors. Why? Because these will inevitably be raised when
# making the switch to the new firmware mod kit directory structure. We handle this elsewhere, but it's
# annoying to see this spammed out to the console every time.
if self.config.verbose or (not hasattr(e, 'errno') or e.errno != 2):
if binwalk.core.common.DEBUG or (not hasattr(e, 'errno') or e.errno != 2):
binwalk.core.common.warning("Extractor.execute failed to run external extrator '%s': %s" % (str(cmd), str(e)))
retval = None
......
......@@ -25,13 +25,13 @@ class TarPlugin(binwalk.core.plugin.Plugin):
"""
# There are two possible encodings for a number field, see
# itn() below.
if s[0] != chr(0200):
if s[0] != chr(0x80):
try:
n = int(self.nts(s) or "0", 8)
except ValueError:
raise ValueError("invalid tar header")
else:
n = 0L
n = 0
for i in xrange(len(s) - 1):
n <<= 8
n += ord(s[i + 1])
......
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