Commit c9befd4c by Craig Heffner

Minor updates to setup.py

parent 7d809b1e
...@@ -218,8 +218,12 @@ class CleanCommand(Command): ...@@ -218,8 +218,12 @@ class CleanCommand(Command):
pass pass
def run(self): def run(self):
sys.stdout.write("removing %s%s" %(VERSION_FILE, os.linesep)) sys.stdout.write("removing %s\n" % (VERSION_FILE))
try:
os.remove(VERSION_FILE) os.remove(VERSION_FILE)
except OSError as e:
sys.stderr.write("failed to remove file %s: %s\n" % (VERSION_FILE, str(e)))
try: try:
remove_tree("build") remove_tree("build")
...@@ -292,13 +296,19 @@ install_data_files = [] ...@@ -292,13 +296,19 @@ install_data_files = []
for data_dir in ["magic", "config", "plugins", "modules", "core"]: for data_dir in ["magic", "config", "plugins", "modules", "core"]:
install_data_files.append("%s%s*" % (data_dir, os.path.sep)) 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): if 'install' in ' '.join(sys.argv) or 'build' in ' '.join(sys.argv):
# Create a version.py file which defines the current binwalk version. sys.stdout.write("creating %s\n" % (VERSION_FILE))
# This file is excluded from git in the .gitignore file.
sys.stdout.write("creating %s%s" % (VERSION_FILE, os.linesep)) try:
with open(VERSION_FILE, "w") as fp: with open(VERSION_FILE, "w") as fp:
fp.write("# This file has been auto-generated by setup.py\n") fp.write("# This file has been auto-generated by setup.py\n")
fp.write('__version__ = "%s"' % MODULE_VERSION) fp.write('__version__ = "%s"' % 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 # Install the module, script, and support files
setup( setup(
......
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